Trim-Slice Android Kernel

From Utilite Wiki

Jump to: navigation, search



The Trim-Slice Android kernel is based on the NVIDIA Android kernel (2.6.39). CompuLab provides ready-to-run binary kernel images, and source code of the modifications and additions made to the NVIDIA Android 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 Android kernel with ramdisk from the first partition of valid boot device. The boot device is valid when:

  • physically present
  • has boot partition formatted with ext2/ext3 or vfat
  • boot partition contains the following files: uImage, boot.scr and various ramdisk.img

Default boot device layout

The Trim-Slice default boot device layout follows the Android gudelines:

  • boot partition (12M)
    • boot.scr - U-Boot boot script that selects correct kernel boot parameters and loads the kernel with ramdisk
    • uImage - Linux kernel image
    • ramdisk.img - ramdisk for SD card based boot device
    • ramdisk.ssd.img - ramdisk for SSD based boot device
    • ramdisk.usd.img - ramdisk for micro-SD based boot device
    • ramdisk.usb.img - ramdisk for USB based boot device
  • recovery partition (12M) - alternative boot partition used for Android update and upgrade
  • misc partition (512K) - used for selecting boot / recovery partition
  • system partition (384M)
  • cache partition (256M)
  • data partition (at least 128M)
  • media partition (spans the rest of the medium) - mounted at /data/media

Boot device scan order

The U-boot 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=1024M@0M vmalloc=248M video=tegrafb console=ttyS0,115200n8
  • If your display is not recognized well, its EDID data may be overriden by adding to bootargs:
dvi=720p hdmi=1080p
  • To set HDMI audio as the default output, add to bootargs:

bootcmd variable

This variable defines kernel load mechanism:

  • For internal SATA set:
usb start 1; ext2load usb 0:1 4080000 /uImage; ext2load usb 0:1 1600000 ramdisk.ssd.img; bootm 4080000 1600000
  • For micro-SD set:
mmc init 1; ext2load mmc 1 4080000 /uImage; ext2load mmc 1 1600000 ramdisk.img; bootm 4080000 1600000
  • For TFTP boot set:
dhcp; setenv serverip <your-server-ip>; tftp 4080000 uImage; tftp 1600000 ramdisk.img; bootm 4080000 1600000

Building the Trim-Slice kernel


For Trim-Slice kernel compilation we recommend to use CodeSourcery 2009-q1 cross-compiler, or cross-compiler provided by the AOSP. Install the cross-compiler by following the instructions below:

cd /home/development/cross-tools/
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
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 GitHub.
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.

Admolition note.png The following instructions assume that you have created /home/user/trimslice-devel/kernel directory for Trim-Slice kernel sources.

Snapshot download

  • Download the latest release snapshot with a web browser.
  • Extract the downloaded archive into the /home/user/trimslice-devel/kernel directory.

Git clone

  • Install git version control system.
  • Create a clone of trimslice-kernel tree
cd /home/user/trimslice-devel
git clone git:// kernel
  • Create a branch for Trim-Slice development (trimslice-devel) using the latest release tag
cd kernel
git checkout -b trimslice-devel compulab-release-14r9.06

Building the kernel

In the example below, the Linux kernel image (uImage) will be created in $KBUILD_OUTPUT, and the loadable kernel modules will be installed into the $INSTALL_MOD_PATH/lib/modules directory.

export ARCH=arm
export CROSS_COMPILE=/home/user/cross-tools/arm-2009q1/bin/arm-none-linux-gnueabi-
export KBUILD_OUTPUT=/home/user/trimslice-devel/build
export INSTALL_MOD_PATH=/home/user/trimslice-devel/lkm

cd kernel
make trimslice_android_defconfig
make uImage
make modules
make modules_install

Deploying the kernel

Admolition note.png The destination paths are on the Android boot device.
  • Copy uImage to the boot partition (/boot)
  • Copy loadable modules (*.ko) to /system/lib/modules

See also

Personal tools