YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 1

Chapter 15 Rebuilding the Linux Kernel

• Preparing the Source Code • Locating the Source Code • Installing the Source Code • Read the Documentation • Configuring and Compiling the Linux Kernel Cleaning the Source Tree • Configuring the Linux Kernel Compiling the Linux Kernel • Using Loadable Kernel Modules • Installing the Kernel and Associated Files • Changing lilo.conf (RHEL) • grub.conf • Rebooting • Boot Loader • grub: The Linux Loader • Lilo: The Linux Loader (RHEL) • LOADLlN: A DOS-Based Linux Loader • dmesg: Display Kernel Messages

Page 2: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 2

Boot loaders

• grub – update grub.conf after binary is installed

• lilo – update lilo.conf and then run lilo command to activate and rewrite your mbr

• sysctl utility – modifies kernel parameters while the system is running. Can be used instead of rebuilding the kernel– Use sysctl –a to get a list of parameters– Can be used to modify /proc/sys parameters

Page 3: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 3

Installing a Linux Kernel binary

• Run rpm with the –i (not the –U) it is a new kernel not an upgrade

• Make sure the new kernel works before you remove the old kernel

• Remove the old kernel by removing the files that contain the release number from the /boot and from grub.conf and lilo.conf

Page 4: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 4

Source code

• Get a copy of the source code:– Check /usr/src/linux* for kernel source code– Download from kernel.org or Red Hat

• Install the source code – Use up2date kernel-source

• Read the documentation!– Read the documentation/README file OR– Locate the Linux Kernel-HOWTO

Page 5: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 5

Configuring and Compiling the kernel

• Clean the source tree– # make mrproper

• Configure the linux kernel– # make config– # LANG=C make menuconfig– # make xconfig

Page 6: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 6

The qconf window as displayed by make xconfig on Fedora

Page 7: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 7

The qconf Processor Type submenu

Page 8: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 8

ESTRAVERSION number

• Use to prevent overwriting of older/other kernel information

• Defaults to release number + custom

Page 9: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 9

Next Compile the new Kernel

• Clean the old files away

# make clean

• Compile the kernel

# make bzImage

Page 10: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 10

Using Loadable kernel modules

# make modules

# make modules_install• depmod - module dependencies• insmod – lists information about loaded modules• lsmod – list loaded modules information• modinfo – list module information• modprobe – loads, unloads modules and dependencies• rmmod – removes modules from kernel

Page 11: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 11

Installing the kernel

• Copy the compiled kernel and associated files to the appropriate directory (/ or /boot)

• Now execute:

# make install

• grub – update grub.conf after binary is installed

• lilo – update lilo.conf and then run lilo command to activate and rewrite your mbr

Page 12: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 12

Rebooting and boot loaders

• grub – update grub.conf after binary is installed, Grand Unified Boot Loader.

• lilo – Linux loader, update lilo.conf and run lilo command to activate and rewrite your mbr

• loadlin: is a DOS based utility that will load Linux from DOS– See Loadlin+Win95/98/ME mini-HOWTO or– elserv.ffm.fgan.de/~lermen

Page 13: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 13

Use dmesg

• Use the dmesg utility to see if there are any problems with the installation

• If the install does not work then boot to rescue mode and change your lilo or grub configurations to point back to your old kernel

• Try again

Page 14: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 14

grub.conf

# grub.conf generated by anaconda# Note that you do not have to rerun grub after making changes to this file# NOTICE: You have a /boot partition. This means that# all kernel and initrd paths are relative to /boot/, eg.# root (hd0,0)# kernel /vmlinuz-version ro root=/dev/hda2# initrd /initrd-version.img# boot=/dev/hda default=0 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gztitle Fedora Core (2.4.22-1.2199.nptl)

root (hd0,0)kernel /vmlinuz-2.4.22-1.2199.nptl ro root=LABEL=/ rhgbinitrd /initrd-2.4.22-1.2199.nptl.img

title Fedora Core (2.4.22-1.2115.nptl)root (hd0,0)kernel /vmlinuz-2.4.22-1.2115.nptl ro root=LABEL=/ rhgbinitrd /initrd-2.4.22-1.2115.nptl.img

Page 15: CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.

CIS238/DL 15

Any Questions?


Related Documents