Updating kernel in Linaro image

Often, one wants to do minor changes to kernels included in hwpacks. The "patch", "compile". "install" and "try" has been made tricker than usual in embedded linux circles by the packaging layers, kernel module and initramfs in between.

Finding the kernel sources

Clone the kernel. For natty, it is:

git clone git://git.linaro.org/ubuntu/linux-linaro-natty.git

Find the version of the kernel in your image, either with:

# dpkg -l|grep linux-image-linaro
ii  linux-image-linaro-omap                       Linux kernel image for the OMAP architecture.

We see the kernel version is Check out that tag from the cloned tree:

cd linux-linaro-natty
git checkout -b

building the kernel

Install the crosscompiler, easy on ubuntu:

apt-cache show gcc-arm-linux-gnueabi

Build the kernel packages

export $(dpkg-architecture -aarmel)
fakeroot debian/rules clean
$DEB_BUILD_OPTIONS=parallel=4 CROSS_COMPILE=arm-linux-gnueabi- do_tools=false skipabi=true skipmodule=true fakeroot debian/rules binary-linaro-omap

copy the kernel to device

copy the linux-image*_armel.deb the device. Either by copying to the sd-card or scp over network.

copy the kernel to qemu image

For qemu images, copying the deb the image needs an trick. Mount the ext3 partition inside the image file by:

# fdisk -ul beagle_sd.img
        Device Boot      Start         End      Blocks   Id  System
beagle_sd.img1   *          63      106494       53216    c  W95 FAT32 (LBA)
beagle_sd.img2          106496     4194303     2043904   83  Linux

take the "start" number of beagle_sd.img2 (106496) and feed it to the mount command multiplied by 512:

sudo mount -o loop,offset=$[106496*512] beagle_sd.img /mnt/
cp linux-image*_armel.deb /mnt/root/

install the kernel

Boot qemu and the device, and install the package with dpkg. This will call flash-kernel and update the initramfs as needed:

dpkg -i linux-image*_armel.deb

If in qemu, take a coffee break. update will take ~30min.

RikuVoipio/UpdatingLinaroKernel (last modified 2011-06-16 12:37:47)