Last updated 4-7-15
Lab and background information: The Systems Lab (SB337) has over 20, 64-bit dual core machines running Ubuntu 10.04 and Vmware Player for use for lab project 4. In a nutshell, you will be running a 32-bit version of Ubuntu (10.04), running on a VMware Player virtual machine.
Ubuntu Desktop was chosen specifically for this lab because of its ease of use, small size, and abundant documentation/examples.
Each machine being used for CS232 are also being used for IS333. This may cause problems when trying to logon to one of these systems.
Some possible fixes to the problems that inevitably arise are:
You should logon to these machines using the same userid that you use in the Unix Lab (SB354). Your password will be the exact same as your userid, in which case you should change your password using the yppasswd command the first time you login.
After you login to any of the CS232 designated Ubuntu machines, you can start your VMWare session by going to:
System Tools > Vmware Player
When you start up Vmware Player the first time, you will be asked two things in two different dialog boxes:
Skip this Version.
There is an image already setup for you named Ubuntu.
Most of you can just select Ubuntu but if Ubuntu is not listed
under “Home” select “File”,”Open a Virtual Machine”.
Ubuntu should be listed as an option. Select Ubuntu and then select
Ubuntu.vmx. You should now be ready to
select play to boot your
Ubuntu operating system.
I Copied It.
Do not bother installing VMware Tools for Linux. I.e., click on the X on that dialog box or
Remind me Later.
After the image finishes booting up, you can login using account id mradmin, password bluestone. The root account is also set to password bluestone. You are free to make any changes you want to your Ubuntu image, but you will be responsible for remembering your account details.
The following packages needed for kernel development have already been installed on the Ubuntu image:
Additional packages can easily be added at your own discretion with the
Basic instructions for working with your kernel are as follows:
You may execute individual commands as root (the super-user) by typing:
(I personally don't like that but is just me); or
You may become root by typing:
(I like that. :)
Regardless, use the same password as mradmin.
Different Linux distributions handle kernel recompilation differenty; here are some steps you will need to do the project using Ubuntu and the 2.6.* kernel...
To perform these steps correctly, you will need to be root.
1. Unpack the kernel source (YOU MAY NOT HAVE TO DO THIS STEP.)
cd /usr/src tar --bzip2 -xvf linux-source-2.6.28.tar.bz2 ln -s /usr/src/linux-source-2.6.28 /usr/src/linux cd /usr/src/linux
2. Compile your new kernel
Initially, and, whenever you are done making and saving changes to your kernel:
menuconfig to create a "
.config" file. This is a general
kernel configuration file the compiler needs. All the default
menuconfig should work for now.
make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headersThis will compile each of the kernel source files, creating corresponding .o files, and will create new kernel image and header files with names like kernel_image-2.6.8-custom....deb and kernel_headers-2.6.8-custom...deb respectively, which we will use in our next step.
The first time you do a full kernel compile, you'll have to wait 45 minutes to 3 hours for the compilation to finish, so plan accordingly: study for your OS test, go eat, etc. Avoid using the computer, as anything you do during the compilation competes for the CPU and slows the compilation. If you leave, put a sign on your computer to let other students know that the it is in use.
When the compilation succeeds, make-kpkg will use whatever name you specified as an argument to the --appeend-to-version switch to create an entry in /usr/src naming your new kernel image.
3. Add your new kernel to the boot loader (Grub)
After the compilation finishes, enter the following to install your new kernel:
cd /usr/src ls sudo dpkg -i linux-image-18.104.22.168+drm33.21-custom_22.214.171.124+drm33.21-custom-10.00.Custom_i386.deb
(your name maybe different)
sudo dpkg -i linux-headers-126.96.36.199+drm33.21-custom_188.8.131.52+drm33.21-custom-10.00.Custom_i386.deb
(again your name will be different).
NOTE: you may get warnings when you run
dpkg above. I ignored those warnings and things worked out OK for me.
Next you need to prepare the new image for booting with “update-initramfs”.
update-initramfs -c -k 184.108.40.206+drm33.21-custom
your version name my look different and can be found in
ls -al /lib/modules/
5 root root 4096 2012-03-23 09:54 .
20 root root 12288 2012-01-25 19:19 ..
4 root root 4096 2012-01-25 14:51 2.6.32-21-generic
4 root root 4096 2012-01-25 18:53 2.6.32-38-generic
3 root root 4096 2012-03-23 09:55 220.127.116.11+drm33.21-custom
The final step to make your kernel active is to simple update grub
(the boot loader). Edit
/etc/default/grub and make sure
HIDDEN_TIMEOUT=0 is commented out as so:
This is so we can see and choose which kernel to boot during
startup. Next run
Your new kernel should now be one of grub's menu choices when you reboot your virtual machine.
4. Recompiling your new kernel
After you have compiled the kernel once, subsequent rebuilds should not take as long, since just the code you have modified has to be recompiled and then relinked.
Once you have modifed your kernel, you should:
These steps can probably be scripted...
When you re-run make-kpkg, be sure to use the same string for --append-to-version or your new image name will be different from the name in /usr/src/linux/control and you will get errors.
If you need to remove all of the .o files, the command:
will do this, and your first compile will (again) take a long time.
5. Shutting down, rebooting, etc.
You can reboot or shut down your virtual machine using the usual Ubuntu mechanisms. If you need to "manully" powerdown your virtual machine (i.e., your OS has escaped your control), you can do so using VMWare's Power Off button.
Some final considerations:
The above instructions were basically taken from the following links. I would encourage you to read these articles, since they were written by people that know a whole lot more about working with the linux kernel than I do.
make menuconfigThis mechanism seems to be more for managing the kernel's modules than hacking its source code so its use may have limited value to you except for creating that initial .config file.