How to set up Kernel Development in Virtual Box

How to set up Kernel Development in Virtual Box
This page was written to help students in my COMP3300/6330 class, however, it may also be of help to others.

This is based on the approach given in: and ubuntu-10.04.2-desktop-i386.iso Make a new virtual box using the wizard: with Operating System type: Linux Version: Ubuntu Base Memory Size: 1024MB Start-up Disk: Create new hard disk File type: VDI Storage details: Dynamically allocated Size: 30GB Run it and using the wizard select the iso as: ubuntu-10.04.2-desktop-i386.iso Install linux onto the virtual HD. Just use the basic defaults. To save some time we have also set up and virtual box hard disk which already has the compiled kernel on it. Details on installing this are available at: Kernel Development on Virtual Box Using a vdi disk image (ANU COMP3300/6330 students). This iso can be obtained from ubuntu-10.04.2-desktop-i386.iso others are also available at http://mirror.linux.org.au sudo apt-get install fakeroot build-essential libncurses5 libncurses5-dev kernel-package sudo apt-get install linux-source tar xjvf /usr/src/linux-source-2.6.32.tar.bz2 cd linux-source-2.6.32 cp -vi /boot/config-`uname -r` .config make menuconfig fakeroot make-kpkg --initrd --append-to-version=-mykernv1 kernel-image kernel-headers (Use "make-kpkg clean" before the kernel build if you want a clean build.) sudo dpkg -i linux-image-2.6.18 .... .deb sudo dpkg -i linux-headers-2.6. .... .deb sudo update-initramfs -i -k 2.6.32.59+drm33.24-mykernv1 sudo grub-install /dev/sda sudo update-grub sudo reboot now If you have a problem with the boot then hold down the "Shift" key while booting and this will let you boot a different kernel(this may take a few goes as you seem to need to press "shift" just at the right time). uname -r
 * Install and run Virtual Box.
 * Install Linux within a Virtual Box. In this example I have used:
 * Install the required packages:
 * Obtain the source code(this places the compressed source code in /usr/src):
 * Uncompress the source code in your home directory:
 * Use the booting configuration as a starting point for your new kernel's config file:
 * Set up the configuration:
 * Compile the kernel. This may take some time:
 * Install the kernel:
 * Create the initial ram file system and install and update grub for the hard disk:
 * Reboot the kernel.
 * Check you have the new kernel running.