Trim-Slice Linux Kernel
From Trim-Slice Wiki
Contents |
Overview
The Trim-Slice Linux kernel provides support for on-board peripherals and abstracts the functionality provided by the hardware. Currently supported features are specified at the Supported Features page. CompuLab provides ready-to-run binary kernel images, and source code of the modifications and additions made to the Linux kernel to work properly with the Trim-Slice.
Kernel boot process
Default boot process
The Trim-Slice U-Boot scans the various boot devices and loads the kernel from the first valid boot device. The boot device is valid when:
- physically present
- formatted with ext2/ext3 or vfat
- has uImage and boot.scr files in / or in /boot directory
Default boot device layout
The Trim-Slice default boot device layout:
- /boot/uImage - Trim-Slice Linux kernel
- /boot/boot.scr - U-Boot boot script that selects correct kernel boot parameters and loads the kernel
- / - root file system
Boot device scan order
The boot script (/boot/boot.scr) will attempt to boot from the various boot devices according to the following order:
- Front SD card
- External USB storage
- Micro-SD card
- Internal SATA storage
Custom boot process
The default Trim-Slice boot process can be overridden by setting custom bootargs and bootcmd U-boot variables:
bootargs variable
This variable defines kernel command line:
mem=384M@0M mem=512M@512M nvmem=128M@384M vmalloc=248M video=tegrafb console=ttyS0,115200
- For internal SATA add:
root=/dev/sda1 nohdparm rootwait rw
- For micro-SD add:
root=/dev/mmcblk0p1 rw
- For NFS add:
root=/dev/nfs nfsroot=your_host:/your_rootfs_path,v3 ip=dhcp rw
bootcmd variable
This variable defines kernel load mechanism:
- For internal SATA set:
usb start 1 && ext2load usb 0:1 4080000 /boot/uImage && bootm 4080000
- For micro-SD set:
mmc init 1 && ext2load mmc 1 4080000 /boot/uImage && bootm 4080000
- For TFTP boot set:
dhcp; setenv serverip your_server_ip; tftp 4080000 uImage; bootm 4080000
Building the Trim-Slice kernel
Cross-Compiler
For Trim-Slice kernel compilation we recommend to use CodeSourcery 2009-q1 cross-compiler. Install the cross-compiler by following the instructions below:
cd /home/development/cross-tools/ wget http://www.codesourcery.com/sgpp/lite/arm/portal/package4571/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 tar xvjf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
U-Boot mkimage tool
The U-Boot mkimage utility creates kernel images that can be loaded by the Trim-Slice boot-loader. You can download the pre-built mkimage binary or build it yourself:
mkdir ~/tmp
cd tmp
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjvf u-boot-latest.tar.bz2
cd u-boot-2009.08
touch include/config.{h,mk}
make tools
sudo install tools/mkimage /usr/local/bin
Getting kernel sources
The Trim-Slice kernel is publicly available on gitorious.org hosting. There are two ways to get Linux kernel sources that can be used as a baseline for Trim-Slice kernel. You can either create a copy of trimslice-kernel git tree or download a snapshot and extract it.
| | The following instructions assume that you have created /home/development/trimslice/trimslice-kernel directory for Trim-Slice kernel sources. |
Snapshot download
- Download the latest release trimslice-l4t.r15.01 tag snapshot with your web browser.
- Extract the downloaded archive into the /home/development/trimslice/trimslice-kernel directory.
Git clone
- Install git version control system.
- Create a clone of trimslice-kernel tree
cd /home/development/trimslice/ git clone git@gitorious.org:trimslice-kernel/trimslice-kernel.git trimslice-kernel
- Create a branch for Trim-Slice development using the latest trimslice-l4t.r15.01 release tag
cd trimslice-kernel git checkout -b trimslice/l4t.r15.01-dev trimslice-l4t.r15.01
Building the kernel
In the example below, the Linux kernel image (uImage) will be created in trimslice-kernel/arch/arm/boot, and the loadable kernel modules will be installed into the trimslice-kernel/modules_install/lib/modules directory.
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabi-
export PATH=${PATH}:"/home/development/cross-tools/arm-2009q1/bin/"
cd /home/development/trimslice/trimslice-kernel
make trimslice_defconfig
make uImage
make modules
INSTALL_MOD_PATH=./modules_install make modules_install
Deploying the kernel
- Copy /home/development/trimslice/trimslice-kernel/arch/arm/boot/uImage into the boot device /boot directory.
- Copy /home/development/trimslice/trimslice-kernel/modules_install/ into the boot device / directory.