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

by grant nelson goals
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

A Kernel Compiling Adventure By Grant Nelson

slide-2
SLIDE 2
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

2

slide-3
SLIDE 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

slide-4
SLIDE 4
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

4

slide-5
SLIDE 5

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

5

slide-6
SLIDE 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

  • f the system than I have.

(Scheduler was overhauled around Sept 2008)

6

slide-7
SLIDE 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

slide-8
SLIDE 8
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

8

slide-9
SLIDE 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

slide-10
SLIDE 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

slide-11
SLIDE 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

slide-12
SLIDE 12

 Startup the

VirtualBox

 Click

  • n New

12

slide-13
SLIDE 13

 Click Next  Enter a Name

for the new VM

  • I used Ubuntu, why not?

 And select Ubuntu

as the OS Type

13

slide-14
SLIDE 14

 Select RAM for

the new VM (~1GB)

14

slide-15
SLIDE 15

 Click New  Create a

Dynamically Expanding VHD (~10G)

15

slide-16
SLIDE 16

 Once done

setting up a new Virtual Machine the Guest OS needs to be installed.

16

slide-17
SLIDE 17

 Click on

Settings

 Select

CD/DVD-Rom

 Set the

recently downloaded Ubuntu Image

17

slide-18
SLIDE 18

 Click Start  Click on

Start or install Ubuntu

18

slide-19
SLIDE 19

 Once Ubuntu starts

click on the Install icon to begin install.

19

slide-20
SLIDE 20

 Go through install

  • ptions.

 Most are straight

forward.

 Use default if

answer is unknown.

20

slide-21
SLIDE 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

slide-22
SLIDE 22

 Go into

Settings and remove Ubuntu CD Image.

 Click start to

boot up the newly installed Virtual Ubuntu.

22

slide-23
SLIDE 23
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

23

slide-24
SLIDE 24

 Log in as root for session  Avoid a possible problem

▪ Some versions have a problem with the symbolic link /bin/sh pointing to /bin/dash

 Update package database

24

su rm –f /bin/sh ln –s /bin/bash /bin/sh apt-get update

slide-25
SLIDE 25

 Install needed packages  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.

25

apt-get install kernel-package libncurses5-dev fakeroot wget bzip2  cd /usr/src wget http://www.kernel.org/pub/linux/kernel/ v2.6/linux-2.6.24.1.tar.bz2 

slide-26
SLIDE 26

 Unpack kernel sources  Create symbolic link  Then go to sources  Copy the existing configuration

26

tar xjf linux-2.6.24.1.tar.bz2 ln –s linux-2.6.24.1 linux cd /usr/src/linux cp /boot/config-’uname –r’ ./.config

slide-27
SLIDE 27

 To configure  First load an

Alternate Configuration File: “.config”.

 I found it is best not

to make changed from the current configuration.

 On Exit, Save.

27

make menuconfig

slide-28
SLIDE 28

 To make a clean start

  • This will remove object files and cause a compile to take longer.

 To compile the kernel

  • The first compile might take around 5 hours
  • On a virtual machine it can take up to twice as long.
  • You may replace “custom” with any ID for the new kernel as long as it

doesn’t contain whitespace.

28

make-kpkg clean fakeroot make-kpkg --initrd --append-to-version=

  • custom kernel_image kernel_headers

slide-29
SLIDE 29

 Discover the newly built packages  Install new kernel packages  Check grub, the boot menu

29

cd /usr/src ; ls -l 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  Vi /boot/grub/menu.lst

slide-30
SLIDE 30

 Reboot Ubuntu  While restarting, select the new kernel.

  • If installed correctly it should load properly.

 Check that the new kernel is running.

30

shutdown –r now uname -r

slide-31
SLIDE 31
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

31

slide-32
SLIDE 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

slide-33
SLIDE 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

slide-34
SLIDE 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

slide-35
SLIDE 35
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

35

slide-36
SLIDE 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

slide-37
SLIDE 37

 Click Start

  • r install

Ubuntu

 Select

Language, Location, and Keyboard

37

slide-38
SLIDE 38

 Give about

10.0GB for Linux

 It might

take a while to move Windows.

38

slide-39
SLIDE 39

 Finish setting up

personal options.

 Once install is done,

the CD will eject, remove it then restart.

 Log into Ubuntu

39

slide-40
SLIDE 40

 If all when well during boot Grub will show up given the

  • ption 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

slide-41
SLIDE 41
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

41

slide-42
SLIDE 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)

42 *group = static &sched_rt; while(1) { pid = group->pick_next_task(); if(pid!=null) schedule(pid); group = group->next; }

slide-43
SLIDE 43

 The left shows the current

scheduler with all static groups.

 The right shows a block

scheduler which just brakes the fair group into several

  • groups. These groups are

sorted by their max and min processes.

43

real-time static fair idle real-time fair idle fair fair

slide-44
SLIDE 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

slide-45
SLIDE 45

 I would like to

say everything continued working perfectly…

 However,

everything got fubar.

45

slide-46
SLIDE 46

 Three weeks ago (around Nov 23rd) 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

slide-47
SLIDE 47
  • Goals
  • Virtual Ubuntu
  • Compiling a New Kernel
  • Complications
  • Installing Ubuntu on WinXP
  • Building a Block Scheduler
  • Conclusion

47

slide-48
SLIDE 48

DON’T COMPILE LINUX

…unless you have way too much free time.

48

slide-49
SLIDE 49

www.ubuntu.com

www.filehippo.com

www.psychocats.net/ubuntu/virtualbox

  • reilly.com/catalog/linuxkernel/chapter/ch10.html

www.howtoforge.com/kernel_compilation_ubuntu

www.kernel.org/pub/linux/kernel/v2.6/

apcmag.com/how_to_dual_boot_windows_xp_and_linux_xp_installed_first.htm

49