This chapter describes how to configure, compile and flash the Linux kernel for the Internet Tablet device. The chapter is targeted at developers wishing to compile their own custom kernels for the device.
Before starting, the maemo environment should be set up. The required GCC toolchain that is used to compile the kernel is included in the Scratchbox by default.
It is not mandatory to set up a separate target for kernel compilation, but this example does it in case the default armel target has been modified in some special way.
$ scratchbox
[sbox-armel: ~] > sb-conf setup MaemoKernel -c cs2005q3.2-glibc2.5-arm -t /scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 [sbox-armel: ~] > sb-conf select MaemoKernel [sbox-armel: ~] > sb-conf rs MaemoKernel /home/username/maemo-sdk-rootstrap_4.1_armel.tgz [sbox-armel: ~] > sb-conf in MaemoKernel -e -d -F
deb http://repository.maemo.org/ diablo/sdk free non-free deb-src http://repository.maemo.org/ diablo/sdk free deb http://repository.maemo.org/ diablo/tools free non-free deb-src http://repository.maemo.org/ diablo/tools free
[sbox-MaemoKernel: ~] > mkdir ~/maemo_kernel
The Scratchbox environment is now ready for compiling the kernel
Kernel sources are not included in the rootstrap, and therefore need to be downloaded from the repository.
[sbox-armel: ~] > sb-conf select MaemoKernel
[sbox-MaemoKernel: ~] > apt-get update
[sbox-MaemoKernel: ~] > cd ~/maemo_kernel [sbox-MaemoKernel: ~/maemo_kernel ] > apt-get source kernel-source-diablo
Kernel sources should now be fetched and ready to be compiled.
[sbox-MaemoKernel: ~/maemo_kernel ] > cd kernel-source-diablo-2.6.21/kernel-source/ [sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \ nokia_2420_defconfig # lots of output from make program...
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \ bzImage # compilation output... [sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > ls -l \ arch/arm/boot/zImage -rwxrwxr-x 1 maemo maemo 1530180 Nov 2 13:40 arch/arm/boot/zImage
Now the device can be flashed with the new kernel image using the Flasher tool. This should be performed outside Scratchbox. See section 11.6 for short flashing instructions.
The following steps describe how to change the default kernel configuration.
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \ nokia_2420_defconfig
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > vi \ .config
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \ oldconfig
Now a kernel image with modified configuration can be recompiled, as described in the previous section.
This section explains how to configure and compile additional kernel modules for the Internet Tablet in the maemo environment. NFS is used as an example.
[sbox-MaemoKernel:]> cd ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > vi \ .config
# # Network File Systems # # CONFIG_NFS_FS is not set # CONFIG_NFSD is not set
# # Network File Systems # CONFIG_NFS_FS=m CONFIG_NFSD=m
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \ oldconfig # lots of output here. Answer Y to NFSv3, default to others. [sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \ modules
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > find \ . -name "*.ko" -ls 1219535 20 -rw-rw-r-- 1 maemo maemo 19452 Nov 2 13:48 ./arch/arm/mach-omap2/observability.ko 1219539 12 -rw-rw-r-- 1 maemo maemo 8304 Nov 2 13:48 ./arch/arm/mach-omap2/peeknpoke.ko 1219543 8 -rw-rw-r-- 1 maemo maemo 5928 Nov 2 13:48 ./arch/arm/mach-omap2/snapshot.ko 2967668 168 -rw-rw-r-- 1 maemo maemo 167603 Nov 2 13:48 ./net/sunrpc/sunrpc.ko 2710063 32 -rw-rw-r-- 1 maemo maemo 31503 Nov 2 13:48 ./drivers/usb/gadget/g_ether.ko 2710071 24 -rw-rw-r-- 1 maemo maemo 22481 Nov 2 13:48 ./drivers/usb/gadget/gadgetfs.ko 2710067 36 -rw-rw-r-- 1 maemo maemo 36142 Nov 2 13:48 ./drivers/usb/gadget/g_file_storage.ko 2890706 128 -rw-rw-r-- 1 maemo maemo 124939 Nov 2 13:48 ./fs/ext3/ext3.ko 1219547 12 -rw-rw-r-- 1 maemo maemo 9159 Nov 2 13:48 ./fs/mbcache.ko 2890698 8 -rw-rw-r-- 1 maemo maemo 5922 Nov 2 13:48 ./fs/exportfs/exportfs.ko 2890702 64 -rw-rw-r-- 1 maemo maemo 60734 Nov 2 13:48 ./fs/ext2/ext2.ko 2890710 68 -rw-rw-r-- 1 maemo maemo 61687 Nov 2 13:48 ./fs/jbd/jbd.ko 2890718 144 -rw-rw-r-- 1 maemo maemo 142363 Nov 2 13:48 ./fs/nfs/nfs.ko 2890722 112 -rw-rw-r-- 1 maemo maemo 109711 Nov 2 13:48 ./fs/nfsd/nfsd.ko 2890714 80 -rw-rw-r-- 1 maemo maemo 75526 Nov 2 13:48 ./fs/lockd/lockd.ko
The kernel modules are kept in /mnt/initfs/lib/modules/2.6.21-omap1/. However, it is write protected. This is not a problem, because the insmod command can be used to load the modules into the running kernel from any directory where they have been saved in.
The custom kernel can be flashed from outside the Scratchbox with the flasher tool.
# flasher -f -k /scratchbox/users/<yourname>/home/<yourname>/maemo_kernel/\ kernel-source-diablo-2.6.21/kernel-source/arch/arm/boot/zImage
sponsored by