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
15
Embed
CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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
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
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
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
CIS238/DL 6
The qconf window as displayed by make xconfig on Fedora
CIS238/DL 7
The qconf Processor Type submenu
CIS238/DL 8
ESTRAVERSION number
• Use to prevent overwriting of older/other kernel information
• Defaults to release number + custom
CIS238/DL 9
Next Compile the new Kernel
• Clean the old files away
# make clean
• Compile the kernel
# make bzImage
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
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
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
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
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)