TS-47xx Kernel Compile Guide

From embeddedTS Manuals
Revision as of 16:36, 19 February 2013 by Mark (talk | contribs)

For adding new support to the kernel, or recompiling with more specific options you will need to have an X86 compatible linux host available that can handle the cross compiling. Compiling the kernel on the board is not supported or recommended. Before building the kernel you will need to install a few support libraries on your workstation:

Prerequisites

RHEL/Fedora/CentOS:

yum install ncurses-devel ncurses
yum groupinstall "Development Tools" "Development Libraries"

Ubuntu/Debian:

apt-get install build-essential libncurses5-dev libncursesw5-dev git

For other distributions, please refer to their documentation to find equivalent tools.

Set up the Sources and Toolchain

# Download the cross compile toolchain (EABI)from Technologic Systems:
wget ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4700-linux/cross-toolchains/arm-2008q3.tar.gz

# Extract the toolchain
tar xvf arm-2008q3.tar.gz

# Move arm-2008q3 to a permanent location, eg /opt/toolchains/
mkdir /opt/toolchains/
mv arm-2008q3 /opt/toolchains/

# Download the Kernel sources
git clone https://github.com/embeddedarm/linux-2.6.34-ts471x.git

cd linux-2.6.34-ts471x

# Set the CROSS_COMPILE variable to the absolute path to the toolchain.
export CROSS_COMPILE=/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-
export ARCH=arm

# This sets up the default configuration that we ship with for the TS-471x
make ts471x_defconfig

This will bring up a graphical menu where you can edit the configuration to include support for new devices. For Example, to include support for a Prolific USB to serial adapter you would go to 'Device Drivers -> USB Support-> USB Serial Support' and then select 'USB Prolific 2303 Single Port Serial Driver'. Since the kernel only has a limited space, build drivers as modules whenever possible.

make menuconfig

Build the kernel

Once you have it configured, start building. This usually takes a few minutes.

make && make modules

The new kernel will be at "arch/arm/boot" in a compressed format called zImage. The uncompressed version is simply called Image. With the default partitioning scheme it is REQUIRED that the kernel be < 2096640 bytes in size. If you need to shorten the size, try including your changes to the kernel as modules instead. Otherwise you will need to resize the kernel partition to account for the size difference.

Install the Kernel and Modules

Install the target SD card in your workstation, and mount the Debian partition. For example, if your workstation's SD card is /dev/mmcblk0:

mkdir /mnt/sd/
mount /dev/mmcblk0p2 /mnt/sd/
INSTALL_MOD_PATH=/mnt/sd/ make modules_install

## If you use sudo, you can use -E to retain your environment flags.
#INSTALL_MOD_PATH=/mnt/sd/ sudo -E make modules_install

# To install the updated kernel:
dd if=arch/arm/boot/Image of=/dev/mmcblk0p1