by grant nelson goals
play

By Grant Nelson Goals Virtual Ubuntu Compiling a New Kernel - PowerPoint PPT Presentation

A Kernel Compiling Adventure By Grant Nelson Goals Virtual Ubuntu Compiling a New Kernel Complications Installing Ubuntu on WinXP Building a Block Scheduler Conclusion 2 Read entire document before performing the


  1. A Kernel Compiling Adventure By Grant Nelson

  2.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 2

  3.  Read entire document before performing the steps laid out in this document.  Note that the methods in this document worked on my person computers but are not guaranteed to work on your own. 3

  4.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 4

  5.  Install Ubuntu  Compile a new kernel  Change the scheduler 5

  6.  Since the scheduling algorithm is O(n), a large number of processes (~400) will cause each process duration (quantum) to be less than the schedule time. (May 2008)  One option is to lengthen the quantum value, but that can cause I/O processes to be slow.  Another is overhaul the scheduling algorithm, but that would take more work and knowledge of the system than I have. (Scheduler was overhauled around Sept 2008) 6

  7.  Block scheduling uses the current scheduling method but increases the speed by a magnitude, therefore it is still O(n), but it allows around 4000 processes instead of 400.  More on that later… 7

  8.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 8

  9.  Don’t have a computer which you can install Ubuntu onto? Or don’t want to risk messing up your current system?  Use a virtual machine.  I was going to install Ubuntu in a VM (Virtual Machine) on my Dell laptop with Vista. 9

  10.  Visit www.ubuntu.com  Download the latest version of Ubuntu Desktop Disk Image and save it. (I used 8.04)  This will take a while. (1-2 hours)  Continue while download is completing. 10

  11.  Go to FileHippo.com and click on the Development Tools group.  Locate VirtualBox (typically x86) and download newest version.  Install VirtualBox just like any other Window application. 11

  12.  Startup the VirtualBox  Click on New 12

  13.  Click Next  Enter a Name for the new VM  I used Ubuntu, why not?  And select Ubuntu as the OS Type 13

  14.  Select RAM for the new VM (~1GB) 14

  15.  Click New  Create a Dynamically Expanding VHD (~10G) 15

  16.  Once done setting up a new Virtual Machine the Guest OS needs to be installed. 16

  17.  Click on Settings  Select CD/DVD-Rom  Set the recently downloaded Ubuntu Image 17

  18.  Click Start  Click on Start or install Ubuntu 18

  19.  Once Ubuntu starts click on the Install icon to begin install. 19

  20.  Go through install options.  Most are straight forward.  Use default if answer is unknown. 20

  21.  The install will take about an hour.  When complete don’t restart. Select to continue working with the LiveCD, then shut down completely. 21

  22.  Go into Settings and remove Ubuntu CD Image.  Click start to boot up the newly installed Virtual Ubuntu. 22

  23.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 23

  24.  Log in as root for session su  Avoid a possible problem ▪ Some versions have a problem with the symbolic link /bin/sh pointing to /bin/dash rm – f /bin/sh ln – s /bin/bash /bin/sh  Update package database apt-get update 24

  25.  Install needed packages apt-get install kernel-package libncurses5-dev fakeroot wget bzip2   Go shopping for your kernel source  www.kernel.org/pub/linux/kernel/v2.6/  I went with 2.6.24.1, because I could.  Download it using the release number. cd /usr/src wget http://www.kernel.org/pub/linux/kernel/ v2.6/linux-2.6.24.1.tar.bz2  25

  26.  Unpack kernel sources tar xjf linux-2.6.24.1.tar.bz2  Create symbolic link ln – s linux-2.6.24.1 linux  Then go to sources cd /usr/src/linux  Copy the existing configuration cp /boot/config- ’uname –r’ ./. config 26

  27.  To configure make menuconfig  First load an Alternate Configuration File: “. config ”.  I found it is best not to make changed from the current configuration.  On Exit, Save. 27

  28.  To make a clean start  This will remove object files and cause a compile to take longer. make-kpkg clean  To compile the kernel  The first compile might take around 5 hours  On a virtual machine it can take up to twice as long. fakeroot make-kpkg --initrd --append-to-version=  -custom kernel_image kernel_headers  You may replace “custom” with any ID for the new kernel as long as it doesn’t contain whitespace. 28

  29.  Discover the newly built packages cd /usr/src ; ls -l  Install new kernel packages dpkg – i linux-image-2.6.24.1-custom_2.6.24.1- custom-10.00.Custom_i386.deb  dpkg – i linux-headers-2.6.24.1-custom_2.6.24.1- custom-10.00.Custom_i386.deb   Check grub, the boot menu Vi /boot/grub/menu.lst 29

  30.  Reboot Ubuntu shutdown – r now  While restarting, select the new kernel.  If installed correctly it should load properly.  Check that the new kernel is running. uname -r 30

  31.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 31

  32.  The after one successful compile, I added printk that would show up while booting.  The kernel compiled correctly but wouldn’t boot. I removed the printk recompiled but it still wouldn’t boot. Something was wrong with the configuration.  That is when I noticed another problem… 32

  33.  While compiling Ubuntu in a VM, on my Dell laptop, the compiler used 100% CPU and the Disk I/O became very high.  The compile lasted for 5 hours the first time. After that it took 4 hours. Making it hard to test changes.  This also caused my computer to become incredibly hot … way too hot. 33

  34.  I got an over-temp shutdown.  I didn’t want to damage my laptop, so I decided to install Ubuntu onto my older desktop with XP. 34

  35.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 35

  36.  Burn the previously downloaded Ubuntu CD Image to a CD. (I used Alcohol 120)  Backup your XP data, just incase.  Reboot computer  Startup into Ubuntu LiveCD 36

  37.  Click Start or install Ubuntu  Select Language, Location, and Keyboard 37

  38.  Give about 10.0GB for Linux  It might take a while to move Windows. 38

  39.  Finish setting up personal options.  Once install is done, the CD will eject, remove it then restart.  Log into Ubuntu 39

  40.  If all when well during boot Grub will show up given the option to boot into either Windows XP or Ubuntu.  I repeated “Compiling a New Kernel”  This time it worked instantly, even after I added the printk.  The first compile took 3 hours, all subsequent compiles took about 30 minutes to an hour.  And with better cooling the computer didn’t get as hot. 40

  41.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 41

  42.  The scheduler contains a linked list of scheduling groups: real-time, fair, and idle. sched_rt.c, sched_fair.c, sched_idletask.c   When one group returns a non-null process that process it placed into the ready to run queue.  Idle is always last, since it will always return a non-null: the idle process.  The real-time and fair groups have a linked list of processes. (pseudo-code similar to line 3631 sched.c) *group = static &sched_rt; while(1) { pid = group->pick_next_task(); if(pid!=null) schedule(pid); group = group->next; } 42

  43.  The left shows the current real-time real-time scheduler with all static groups. fair static fair  The right shows a block fair idle scheduler which just brakes the fair group into several fair groups. These groups are sorted by their max and min idle processes. 43

  44.  Make the fair scheduler no longer static and allocate memory for it when the fair scheduler is added to real-time scheduler.  At this point the scheduler should still work the exact same way.  Next add a max-nice and min-nice level which contains the current max and min “nice” (priority) levels. 44

  45.  I would like to say everything continued working perfectly…  However, everything got fubar. 45

  46.  Three weeks ago (around Nov 23 rd ) my desktop stopped functioning. While the Bios is starting up it fails to detect a keyboard.  This has no relation to the changes to the Linux scheduler.  I have tried all I could to recover my code and get my computer to startup, but I ran out of time.  If only I hadn’t started on a VM, if only my desktop hadn’t failed, or if only I had a whole year. 46

  47.  Goals  Virtual Ubuntu  Compiling a New Kernel  Complications  Installing Ubuntu on WinXP  Building a Block Scheduler  Conclusion 47

  48. D ON ’ T C OMPILE L INUX …unless you have way too much free time. 48

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend