星期三, 1月 13, 2010

Build Android Linux Kernel for AT91SAM9261-EK

1. Get the Source and Prebuilt Toolchain
mkdir android_project
cd android_project
git clone git://android.git.kernel.org/kernel/common.git
git clone git://android.git.kernel.org/platform/prebuilt.git
cd common

2. Apply Linux 2.6.27 Patches for AT91
zcat 2.6.27-at91.patch.gz | patch -p1

3. Configure Linux using default 2.6.27 configuration at91sam9261ek_defconfig
cp at91sam9261ek_defconfig .config

4. Android-dependent Configuration
CONFIG_ASHMEM=y
CONFIG_ARM_THUMB=y

5. Build Linux Kernel
make ARCH=arm oldconfig
make ARCH=arm CROSS_COMPILE=/home/zhong/android_project/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

6. Create U-Boot Image
sudo apt-get install uboot-mkimage
mkimage -A arm -O linux -T kernel -C none -a 0x22200000 -e 0x22200040 -n 'android-linux' -d arch/arm/boot/zImage uImage


7. U-Boot command
setenv bootcmd 'tftp 0x22200000 uImage; bootm 0x22200000'


* 0x22200000 is the DRAM address where the Image is loaded to.

References
[1] Andriod Opensource Project
[2] Linux4SAM
[3] AT91 Linux 2.6 Patches
[4] lianxijian's Blog

沒有留言: