Due: Monday, March 30th @1:00PM
In this assignment you are going to be building your own kernel based on the sources and configuration provided by Ubuntu. In your next assignment you will do this configuration yourself. Follow along with the steps and everything should go smoothly. As you go, please answer the included questions about the kernel build process.
$ sudo apt-get install linux-sourceThe
kernel-package package includes everything you need to build a new kernel package, except for fakeroot:
$ sudo apt-get install kernel-package fakerootThese are extra libraries needed to build the kernel configuration tool:
$ sudo apt-get install libncurses-dev ncurses-dev
$ cd ~ $ tar xvjf /usr/src/linux-source-2.6.27.tar.bz2 $ cd linux-source-2.6.27
Question 1: Unpacking the source code took a long time. It must be really big. Use a single command to calculate how large the linux-source-2.6.27 directory is. What is the size and what command did you use to find it?
.config in the root of the source directory. Since we just unpacked this source it is unconfigured. Use this command to copy your current kernel configuration into the new source.
$ cp /boot/config-2.6.27-<version> .config
The particular version of this file on your system may vary depending on how up to date the system is. Pick the newest version available.
The following command checks the configuration you supplied against all the available configuration options to make sure everything is up to date.
$ make oldconfig
$ make menuconfig
Very important: We have to change one setting in order to prevent the kernel you build from being too big. Under "Kernel hacking" disable the option "Compile the kernel with debug info" by highlighting it and pressing n for no. Then exit and save your changes.
Question 2: What CD-ROM/DVD filesystems are supported by Ubuntu's kernel configuration? Are they compiled in or built as modules?
$ fakeroot make-kpkg --initrd --append-to-version=-cis399 kernel-image kernel-headers
This step takes at least an hour. So if you wait till Sunday night to finish, you might be in for a late night.
Question 3: The arch directory has lots of subdirectories, but if you watch the kernel building it only seems to be working with files in the arch/x86 directory. Why is this?
Question 4: Building the kernel takes a long time and builds things like drivers for "Infiniband" and "ISDN". Do you need these? Why are they included in the Ubuntu configuration? What kernel feature allows these drivers to only be activated when needed?
linux-image-2.6.27.10-cis399_2.6.27.10-cis399-10.00.Custom_i386.deb - The binary kernel package.linux-headers-2.6.27.10-cis399_2.6.27.10-cis399-10.00.Custom_i386.deb - The kernel source headers, useful if you want to compile an extra driver later without needing the rest of the kernel source code. Don't worry, it's a C thing.Use the following commands to install your new kernel:
$ cd .. $ sudo dpkg -i linux-image-2.6.27.10-cis399_2.6.27.10-cis399-10.00.Custom_i386.deb $ sudo dpkg -i linux-headers-2.6.27.10-cis399_2.6.27.10-cis399-10.00.Custom_i386.deb
Note: If you're not running Ubuntu on VirtualBox you might be running binary-only drivers which may not work on your new kernel. If you're interested in digging deeper look at this guide.
Your filenames may differ depending on system configuration.
Question 5: What is a .deb file? How is dpkg related to apt? (Do a little research to figure this one out.)
$ uname -a Linux rgrant-laptop 2.6.27.10-cis399 #1 SMP Mon Mar 23 20:14:10 EDT 2009 i686 GNU/Linux
To prove you've done the whole assignment run the following on the system after booting your new kernel and attach the file it creates (dmesg.txt) to the email you submit.
$ dmesg > dmesg.txt
Turn in your homework by sending an email with the answers to the questions and dmesg.txt to cis399ux@seas.upenn.edu. Please include "Homework 7" in the subject line and your PennKey in the message to make it easy for us to find your submission.
This assignment is based on the instructions posted at https://help.ubuntu.com/community/Kernel/Compile with additional comments and study questions added.