This mini course was taught by me only once in 2008, if I recall correctly, in a deemed university in Andhra Pradesh, India. As it was not a full-fledged course I have chosen to provide details of the mini-course, and suggestions to make it a full-fledged course, as a report.
Towards the end of the Minix Kernel Internals Lab course for Ist M.Tech. (CS), for a period of 6 days this mini-course/sub-course was conducted. The following topics were covered:
- Building the Linux Kernel. Students were taken through the steps of building the Fedora 7 Linux kernel. Topics explained included: Need for customized kernels (embedded devices, performance optimization, usage of new kernel features which are available only as kernel patches, bug fixes), boot process, grub, linux kernel executable files, statically linked kernel and dynamically loaded modules, related commands like uname, lsmod, /proc pseudo-filesystem, lspci etc., rpms needed for building kernel, configuring the kernel, installing the newly built kernel.
Students built two to three versions of the Fedora 7 kernel: A standard kernel similar to the Fedora distribution kernel and one or two smaller kernels. Some groups of students were able to reduce the kernel dynamic modules from 441 MB to less than 100 MB. They also were able to marginally reduce the statically linked kernel. As time was short we stopped at students getting a reasonable idea of what kernel customization involves.
- Very Simple Hacking of Linux Kernel. Kernel code was modified to include some printk statements. Students rebuilt this kernel and observed the output of their printk statements.
- Writing simple Linux Kernel modules. Students wrote one or two small modules and inserted them into the running kernel using insmod. A small kernel module which handles interrupts was also studied and demonstrated.
- Kernel patches. Quick introduction to Linux kernel patches, applying a patch and also creating a patch; importance of patches when contributing to Linux kernel community. We did not have time to do hands-on assignments for these topics (kernel patches).
Note: Evaluation of students was done by studying their assignment reports and by a Viva voce.
While this sub-course of 6 days (2 timetable hours per day) did give students a foot-hold in the rather intimidating area of Linux Kernel customization and Linux Kernel Programming, the period was too short to achieve any substantial goals.
I now feel that the minimum goal for such a sub-course would be the following:
• Build a minimal Linux kernel for an embedded device. Perhaps we could test that kernel using a simulator for that embedded device.
• Write a small but functional Linux device driver.
If these two goals are achieved then students will have gained something substantial. It may be of direct help for a possible device driver IInd M.Tech project. Further, students can mention it in their biodata and also talk about it during job interviews.
However, for such a sub-course the minimal period would be 4 weeks (assuming 8 timetable hours per week).
If required the course can also be made a full course by making the tasks mentioned above more complex like writing a full fledged device driver, and adding suitable topics from the resource links given below.
—- end report —
(IBM Developer Works) Hacking the Linux 2.6 kernel, Part 1: Getting ready – http://www.cagdastopcu.com/wp-content/uploads/2010/01/l-kernelhack1-pdf.pdf
(IBM Developer Works) Hacking the Linux 2.6 kernel, Part 2: Making your first hack – http://marcelotoledo.com/wp-content/uploads/2008/04/l-kernelhack2-a4.pdf
Personal Fedora 7 Installation Guide – http://www.mjmwired.net/resources/mjm-fedora-f7.html
The Linux Boot Process – http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch07_:_The_Linux_Boot_Process
Modifying the Kernel to Improve Performance – http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch33_:_Modifying_the_Kernel_to_Improve_Performance
Linux Kernel Programming US university course link – http://www.cs.utexas.edu/users/ygz/378-03S/