diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index ffe20ce1e..ace47328b 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -1,16 +1,19 @@ - %general-entities; ]> - - -Making the LFS System Bootable - - - - - + + + + + Making the LFS System Bootable + + + + + diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index 60322d2da..439057b4f 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -1,18 +1,23 @@ - %general-entities; ]> + -Creating the /etc/fstab File - + -/etc/fstab + Creating the /etc/fstab File -The /etc/fstab file is used by some programs to -determine where file systems are to be mounted by default, in which order, and -which must be checked (for integrity errors) prior to mounting. Create a new -file systems table like this: + + /etc/fstab + + + The /etc/fstab file is used by some programs to + determine where file systems are to be mounted by default, in which order, and + which must be checked (for integrity errors) prior to mounting. Create a new + file systems table like this: cat > /etc/fstab << "EOF" # Begin /etc/fstab @@ -29,36 +34,35 @@ shm /dev/shm tmpfs defaults 0 0 # End /etc/fstab EOF -Replace [xxx], -[yyy], and [fff] -with the values appropriate for the system, for example, hda2, hda5, and ext2. For details on the six -fields in this file, see man 5 fstab. + Replace [xxx], + [yyy], and [fff] + with the values appropriate for the system, for example, hda2, hda5, and ext2. For details on the six + fields in this file, see man 5 fstab. -The /dev/shm mount point -for tmpfs is included to -allow enabling POSIX-shared memory. The kernel must have the required -support built into it for this to work (more about this is in the next -section). Please note that very little software currently uses -POSIX-shared memory. Therefore, consider the /dev/shm mount point optional. For more -information, see -Documentation/filesystems/tmpfs.txt in the kernel -source tree. + The /dev/shm mount point + for tmpfs is included to + allow enabling POSIX-shared memory. The kernel must have the required + support built into it for this to work (more about this is in the next + section). Please note that very little software currently uses + POSIX-shared memory. Therefore, consider the /dev/shm mount point optional. For more + information, see + Documentation/filesystems/tmpfs.txt in the kernel + source tree. -There are other lines which may be added to the -/etc/fstab file. One example is a line for USB -devices: + There are other lines which may be added to the + /etc/fstab file. One example is a line for USB + devices: usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0 -This option will only work if Support for Host-side USB and -USB device filesystem are configured in the kernel. If -Support for Host-side USB is compiled as a module, then -usbcore must be listed in -/etc/sysconfig/modules. + This option will only work if Support for Host-side USB + and USB device filesystem are configured in the kernel. If + Support for Host-side USB is compiled as a module, then + usbcore must be listed in + /etc/sysconfig/modules. - diff --git a/chapter08/grub.xml b/chapter08/grub.xml index 862abd41b..172026016 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -1,88 +1,93 @@ - %general-entities; ]> + -Making the LFS System Bootable - + - -GRUB -configuring + Making the LFS System Bootable -Your shiny new LFS system is almost complete. One of the last -things to do is to ensure that the system can be properly booted. The -instructions below apply only to computers of IA-32 architecture, -meaning mainstream PCs. Information on boot loading for -other architectures should be available in the usual resource-specific -locations for those architectures. + + GRUB + configuring + -Boot loading can be a complex area, so a few cautionary -words are in order. Be familiar with the current boot loader and any other -operating systems present on the hard drive(s) that need to be -bootable. Make sure that an emergency boot disk is ready to -rescue the computer if the computer becomes -unusable (un-bootable). + Your shiny new LFS system is almost complete. One of the last + things to do is to ensure that the system can be properly booted. The + instructions below apply only to computers of IA-32 architecture, + meaning mainstream PCs. Information on boot loading for + other architectures should be available in the usual resource-specific + locations for those architectures. -Earlier, we compiled and installed the GRUB boot loader software -in preparation for this step. The procedure involves writing some -special GRUB files to specific locations on the hard drive. We highly -recommend creating a GRUB boot floppy diskette as a backup. Insert a -blank floppy diskette and run the following commands: + Boot loading can be a complex area, so a few cautionary + words are in order. Be familiar with the current boot loader and any other + operating systems present on the hard drive(s) that need to be + bootable. Make sure that an emergency boot disk is ready to + rescue the computer if the computer becomes + unusable (un-bootable). + + Earlier, we compiled and installed the GRUB boot loader software + in preparation for this step. The procedure involves writing some + special GRUB files to specific locations on the hard drive. We highly + recommend creating a GRUB boot floppy diskette as a backup. Insert a + blank floppy diskette and run the following commands: dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1 dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1 -Remove the diskette and store it somewhere safe. Now, run the -grub shell: + Remove the diskette and store it somewhere safe. Now, run the + grub shell: grub -GRUB uses its own naming structure for drives and partitions in -the form of (hdn,m), where n -is the hard drive number and m is the partition -number, both starting from zero. For example, partition hda1 is (hd0,0) to -GRUB and hdb3 is -(hd1,2). In contrast to Linux, GRUB does not -consider CD-ROM drives to be hard drives. For example, if using a CD -on hdb and a second hard drive -on hdc, that second hard drive -would still be (hd1). + GRUB uses its own naming structure for drives and partitions in + the form of (hdn,m), where n + is the hard drive number and m is the partition + number, both starting from zero. For example, partition hda1 is (hd0,0) to + GRUB and hdb3 is + (hd1,2). In contrast to Linux, GRUB does not + consider CD-ROM drives to be hard drives. For example, if using a CD + on hdb and a second hard drive + on hdc, that second hard drive + would still be (hd1). -Using the above information, determine the appropriate -designator for the root partition (or boot partition, if a separate -one is used). For the following example, it is assumed that the root -(or separate boot) partition is hda4. + Using the above information, determine the appropriate + designator for the root partition (or boot partition, if a separate + one is used). For the following example, it is assumed that the root + (or separate boot) partition is hda4. -Tell GRUB where to search for its -stage{1,2} files. The Tab key can be used -everywhere to make GRUB show the alternatives: + Tell GRUB where to search for its + stage{1,2} files. The Tab key can be used + everywhere to make GRUB show the alternatives: root (hd0,3) -The following command will overwrite the current boot -loader. Do not run the command if this is not desired, for example, if -using a third party boot manager to manage the Master Boot Record -(MBR). In this scenario, it would make more sense to install -GRUB into the boot sector of the LFS partition. In this -case, this next command would become setup -(hd0,3). + + The following command will overwrite the current boot loader. Do not + run the command if this is not desired, for example, if using a third party + boot manager to manage the Master Boot Record (MBR). In this scenario, it + would make more sense to install GRUB into the boot sector + of the LFS partition. In this case, this next command would become + setup (hd0,3). + -Tell GRUB to install itself into the MBR of -hda: + Tell GRUB to install itself into the MBR of + hda: setup (hd0) -If all went well, GRUB will have reported finding its files in -/boot/grub. That's all there is -to it. Quit the grub shell: + If all went well, GRUB will have reported finding its files in + /boot/grub. That's all there is + to it. Quit the grub shell: quit -Create a menu list file defining GRUB's boot menu: + Create a menu list file defining GRUB's boot menu: cat > /boot/grub/menu.lst << "EOF" # Begin /boot/grub/menu.lst @@ -102,8 +107,8 @@ root (hd0,3) kernel /boot/lfskernel-&linux-version; root=/dev/hda4 EOF -Add an entry for the host distribution if desired. It might look -like this: + Add an entry for the host distribution if desired. It might look + like this: cat >> /boot/grub/menu.lst << "EOF" title Red Hat @@ -112,8 +117,8 @@ kernel /boot/kernel-2.6.5 root=/dev/hda3 initrd /boot/initrd-2.6.5 EOF -If dual-booting Windows, the following entry will allow -booting it: + If dual-booting Windows, the following entry will allow + booting it: cat >> /boot/grub/menu.lst << "EOF" title Windows @@ -121,16 +126,15 @@ rootnoverify (hd0,0) chainloader +1 EOF -If info grub does not provide all necessary material, additional -information regarding GRUB is located on its website at: -. + If info grub does not provide all necessary material, + additional information regarding GRUB is located on its website at: + . -The FHS stipulates that GRUB's menu.lst file should be symlinked to -/etc/grub/menu.lst. To satisfy this requirement, issue the -following command: + The FHS stipulates that GRUB's menu.lst file should + be symlinked to /etc/grub/menu.lst. To + satisfy this requirement, issue the following command: mkdir -v /etc/grub && ln -sv /boot/grub/menu.lst /etc/grub - diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index 95bb37f7d..d1c15fcfe 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -1,16 +1,18 @@ - %general-entities; ]> - -Introduction - -It is time to make the LFS system bootable. This chapter -discusses creating an fstab file, building a -kernel for the new LFS system, and installing the GRUB boot loader so -that the LFS system can be selected for booting at startup. + + + + Introduction + + It is time to make the LFS system bootable. This chapter + discusses creating an fstab file, building a + kernel for the new LFS system, and installing the GRUB boot loader so + that the LFS system can be selected for booting at startup. - diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml index fb6a05b19..fcac33a39 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -1,212 +1,243 @@ - %general-entities; ]> + -Linux-&linux-version; - + -Linux + Linux-&linux-version; - -<para>The Linux package contains the Linux kernel.</para> + <indexterm zone="ch-bootable-kernel"> + <primary sortas="a-Linux">Linux</primary> + </indexterm> -<segmentedlist> -<segtitle>&buildtime;</segtitle> -<segtitle>&diskspace;</segtitle> -<seglistitem><seg>4.20 SBU</seg> -<seg>181 MB</seg></seglistitem> -</segmentedlist> + <sect2 role="package"> + <title/> -<segmentedlist> -<segtitle>&dependencies;</segtitle> -<seglistitem><seg>Bash, Binutils, Coreutils, Findutils, -GCC, Glibc, Grep, Gzip, Make, Modutils, Perl, and Sed</seg></seglistitem> -</segmentedlist> -</sect2> + <para>The Linux package contains the Linux kernel.</para> -<sect2 role="installation"> -<title>Installation of the kernel + + &buildtime; + &diskspace; -Building the kernel involves a few steps—configuration, compilation, -and installation. Read the README file in the kernel source -tree for alternative methods to the way this book configures the kernel. + + 4.20 SBU + 181 MB + + -Prepare for compilation by running the following command: + + &dependencies; + + + Bash, Binutils, Coreutils, Findutils, GCC, Glibc, Grep, Gzip, + Make, Modutils, Perl, and Sed + + + + + + + Installation of the kernel + + Building the kernel involves a few steps—configuration, + compilation, and installation. Read the README file + in the kernel source tree for alternative methods to the way this book + configures the kernel. + + Prepare for compilation by running the following command: make mrproper -This ensures that the kernel tree is absolutely clean. The -kernel team recommends that this command be issued prior to each -kernel compilation. Do not rely on the source tree being clean after -un-tarring. + This ensures that the kernel tree is absolutely clean. The + kernel team recommends that this command be issued prior to each + kernel compilation. Do not rely on the source tree being clean after + un-tarring. -If, in it was decided to -compile the keymap into the kernel, issue the command below: + If, in it was decided to + compile the keymap into the kernel, issue the command below: loadkeys -m /usr/share/kbd/keymaps/[path to keymap] > \ drivers/char/defkeymap.c -For example, if using a Dutch keyboard, use -/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz. + For example, if using a Dutch keyboard, use + /usr/share/kbd/keymaps/i386/qwerty/nl.map.gz. -Configure the kernel via a menu-driven interface. BLFS has some -information regarding particular kernel configuration requirements of -packages outside of LFS at : + Configure the kernel via a menu-driven interface. BLFS has some + information regarding particular kernel configuration requirements of + packages outside of LFS at : make menuconfig -Alternatively, make oldconfig may be more appropriate in some -situations. See the README file for more -information. + Alternatively, make oldconfig may be more + appropriate in some situations. See the README + file for more information. -If desired, skip kernel configuration by copying the kernel -config file, .config, from the host system -(assuming it is available) to the unpacked linux-&linux-version; directory. However, -we do not recommend this option. It is often better to explore all the -configuration menus and create the kernel configuration from -scratch. + If desired, skip kernel configuration by copying the kernel + config file, .config, from the host system + (assuming it is available) to the unpacked linux-&linux-version; directory. However, + we do not recommend this option. It is often better to explore all the + configuration menus and create the kernel configuration from + scratch. -NPTL requires the kernel to be compiled with GCC-3.x or later, in this case -&gcc-version;. It is not recommended to compile the kernel with GCC-2.95.x, as -this causes failures in the Glibc test suite. Normally, this wouldn't be -mentioned as LFS doesn't build GCC-2.95.x. Unfortunately, the kernel -documentation is outdated and still claims GCC-2.95.3 is the recommended -compiler. + + NPTL requires the kernel to be compiled with GCC-3.x or later, in + this case &gcc-version;. It is not recommended to compile the kernel with + GCC-2.95.x, as this causes failures in the Glibc test suite. Normally, + this wouldn't be mentioned as LFS doesn't build GCC-2.95.x. Unfortunately, + the kernel documentation is outdated and still claims GCC-2.95.3 is the + recommended compiler. + -Compile the kernel image and modules: + Compile the kernel image and modules: make -If using kernel modules, an /etc/modprobe.conf file -may be needed. Information pertaining to modules and kernel configuration is -located in the kernel documentation in the linux-&linux-version;/Documentation directory. -Also, modprobe.conf(5) may be of interest. + If using kernel modules, an /etc/modprobe.conf file + may be needed. Information pertaining to modules and kernel configuration is + located in the kernel documentation in the linux-&linux-version;/Documentation directory. + Also, modprobe.conf(5) may be of interest. -Be very careful when reading other documentation relating to kernel -modules because it usually applies to 2.4.x kernels only. As far as we know, -kernel configuration issues specific to Hotplug and Udev are not documented. -The problem is that Udev will create a device node only if Hotplug or a -user-written script inserts the corresponding module into the kernel, and not -all modules are detectable by Hotplug. Note that statements like the one below -in the /etc/modprobe.conf file do not work with -Udev: + Be very careful when reading other documentation relating to kernel + modules because it usually applies to 2.4.x kernels only. As far as we know, + kernel configuration issues specific to Hotplug and Udev are not documented. + The problem is that Udev will create a device node only if Hotplug or a + user-written script inserts the corresponding module into the kernel, and not + all modules are detectable by Hotplug. Note that statements like the one below + in the /etc/modprobe.conf file do not work with + Udev: -alias char-major-XXX some-module +alias char-major-XXX some-module -Because of the complications with Hotplug, Udev, and modules, we -strongly recommend starting with a completely non-modular kernel -configuration, especially if this is the first time using Udev. + Because of the complications with Hotplug, Udev, and modules, we + strongly recommend starting with a completely non-modular kernel + configuration, especially if this is the first time using Udev. -Install the modules, if the kernel configuration uses them: + Install the modules, if the kernel configuration uses them: make modules_install -After kernel compilation is complete, additional steps are -required to complete the installation. Some files need to be copied to -the /boot directory. + After kernel compilation is complete, additional steps are + required to complete the installation. Some files need to be copied to + the /boot directory. -The path to the kernel image may vary depending on the platform -being used. The following command assumes an x86 architecture: + The path to the kernel image may vary depending on the platform + being used. The following command assumes an x86 architecture: cp -v arch/i386/boot/bzImage /boot/lfskernel-&linux-version; -System.map is a symbol file for the kernel. -It maps the function entry points of every function in the kernel API, -as well as the addresses of the kernel data structures for the running -kernel. Issue the following command to install the map file: + System.map is a symbol file for the kernel. + It maps the function entry points of every function in the kernel API, + as well as the addresses of the kernel data structures for the running + kernel. Issue the following command to install the map file: cp -v System.map /boot/System.map-&linux-version; -The kernel configuration file .config -produced by the make menuconfig step -above contains all the configuration selections for the kernel -that was just compiled. It is a good idea to keep this file for future -reference: + The kernel configuration file .config + produced by the make menuconfig step + above contains all the configuration selections for the kernel + that was just compiled. It is a good idea to keep this file for future + reference: cp -v .config /boot/config-&linux-version; -It is important to note that the files in the kernel source -directory are not owned by root. Whenever a -package is unpacked as user root (like we did -inside chroot), the files have the user and group IDs of whatever -they were on the packager's computer. This is usually not a problem -for any other package to be installed because the source tree is -removed after the installation. However, the Linux source tree is -often retained for a long time. Because of this, there is a chance -that whatever user ID the packager used will be assigned to somebody -on the machine. That person would then have write access to the kernel -source. + It is important to note that the files in the kernel source + directory are not owned by root. Whenever a + package is unpacked as user root (like we did + inside chroot), the files have the user and group IDs of whatever + they were on the packager's computer. This is usually not a problem + for any other package to be installed because the source tree is + removed after the installation. However, the Linux source tree is + often retained for a long time. Because of this, there is a chance + that whatever user ID the packager used will be assigned to somebody + on the machine. That person would then have write access to the kernel + source. -If the kernel source tree is going to be retained, run -chown -R 0:0 on the linux-&linux-version; directory to ensure -all files are owned by user root. + If the kernel source tree is going to be retained, run + chown -R 0:0 on the linux-&linux-version; directory to ensure + all files are owned by user root. -Some kernel documentation recommends creating a symlink from -/usr/src/linux pointing to the kernel -source directory. This is specific to kernels prior to the 2.6 series and -must not be created on an LFS system as it can cause -problems for packages you may wish to build once your base LFS system is -complete. + + Some kernel documentation recommends creating a symlink from + /usr/src/linux pointing to the kernel + source directory. This is specific to kernels prior to the 2.6 series and + must not be created on an LFS system as it can cause + problems for packages you may wish to build once your base LFS system is + complete. -Also, the headers in the system's -include directory should -always be the ones against which Glibc was compiled, -that is, the ones from the Linux-Libc-Headers package, and therefore, should -never be replaced by the kernel headers. + Also, the headers in the system's + include directory should + always be the ones against which Glibc was compiled, + that is, the ones from the Linux-Libc-Headers package, and therefore, should + never be replaced by the kernel headers. + - + -Contents of Linux + + Contents of Linux - -Installed files -config-&linux-version;, lfskernel-&linux-version;, -and System.map-&linux-version; - + + Installed files -Short Descriptions - - + + config-&linux-version;, lfskernel-&linux-version;, and + System.map-&linux-version; + + - -config-&linux-version; - -Contains all the configuration selections for the kernel -/boot/config-&linux-version; - - + + Short Descriptions + + - -lfskernel-&linux-version; - -The engine of the Linux system. When turning on the computer, -the kernel is the first part of the operating system that gets loaded. -It detects and initializes all components of the computer's hardware, -then makes these components available as a tree of files to the -software and turns a single CPU into a multitasking machine capable -of running scores of programs seemingly at the same time -lfskernel-&linux-version; - - + + config-&linux-version; + + Contains all the configuration selections for the kernel + + /boot/config-&linux-version; + + + - -System.map-&linux-version; - -A list of addresses and symbols; it maps the entry points and -addresses of all the functions and data structures in the -kernel -/boot/System.map-&linux-version; - - - + + lfskernel-&linux-version; + + The engine of the Linux system. When turning on the computer, + the kernel is the first part of the operating system that gets loaded. + It detects and initializes all components of the computer's hardware, + then makes these components available as a tree of files to the + software and turns a single CPU into a multitasking machine capable + of running scores of programs seemingly at the same time + + lfskernel-&linux-version; + + + - + + System.map-&linux-version; + + A list of addresses and symbols; it maps the entry points and + addresses of all the functions and data structures in the + kernel + + /boot/System.map-&linux-version; + + + + + + +