Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Installation Guide
Building the target Linux kernel
ST Logo
Previous   Contents   Next


Building the target Linux kernel

Note: The examples below are taken from several architectures. Before using the instructions please tailor them to the required architecture (ST40, ST200 or others).

The ST Linux distribution contains pre-built kernels for the supported ST boards. If you wish to modify the kernel, reconfigure it, or port it to a new platform, it is necessary to rebuild the kernel.

The rpm program installs the kernel in a directory under the /opt/STM directory. It is advisable to copy the kernel source tree to a work directory before building the kernel. This may be done using drag and drop in a GUI file manager, or using the Linux shell command line.

For example, assuming the work directory /home/STLinux has been created, using the GUI file manager, drag the ST Linux release folder (which has a name such as linux-sh4-2.6.11_20050523) from /opt/STM/STLinux-2.0/devkit/kernel/ to /home/STLinux/, or using the command line enter:

host% mkdir /home/STLinux
host% cd /opt/STM/STLinux-2.0/devkit/kernel
host% cp -a linux-sh4-2.6.11_20050523 \
/home/STLinux

To carry out the build, cd to your copy of the kernel source tree:

host% cd /home/STLinux/linux-sh4-2.6.11_20050523

The Linux kernel comes with a complex and comprehensive build system based on Linux make. Within this build system the compiler and architecture options are left as the defaults (those appropriate to the host). To compile for the target, these options must be overridden at the command line. For example, to compile the Linux kernel binary (vmlinux) for an ST200/ST231 target:

host% make ARCH=st200 CROSS_COMPILE=st231-linux- vmlinux

A number of additional options are supported by the 2.6 kernel build system. For a list of those relevant to a particular architecture run:

host% make ARCH=<architecture> help

replacing <architecture> with the appropriate code (sh4, st200 or other). In particular make V=1 (turn on verbose mode) is useful to debug build problems, and make O=dir can be used to place object files in a different directory from the source. This is useful for building multiple kernels with different options from the same source tree.

Typical configurations for all supported boards are provided as part of the kernel source tree. One of these can be selected to initialize the kernel configuration by running make with one of the <boardname>_defconfig targets displayed by make help.

For example, to generate a kernel for an ST220-Eval board, first run make help to find the name of the target:

host% make ARCH=sh CROSS_COMPILE=sh4-linux- help
Cleaning targets:
clean - remove most generated files but keep the config
...
Architecture specific targets (sh):
zImage - Compressed kernel image (arch/sh/boot/zImage)
...
st220eval_defconfig - Build for st220eval
...

This shows the required target is st220eval_defconfig. Invoke make again, to set up the kernel configuration for this board:

host% make ARCH=sh CROSS_COMPILE=sh4-linux- st220eval_defconfig

To view the default configuration, or to change any of the defaults, run make with one of the standard configuration targets, for example:

host% make ARCH=st200 CROSS_COMPILE=st231-linux- menuconfig

Finally, to build the kernel enter:

host% make ARCH=st200 CROSS_COMPILE=st231-linux- vmlinux
Previous   Contents   Next
Valid HTML 4.01! Last updated: 2005/10/05 13:55:35
© Copyright STMicroelectronics Limited, 2005
Printer