Embedded Linux Kernel Usage Labs
Embedded Linux Kernel Usage Labs
kernel usage
Training lab book
Setup
Go to the /home/<user>/felabs/sysdev/kernel directory.
2
2004-2009 Free Electrons, http://free-electrons.com Creative Commons License
Embedded Linux
kernel usage
Training lab book
Setup
Stay in the /home/<user>/felabs/sysdev/kernel directory from
the previous lab.
Objectives
The goal of this lab is to configure, build and boot a kernel for a
minimalistic, virtual PC, emulated by the qemu emulator
(http://qemu.org)
Kernel configuration
Run makexconfig to start the kernel configuration interface. The
kernel configuration interface is provided as source code in the
kernel, makexconfig compiles it automatically, but requires
libraries and headers. You will need to install the libqt3mtdev
package, which contains the Qt development files, and the g++
package, the C++ compiler.
In the interface, toggle the Option>ShowName option. This is Also try with makemenuconfig.
useful sometimes, when the parameter name is more explicit than Though it is not graphical, some
its description, or when you're are following guidelines which give people prefer this interface. As the
menuconfig interface is based on the
the parameter name itself. Ncurses library, you will have to
Also try the Option>ShowAllOptions and Option>Show install the libncursesdev package
to use it.
DebugInfo options. They let you see all the parameters which
wouldn't appear otherwise, because they depend on the values of
other parameters. By clicking on the description of such a
parameter, you will see its preconditions and understand why it is
not selectable.
Specify a version suffix, so that you can identify your kernel in the
running system by running unamer
or cat/proc/version.
Configure your kernel for a minimalistic PC:
We advise you to unselect all options
Pentium-Pro processor (CONFIG_M686) at once, and add only the ones that
you need.
IDE hard disk (CONFIG_IDE, CONFIG_IDE_GD_ATA,
CONFIG_IDE_GENERIC)
ext2 filesystem (CONFIG_EXT2_FS)
Support for elf binaries (CONFIG_BINFMT_ELF)
Take your time to have a look at other available features!
Don't hesitate to ask your trainer for more details about a given
option.
qemu is a fast tool which can emulate several processors (x86, ppc,
arm, sparc, mips...) or even entire systems.
By using an emulator, you won't have to reboot your workstation
over and over again to test your new kernel.
To install qemuon your system, simply install the qemupackage.
4
2004-2009 Free Electrons, http://free-electrons.com Creative Commons License
Embedded Linux
kernel usage
Training lab book
Once this is done, unmount the root filesystem: If you don't umount a filesystem or
sudoumountfs do not use special mount options, you
can't be sure that your changes have
Rerun your qemu command. Now, you should reach a command line already been committed on the
physical media (the .img file in this
shell. case).
Run a few commands in the virtual PC shell. To unmount a filesystem, remember
that you must be outside of the
directory where the filesystem is
Kernel version mounted. Otherwise umount will fail
with Deviceorresourcebusy.
Query the version of the running kernel and make sure you find the
version suffix that you specified at configuration time.
Conclusion
Well done! Now you know how to configure, compile and boot a
kernel on a minimalistic PC.
Going further
If you completed your lab before the others...
Add framebuffer console support to your kernel, and choose the
VGA 16 color framebuffer driver. Then, add boot logo support.
You should now see a penguin logo when your virtual PC boots.
Add SMP (Symmetric Multi Processing) support to your kernel. Don't be surprised if the whole
Using the smp option of qemu, simulate a PC with 4 processors. kernel sources are recompiled after
enabling SMP support. This changes
Because of a temporary qemu bug you will also have to add the many data structures throughout the
noapic parameter to the kernel command line (passed by the kernel sources.
append parameter of qemu), You should now see 4 penguins on
the framebuffer console, indicating the number of CPUs found
on your system!
Add framebuffer console rotation support to your kernel, and You will find details about how to use
modify the kernel command line (append parameter again) to console rotation in the
boot your kernel with a 90 degree anticlockwise rotation. Documentation/fb/fbcon.txt file.
6
2004-2009 Free Electrons, http://free-electrons.com Creative Commons License