Getting Started Guide
Booting the kernel
|
|
Booting the kernel
The binary kernel image can be downloaded directly onto the SoC through the chip's JTAG connector using either an ST Micro Connect or an ST Micro Connect 2. This requires a program (GDB) to run on the host machine which can feed the kernel code through the ST Micro Connect into the memory of the target board, see Booting the kernel using GDB.
Booting the kernel using GDB
GDB, the GNU project
debugger is used to connect to the STMicro Connect across Ethernet,
configure some basic functionality on the target board, and download
the kernel to be run.
The ST40 Micro Toolset provides the sh4gdb program and
the ST200 Micro Toolset provides the st200gdb
program.
Note: sh4gdb/st200gdb is the only part of the bare machine toolset used when developing Linux applications. The compilers, libraries and associated tools of the bare machine toolset are not used, and the ones provided with the Linux distribution itself should be used instead.
The Micro Toolsets are provided as part of the ST Micro Connect packages or can be obtained individually.
The STLinux distribution provides a version of GDB
(sh4-linux-gdb) which can use the STMicro Connect not
only to download the Linux kernel but also to debug the Linux
kernel.
Unlike the 2.0 distribution, the Micro Toolset is no longer required.
Although it is possible to use sh4gdb directly, many users find it easier to use a wrapper script which provides an st40load style command line, using sh4gdb as the underlying download mechanism.
Note: A wrapper script is also provided for st200gdb. It is identical to the ST40 specific script described below, replacing st40 with st200.
The st40load_gdb script takes a subset of the arguments of st40load:
-b <kernel>
-
specify the kernel ELF file to download.
-c <command>
-
is the GDB command to be executed to initialize the registers of the target. This command is usually given the same name as the target board.
-n
-
do not start running automatically. Enter interactive mode after loading the kernel.
-t <target>
-
the name or IP address of the ST Micro Connect.
-x <address>, <filename>
-
-
used to download a ramdisk image. <address> is the address where the ramdisk should be loaded, <filename> is the ramdisk image file.
-- <arguments>
-
any remaining arguments are passed to the Linux kernel as the kernel's command line.
This can be used in a script to download Linux onto the target:
#!/bin/sh JEI=<name> # Name of the ST MicroConnect TARGETIP=nnn.nnn.nnn.nnn # IP address to be given to the target SERVERIP=nnn.nnn.nnn.nnn # IP address of your NFS server GWIP=nnn.nnn.nnn.nnn # IP address of your network gateway NETMASK=nnn.nnn.nnn.nnn # Local network subnet mask NAME=jim # Initial hostname for the target AUTOCONF=off # Try to determine addresses automatically? # Root of target's file system SERVERDIR=/opt/STM/ST40Linux-2.0/devkit/sh4/target # Kernel image KERNEL=$SERVERDIR/boot/vmlinux st40load_gdb \ -t $JEI \ -b $KERNEL \ -c mb379 \ -- \ console=ttySC0 \ root=/dev/nfs \ nfsroot=$SERVERIP:$SERVERDIR \ ip=$TARGETIP::$GWIP:$NETMASK:$NAME::$AUTOCONF \ mem=32m |
|
|
Note: There must be no `white space' characters after the `\' character at the ends of these lines.
This st40load_gdb script is included in the stlinux20-cross-sh4-st40load.gdb RPM package, and is installed in the same directory as the Linux cross compiler. The parameters (for example JEI=<name>) must be tailored to fit your setup before the script is executed. In particular the root file system (SERVERDIR=) must match the file system name used in Preparing the root file system and Setting up the NFS server.
|