Chapter 8 Installing Basic System Software

As with chapter seven, this chapter's notes are broken up by section. So read each section's notes before doing what is listed in that section of the book.

8.2 Creating the /etc/fstab File

You should read this section carefully. The information contained within this section is extremely useful. To fill in the appropriate entries inside the /etc/fstab file, recall how we partitioned the system in chapter two (check the chapter two notes if you forgot). Notice our layout is completely different than what is talked about in the book. Be sure to still mount /dev/sdb1 at /sources we will need it later. I am leaving it as an exercise for you to figure out a working /etc/fstab file.

8.3 Building The Kernel

The most interesting kernel panic in the world

Building a Linux kernel is extremely easy. However, getting a kernel that works correctly can be pretty tough. Normally you would need to make sure that all your hardware's drivers would be loaded properly. Luckily, because we are using a VM, I can know what drivers are needed. We are going to build a monolithic kernel, i.e. a kernel with everything built in. The reason being that it will cut the number of possible errors that can occur by two-thirds.

Before starting, double check that the $LANG has a valid value!

Carefully follow the directions up to the second make. Here you will need to make various menu selections to create a working kernel. Carefully go through the listing below an make sure that each option listed is selected. Some of the options will be selected by default, others you will have to turn on yourself. Make sure each option is listed with an *, except for the first option which needs to be turned off.

source /etc/profile
make defconfig
make LANG=$LANG LC_ALL= menuconfig
[ ] 64-bit Kernel
Processor type and features --> 
     [*] Linux guest support -->
        [*] Enable paravirtualization code
        [*]   Paravirtualization layer for spinlocks
        [*] KVM Guest support (including kvmclock)
Device Drivers  --->
    Generic Driver Options -->
        [*] Maintain a devtmpfs filesystem to mount at /dev
    Graphics Support -->
        -*- Support for frame buffer devices --->
            <*> Userspace VESA VGA graphics support
            [*] VESA VGA graphics support
File systems  --->
    <*> Ext3 journalling file system support
    <*> The Extended 4 (ext4) filesystem
    [*] Use ext4 for ext2/ext3 file systems
    [*] Ext4 POSIX Access Control Lists
    [*] Ext4 Security Labels
Kernel Hacking ---> 
    RCU Debugging --->
        [60] RCU CPU stall timeout in seconds

When you are finished making your selections, continue following the book's directions.

8.4 Making the LFS System Bootable

Read this section carefully. You cannot just blindly follow the examples and hope that your system will boot.

Ignore section 8.4.1. This rescue disk is unnecessary in our case because we can use the LiveCD.

Use the following file for your menu list. I would recommend using vim, instead of the cat entry as listed in the book.

/boot/grub/grub.cfg
set default=0
set timeout=3

insmod ext2
set root=(hd0,1)

menuentry "GNU/Linux, LFS" {
    linux   /boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda1 ro vga=773
}

Linux virtual terminals by default will boot to a 80 character by 24 line resolution (roughly 640x480 pixels). This is really, really small. To fix this we compiled the kernel with frame buffer support. You turn this on with the kernel cheat code vga. The value of the vga parameter defines the color depth and resolution size. The value 773 corresponds to 1024x768 with 256 colors. That may be too large for some laptop monitors. You can reduce it to 800x600 using code 771 instead. If the window is still too big, go ahead and remove the vga cheat code all together.