0% found this document useful (0 votes)
20 views7 pages

Kernel - Guide-Maemo-4 1 X

The document provides instructions for compiling a custom kernel for the Maemo Linux operating system used in Internet tablets. It describes downloading kernel sources, configuring and building the kernel, modifying configurations, compiling additional kernel modules, and flashing the new kernel image. The steps include setting up the development environment, obtaining sources, configuring and compiling the kernel and modules, and using flasher to install the new image on the device.

Uploaded by

Marcel Aniceto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views7 pages

Kernel - Guide-Maemo-4 1 X

The document provides instructions for compiling a custom kernel for the Maemo Linux operating system used in Internet tablets. It describes downloading kernel sources, configuring and building the kernel, modifying configurations, compiling additional kernel modules, and flashing the new kernel image. The steps include setting up the development environment, obtaining sources, configuring and compiling the kernel and modules, and using flasher to install the new image on the device.

Uploaded by

Marcel Aniceto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

 code in your hands

Maemo Diablo Reference Manual for maemo 4.1

Kernel Guide

June 19, 2008


Contents

1 Kernel Guide 2
1.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Getting Kernel Sources . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Configuring Source Tree and Compiling Kernel . . . . . . . . . . 3
1.4 Changing Default Kernel Configuration . . . . . . . . . . . . . . 4
1.5 Configuring and Compiling Kernel Modules . . . . . . . . . . . 4
1.6 Flashing Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1
Chapter 1

Kernel Guide

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.

1.1 Prerequisites
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.

• Start Scratchbox
$ scratchbox

• Create a new target called MaemoKernel with qemu-arm CPU trans-


parency. The second command installs the armel rootstraps to the target.
The last command installs the C-library, /etc, devkits and fakeroot.
[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

N.B.
The username above refers to your login name in the
environment. If you have used the maemo installer,
the rootstraps are under your home directory. If you
have performed a manual installation, the rootstrap is
under /scratchbox/packages directory. This should be
paid attention to, when running the sb-conf command
above.

2
• Verify that the sources.list file inside the scratchbox environment is cor-
rect. If the below lines are not in the /etc/apt/sources.list file, add them
there.
deb http://repository.maemo.org/ diablo free non-free
deb-src http://repository.maemo.org/ diablo free non-free

• Create a working directory (inside Scratchbox) for the kernel sources.


[sbox-MaemoKernel: ~] > mkdir ~/maemo_kernel

The Scratchbox environment is now ready for compiling the kernel

1.2 Getting Kernel Sources


Kernel sources are not included in the rootstrap, and therefore need to be
downloaded from the repository.

• Select the kernel compilation target, if not selected already.


[sbox-armel: ~] > sb-conf select MaemoKernel

• Update the package database. This requires the earlier modifications in


the sources.list file.
[sbox-MaemoKernel: ~] > apt-get update

• Go to the working directory and fetch the sources.


[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.

1.3 Configuring Source Tree and Compiling Kernel


• There is a source subdirectory. Enter the directory and create the default
configuration.
[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...

• Compile the kernel image, and check the image file timestamp to ensure
that it is properly created.
[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 1.6 for short
flashing instructions.

3
1.4 Changing Default Kernel Configuration
The following steps describe how to change the default kernel configuration.

• Restore the original default configuration, just in case it has been changed.
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > make \
nokia_2420_defconfig

• Edit the configuration file with your editor of choice. It is all right to edit
the file, even though there is a warning against changing it included.
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > vi \
.config

• Include your changes for compilation.


[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.

1.5 Configuring and Compiling Kernel Modules


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.

• Go to your working directory with kernel sources.


[sbox-MaemoKernel:]> cd ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source

• Edit the configuration file and define that the NFS will be a kernel module.
[sbox-MaemoKernel: ~/maemo_kernel/kernel-source-diablo-2.6.21/kernel-source] > vi \
.config

Find the location of the NFS configuration.


#
# Network File Systems
#
# CONFIG_NFS_FS is not set
# CONFIG_NFSD is not set

Enable NFS support as modules:


#
# Network File Systems
#
CONFIG_NFS_FS=m
CONFIG_NFSD=m

• As described in previous sections, refresh the configuration and build


new modules.
[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

4
• Check with the find command to see what kernel object files (extension
.ko) there now are.
[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 list of .ko files might differ from the list above, depending on whether
some additional changes were made to the .config file. The important files
are sunrpc.ko, nfs.ko and lockd.ko. Check that you have those.

The kernel modules are kept in /mnt/initfs/lib/modules/2.6.21-omap1/. How-


ever, 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.

1.6 Flashing Kernel


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

5
6

You might also like