[[labs.beatcraft.com]]~
[[bc9/Software/OpenEmbedded/kernel2.6.29(1/2)]]~

*Updating kernel to 2.6.29 [#s51bc679]
Once you have prepared bootable microSD with kernel 2.6.24, replace its kernel with version 2.6.29.~
Following is procedure.

**Obtaining kernel source [#bb1b002a]
This time, we modify 2.6.29.4 kernel, so get it as follows:
 $ wget http://www.jp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.4.tar.bz2
 $ tar xvfj linux-2.6.29.4.tar.bz2

**Applying patch for bc9 [#sa8f8446]
The kernel obtained from kernel.org (so called vanilla kernel) can't boot bc9 without modification, ~
even if it is built for ARM processor.~
We must patch kernel for booting up bc9.~
This tgz archive  &ref(patch-kernel-2.6.29.4-bc9-r2.tgz); contain patch files with sequential numbers.~
Do patch in serial order as follows: (Bigger number patch require previous patch already applied. So please patch in serial order.)
 $ tar xvfz patch-kernel-2.6.29.4-bc9-r2.tgz
 $ ls 
 linux-2.6.29.4  patch-kernel-2.6.29.4-bc9
 $ cd linux-2.6.29.4
 $ patch -p1 < ../patch-kernel-2.6.29.4-bc9/01-minimum.patch
 $ patch -p1 < ../patch-kernel-2.6.29.4-bc9/02-lcd.patch
 $ patch -p1 < ../patch-kernel-2.6.29.4-bc9/03-tsc.patch
 $ patch -p1 < ../patch-kernel-2.6.29.4-bc9/04-usb.patch
 $ patch -p1 < ../patch-kernel-2.6.29.4-bc9/05-proc-gpio.patch
 *snip*


Rename patch applied linux-2.6.29.4 source directory.
 $ cd ..
 $ mv linux-2.6.29.4 linux-2.6.29.4-bc9

**Preparing kernel build [#v841f766]
In order to cross build patced kernel for bc9, prepare script as follows.~
Source this script and set path to cross toolchain generated by bitbake.~ 
Source this script and set path to cross toolchain generated by bitbake.
 $ vim setup_kernel_build.sh

 #!/bin/sh
 
 export PATH=/home/beat/gumstix/gumstix-oe/tmp/cross/bin:$PATH
 export ARCH=arm
 export CROSS_COMPILE=arm-angstrom-linux-gnueabi-

 $ source setup_kernel_build.sh

After patch applied, there is linux-2.6.29.4-bc9/arch/arm/configs/bc9_defconfig. Copy this file as follows.
 $ cd linux-2.6.29.4-bc9
 $ cp arch/arm/configs/bc9_defconfig .config
This defconfig is already configured with make menuconfig in patched linux-2.6.29.4-bc9 kernel source.~
Copy defconfig and you can build kernel just executing make command. ~ 
If you have something to configure, do make oldconfig just to be on the safe side, and execute make config.~
After this, kernel build will successfully finish when you make.~
But it's not enough for bc9. bc9 requires uImage* + modules*.tgz same as bitbake generates.~
So prepare script as follows:

 $ vim make-bc9-kernel.sh

 #!/bin/sh
 
 export LANG=C
 
 GUMSTIX_HOME="/home/beat/gumstix/gumstix-oe"
 SYSMAP="./System.map"
 
 TOOL_PREFIX="${GUMSTIX_HOME}/tmp/cross/bin/arm-angstrom-linux-gnueabi-"
 DEPMOD="${TOOL_PREFIX}depmod-2.6"
 OBJCOPY=${TOOL_PREFIX}objcopy
 MKIMG=${GUMSTIX_HOME}/tmp/staging/i686-linux/bin/uboot-mkimage
 UBOOT_ENTRYPOINT="a0008000"
 MOD_WORKDIR="./mod_work"
 
 make ARCH=arm CROSS_COMPILE=${TOOL_PREFIX} prepare
 KERNREL=`make kernelrelease`
 KERNVER=`make kernelversion`
 KERNIMG="uImage-${KERNREL}.bin"
 MODTGZ="modules-${KERNREL}.tgz"
 KERNIMGLN="uImage-${KERNVER}-bc9.bin"
 MODTGZLN="modules-${KERNVER}-bc9.tgz"
 
 echo "### Cleanup"
 rm -rf ${MOD_WORKDIR}
 rm -f ${KERNIMG} ${MODTGZ} ${KERNIMGLN} ${MODTGZLN}
 
 echo "### Build kernel"
 make ARCH=arm CROSS_COMPILE=${TOOL_PREFIX}
 if [ $? != 0 ]; then
     echo "*** Failed to build kernel"
     exit 1
 fi
 
 echo "### Make kernel image"
 ${OBJCOPY} -O binary -R .note -R .comment ¥
 -S ./arch/arm/boot/compressed/vmlinux linux.bin
 if [ $? != 0 ]; then
     echo "*** Failed to make kernel image"
     exit 1
 fi
 
 ${MKIMG} -A arm -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} ¥
 -e ${UBOOT_ENTRYPOINT} -n "oe/verdex/arm" -d linux.bin ${KERNIMG}
 if [ $? != 0 ]; then
     echo "*** Failed to make kernel image"
     exit 1
 fi
 
 ln -s ${KERNIMG} ${KERNIMGLN}
 
 echo "### Install modules"
 make ARCH=arm DEPMOD=echo INSTALL_MOD_PATH=${MOD_WORKDIR} modules_install
 if [ $? != 0 ]; then
     echo "*** Failed to modules_install"
     exit 1
 fi
 
 ${DEPMOD} -A -b ${MOD_WORKDIR} -F ${SYSMAP} ${KERNREL}
 if [ $? != 0 ]; then
     echo "*** Failed to depmod modules"
     exit 1
 fi
 
 echo "### Make modules tar ball"
 tar czvf ${MODTGZ} -C ${MOD_WORKDIR} lib
 if [ $? != 0 ]; then
     echo "*** Failed to make modules tarball"
     exit 1
 fi
 
 ln -s ${MODTGZ} ${MODTGZLN}
 
 echo "### Finished"
 ls -l ${KERNIMG} ${MODTGZ}
 

**kernel build [#kd978ec6]
Execute this script in kernel source directory.
 $ mv make-bc9-kernel.sh linux-2.6.29.4-bc9
 $ cd linux-2.6.29.4-bc9
 $ ./make-bc9-kernel.sh
When build successfully finished, you will obtain two another files in addition to "make" generating files.
 modules-2.6.29.4-bc9-r2.tgz
 uImage-bc9-2.6.29.4-bc9-r2.bin

**Copying to microSD [#yc21d043]
Copy those two files to kernel 2.6.24 bootable microSD as follows:~
(We assume that vfat partition mount on /media/disk and ext2 partition mount on /media/disk-1 as described before.)~
 $ sudo cp linux-2.6.29.4-bc9/uImage-bc9-2.6.29.4-bc9-r2.bin /media/disk/uimage
 $ sudo tar -C /media/disk-1/ -xvfz linux-2.6.29.4-bc9/modules-2.6.29.4-bc9-r2.tgz

**Booting 2.6.29.4-bc9 from microSD [#v6e13a91]
Insert prepared microSD into bc9's card slot and power on bc9.~
Linux 2.6.29 boot logo(tuz) appear on LCD and bc9 boot with 2.6.29.4 kernel.
 $ uname -a
 Linux gumstix-custom-verdex 2.6.29.4-bc9-r2 #1 Tue Jun 26 20:43:33 JST 2009 armv5tel unknown

-----------------
RIGHT:by Satoshi OTSUKA

Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes