Kernel compilation

From AlwaysInnovating

Jump to: navigation, search

To compile the AIOS kernel as well as u-boot and x-load, you can either use OpenEmbedded and cross-compile it thanks to the kernel recipe, or download directly the sources and compile it with an external cross-compiler.

Note: you can also compile x-load and u-boot using this method.

Contents

Download an external cross-compiler

You can typically use the toolchain from CodeSourcery available here

Following the instructions provided, you will typically end up with the following toolchain available on your machine:

arm-none-linux-gnueabi-addr2line
arm-none-linux-gnueabi-ar
arm-none-linux-gnueabi-as
arm-none-linux-gnueabi-c++
arm-none-linux-gnueabi-c++filt
arm-none-linux-gnueabi-cpp
arm-none-linux-gnueabi-g++
arm-none-linux-gnueabi-gcc
arm-none-linux-gnueabi-gcc-4.3.3
arm-none-linux-gnueabi-gcov
arm-none-linux-gnueabi-gdb
arm-none-linux-gnueabi-gprof
arm-none-linux-gnueabi-ld
arm-none-linux-gnueabi-nm
arm-none-linux-gnueabi-objcopy
arm-none-linux-gnueabi-objdump
arm-none-linux-gnueabi-ranlib
arm-none-linux-gnueabi-readelf
arm-none-linux-gnueabi-size
arm-none-linux-gnueabi-sprite
arm-none-linux-gnueabi-strings
arm-none-linux-gnueabi-strip

You will also need the mkimage command, so be sure it's installed on your host machine. On Ubuntu, you can install it with:

sudo apt-get install uboot-mkimage

Download the sources

Get the 2011-03.a AIOS version based on the 2.6.32 Linux kernel.

Note that the source code here contains the initramfs.cpio.gz file at the top of the tree, which is necessary to have the initramfs populated. This file is generated when building the ai-initramfs-image.

Extract and compile the code

Once downloaded the tgz files, expand them in your working directory and build everything. The CROSS_COMPILE argument must be filled with the prefix of your toolchain (ensure you have it in your PATH, or then pass the full path to the make command).

mkdir ai-kernel
cd ai-kernel
tar xzvf ai-kernel-2.6.32.tgz
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm uImage

Use the kernel on your SD card

Once compiled, you just need to copy the uImage built file on the first partition of your SD card. Assuming the first partition of your SD card is under /media/disk/:

cp arch/arm/boot/uImage /media/disk/
sync

To get a full working first partition on your SD card, you must have all the necessary files:

mlo
u-boot.bin
uImage
uImage2
ai-ui.tbz2
ai-install.tbz2

Note that ai-install.tbz2 is required only for advanced reinstall features. In particular if you just want to try your own rootfs, you just need the four first files. In any case, be sure the mlo file is the first one copied on your first partition, otherwise the system will not boot.To have a full understanding of the process, we highly recommend to read the install script.

Personal tools