Lab 5: Configuring GRUB Boot and Kernel Modules
Overview
This lab covers configuring the GRUB boot loader and inserting/removing modules onto a running kernel. It is recommended to perform these steps in a controlled environment like the 401lab to allow for rebooting in case of errors.
Key Concepts
- rpm (Red Hat Package Manager): Installs, verifies, and queries packages.
- Hot-plugging: A feature (especially in SuSE Linux) that allows the system to detect newly added hardware like USB or FireWire devices.
- lsmod: Lists all loaded modules.
- diff: Compares the differences between two files.
- Output Redirection: Use
command > /directory/name
to save the output of a command to a file. - tail: Displays the last part of a file.
- GRUB (Grand Unified Boot Loader): Chooses a kernel from a pre-configured list to load based on administrator specifications.
- RCS (Revision Control System): Manages file revisions.
- ci: Checks in a file to prevent multiple users from editing simultaneously.
- wc: Displays the number of lines, words, and characters in a file.
- make: Recompiles uncompiled portions of large programs.
- grep: Searches for a specific string within a file.
- tee: Replicates standard output.
- initrd (Initial RAM Disk): A temporary root file system used during the boot process.
Methods for Loading Drivers
- Magic Method: Rely on the hotplug system to automatically load the correct module.
- insmod & rmmod:
insmod module-name
installs a specific module.rmmod module-name
removes a specific module.
- modprobe: Installs a module and any necessary dependencies.
Changing Values in the .config File (Lab 4)
There are four ways to modify the .config
file:
make config
(Traditional method, less suitable for large configurations)make gconfig
make xconfig
(Graphical User Interface)make menuconfig
(Text-based Graphical Interface)
Important Considerations
- Filesystem Support: The kernel includes support for various filesystems (e.g., Apple, OS/2) for compatibility and potential future use, even if not currently running those operating systems.
- Kernel Versioning: When recompiling the kernel, ensure the
CONFIG_LOCALVERSION
is set correctly (e.g., ‘cs470’ instead of ‘default’) to avoid overwriting the existing kernel. - `make modules_install` vs. `install` and `modules_install`: Using `make modules_install` is preferred for installing modules.
- System.map: This file is a symbol table for the kernel, crucial for module loading and linking. Using an outdated
System.map
can lead to errors. - initrd and the Catch-22: The initial RAM disk solves the problem of the kernel needing to access filesystems before having the necessary drivers loaded.
- GRUB Configuration: After kernel compilation and
initrd
creation, update the GRUB configuration file. - Troubleshooting: If GRUB configuration fails, the Failsafe option or booting from the original installation CD with recovery options can be used.
- Kernel Verification: Use
dmesg | head
oruname -r
to verify the currently running kernel version. - Message of the Day: Update the message of the day by editing
/etc/motd
. - Module Compatibility: Each kernel uses modules from its specific subdirectories to avoid incompatibilities.
- Adding USB Support: Modify the
.config
file in/usr/src/linux
and rebuild the necessary modules to enable USB support.
Lab 6
Content for Lab 6 will be added here.
Extra Material: CHS Addressing
The older Cylinder-Head-Sector (CHS) addressing scheme, used to physically locate data blocks on hard drives, had limitations and was eventually replaced by Logical Block Addressing (LBA). CHS addressing on IDE drives was limited to approximately 31.5GB.