Editing Documentation/Maemo 5 Developer Guide/Kernel and Debugging Guide/Maemo Kernel Guide

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 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.
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.
== Prerequisites ==
== Prerequisites ==
-
Before starting, set up the Maemo environment. The required GCC toolchain that is used to compile the kernel is included in Scratchbox by default.
+
Before starting, set up the Maemo environment. The required GCC toolchain that is used to compile the kernel is included in the Scratchbox by default.
Setting up a separate target for kernel compilation is not mandatory, but this example does it in case the default armel target has been modified in some way.
Setting up a separate target for kernel compilation is not mandatory, but this example does it in case the default armel target has been modified in some way.
 +
<ul>
<ul>
Line 30: Line 33:
{{ambox|text=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 the /scratchbox/packages directory. Keep this in mind when running the sb-conf command above.}}
{{ambox|text=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 the /scratchbox/packages directory. Keep this in mind when running the sb-conf command above.}}
 +
<ul>
<ul>
Line 99: Line 103:
</pre></li>
</pre></li>
</ul>
</ul>
 +
{{ambox|text=The kernel is very strict on versions. <code>EXTRAVERSION=-omap1</code> sets the version to match the default installation. Instead of always supplying it to the <code>make</code> command, as done in this chapter, it is possible to modify the kernel <code>Makefile</code>. Another alternative is to avoid using <code>make</code> directly and use <code>dpkg-buildpackage -rfakeroot -b</code> to compile the kernel.}}
{{ambox|text=The kernel is very strict on versions. <code>EXTRAVERSION=-omap1</code> sets the version to match the default installation. Instead of always supplying it to the <code>make</code> command, as done in this chapter, it is possible to modify the kernel <code>Makefile</code>. Another alternative is to avoid using <code>make</code> directly and use <code>dpkg-buildpackage -rfakeroot -b</code> to compile the kernel.}}
Line 134: Line 139:
If you have a local repository, by default extra information will be appended to the kernel version. This will stop the kernel version from matching the default install.  To keep it from doing so, change scripts/setlocalversion to add "exit" to the beginning:
If you have a local repository, by default extra information will be appended to the kernel version. This will stop the kernel version from matching the default install.  To keep it from doing so, change scripts/setlocalversion to add "exit" to the beginning:
-
<source lang="bash">
+
<pre>
#!/bin/sh
#!/bin/sh
# Print additional version information for non-release trees.
# Print additional version information for non-release trees.
 +
exit
exit
-
</source>
+
</pre>
== Compiling External Kernel Modules ==
== Compiling External Kernel Modules ==
Line 188: Line 194:
module_exit(hello_exit);
module_exit(hello_exit);
</pre>
</pre>
-
 
+
Compiling kernel modules differs from compiling  
-
Compiling kernel modules differs from compiling normal programs. That is reflected in the <code>Makefile</code>:
+
normal programs. That is reflected in the <code>Makefile</code>:
-
 
+
<pre>
<pre>
[sbox-MaemoKernel: ~/maemo_kernel/hello-module] > cat Makefile
[sbox-MaemoKernel: ~/maemo_kernel/hello-module] > cat Makefile
Line 208: Line 213:
$(RM) -R .tmp_versions
$(RM) -R .tmp_versions
</pre>
</pre>
-
 
The <code>all:</code> target compiles the module, not using this <code>Makefile</code>,
The <code>all:</code> target compiles the module, not using this <code>Makefile</code>,
but a <code>Makefile</code> in the kernel headers folder set in variable  
but a <code>Makefile</code> in the kernel headers folder set in variable  
Line 214: Line 218:
</li>
</li>
-
<li>Compile the module.
+
<li> Compile the module.
<pre>
<pre>
[sbox-MaemoKernel: ~/maemo_kernel/hello-module] &gt; make
[sbox-MaemoKernel: ~/maemo_kernel/hello-module] &gt; make
Line 241: Line 245:
</pre></li>
</pre></li>
</ol>
</ol>
 +
File <code>hello.ko</code> is the new module. Install it by copying it to the device and running it (as root)
File <code>hello.ko</code> is the new module. Install it by copying it to the device and running it (as root)
Line 246: Line 251:
and remove it by calling  
and remove it by calling  
  Nokia-NXX-31-10:/home/user# rmmod hello.ko
  Nokia-NXX-31-10:/home/user# rmmod hello.ko
 +
Check that the module worked properly by examining the kernel ring buffer:
Check that the module worked properly by examining the kernel ring buffer:
Line 267: Line 273:
This section explains how to configure and compile additional kernel modules included in the kernel source tree for the Internet Tablet in the Maemo environment. The NFSD module is used as an example. In this section, the modules are compiled against the full kernel source tree, not the kernel headers package. This example compiles all configured modules at once.
This section explains how to configure and compile additional kernel modules included in the kernel source tree for the Internet Tablet in the Maemo environment. The NFSD module is used as an example. In this section, the modules are compiled against the full kernel source tree, not the kernel headers package. This example compiles all configured modules at once.
 +
<ul>
<ul>
Line 317: Line 324:
</ul>
</ul>
-
The list of .ko files is quite long, depending on whether or not some additional changes were made to the .config file. Module <code>nfsd.ko</code> is the one just added.
+
The list of .ko files is quite long, depending on whether or not some additional changes were made to the .config file. Module nfsd.ko is the one just added.
The kernel modules are kept under <code>/lib/modules/</code>. However, the <code>insmod</code> command can be used to load the modules into the running kernel from any directory they have been saved in.
The kernel modules are kept under <code>/lib/modules/</code>. However, the <code>insmod</code> command can be used to load the modules into the running kernel from any directory they have been saved in.
Line 323: Line 330:
== Using make menuconfig ==
== Using make menuconfig ==
-
'make menuconfig' fails to autodetect the ncurses library available in Scratchbox and exits with an error.  If you want to use 'make menuconfig', first edit <code>scripts/kconfig/lxdialog/check-lxdialog.sh</code> and change
+
'make menuconfig' fails to autodetect the ncurses library available in scratchbox and bombs out with an error.  If you want to use 'make menuconfig', first edit scripts/kconfig/lxdialog/check-lxdialog.sh and change
<pre>
<pre>
Line 346: Line 353:
== Flashing Kernel ==
== Flashing Kernel ==
-
You can flash the custom kernel from outside Scratchbox with the flasher tool using USB.
+
You can flash the custom kernel from outside the Scratchbox with the flasher tool using USB.
  # flasher-3.5 -f -k /scratchbox/users/&lt;username&gt;/home/&lt;username&gt;/\
  # flasher-3.5 -f -k /scratchbox/users/&lt;username&gt;/home/&lt;username&gt;/\

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: