EECE-4029 Operating Systems Fall 2016
Linux OS

processes, mutex, semaphores, memory management, producer-consumer, files, deadlock, more..

Get and Compile a Kernel

Rationale:
    With the kernel sources you can see precisely how the OS interacts with the hardware, make changes to the source files, re-compile and see what happens.
 
Get the latest kernel:
The following assumes the latest kernel is version linux-4.6.4 and that you are using the Ubuntu distribution of GNU/Linux. Many of the commands below require that you become super user or root. This is done by executing this:
   sudo su
and then presenting the superuser password (likely your password) at the prompt.
  1. Boot into linux and open a browser.
  2. Visit http://kernel.org/.
  3. Click Latest Stable Kernel. This will download a rather large file (> 80MB) to your computer.
  4. Say the downloaded file is linux-4.6.4.tar.xz and is in directory /home/franco/Downloads.
  5. Become root.
  6. If there is no directory /usr/src/kernels do this: mkdir /usr/src/kernels
  7. Then mv /home/franco/Downloads/linux-4.6.4.tar.xz /usr/src/kernels
  8. and cd /usr/src/kernels
  9. tar -xJf linux-4.6.4.tar.xz
  10. rm linux-4.6.4.tar.xz
  11. cd linux-4.6.4
 
Configure the kernel:
  1. Be sure qt is installed - in Ubuntu you can get qt like this as root:
    apt-get install libqt4-dev libqt4-dev-bin qt4-dev-tools
    Do a google search to find out how to get this in some other distribution.
  2. Be sure gcc and g++ are installed - in Ubuntu you can get these like this as root:
    apt-get install gcc g++
    Note: a graphical tool for installing packages is synaptic. Use it like this as root:
    synaptic
  3. Be sure the current directory is /usr/src/kernels/linux-4.6.4 (as an example)
  4. Be sure you are the super user (root)
  5. Execute make xconfig
  6. Select items to add to or remove from the kernel. There is a long list. Try to remove things that are obviously not needed like ird, isdn, Video for linux and so on. Blank boxes mean items will not be added to the kernel. Dotted boxes mean items will be added as modules, checked boxes mean items will be compiled into the kernel. When choosing an item for addition, use the module version whenever possible.
  7. Click the "Save" item in the "File" menu and quit
 
Compile the kernel:
  1. Be sure the current directory is /usr/src/kernels/linux-4.6.4 (as an example)
  2. Be sure you are the super user (root)
  3. Execute make
  4. Wait a very long time the first time this is done
  5. Execute make modules_install this does not take too long
  6. Execute make install
  7. The files vmlinuz-4.6.4, System.map-4.6.4, and either initrd-4.6.4.img or initramfs-4.6.4.img are added to the /boot directory and the modules for this kernel are in /lib/modules/4.6.4.
 
Run Linux:
The bootloader is called grub2. Upon boot a menu appears. A kernel to boot may be selected. After selection, hit return. A default selection is booted if no user response is detected in 10 seconds. The recently compiled kernel will have a 4.6.4 extension (for example).