From 81fd230419b0cfd052b08fc1ed352bb7d49975df Mon Sep 17 00:00:00 2001 From: Gerard Beekmans Date: Sat, 19 Feb 2005 22:16:42 +0000 Subject: Trunk is now identical to Testing git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4648 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter08/fstab.xml | 42 ++++++++++ chapter08/grub.xml | 86 ++++++++++++++++---- chapter08/introduction.xml | 6 +- chapter08/kernel.xml | 197 ++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 295 insertions(+), 36 deletions(-) (limited to 'chapter08') diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index 015e26bc6..969d306fb 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -7,6 +7,13 @@ Creating the /etc/fstab File +/etc/fstab + +The /etc/fstab file is used by some +programs to determine where file systems are to be mounted by default, +which must be checked, and in which order. Create a new file systems +table like this: + cat > /etc/fstab << "EOF" # Begin /etc/fstab @@ -22,4 +29,39 @@ 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. + +When using a journalling file system, the 1 +1 at the end of the line should be replaced with +0 0 because such a partition does not need to +be dumped or checked. + +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: + +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 compiled into +the kernel (not as a module). + + diff --git a/chapter08/grub.xml b/chapter08/grub.xml index 4d50002a0..12487ec71 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -7,35 +7,82 @@ Making the LFS System Bootable - -We highly recommend that you create a Grub boot floppy diskette just in case. -Insert a blank floppy diskette and run the following commands: + +Grub +configuring + +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. + +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 we'll run the +Remove the diskette and store it somewhere safe. Now, run the grub shell: grub -First, tell Grub where to search for its stage{1,2} -files -- you can use the Tab key everywhere to make Grub show the alternatives: +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. + +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) -Tell Grub to install itself into the MBR (Master Boot Record) of +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: setup (hd0) -If all is well, Grub will have reported finding its files in -/boot/grub. That's all there is to it: +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 -Now we need to 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 @@ -55,7 +102,7 @@ root (hd0,3) kernel /boot/lfskernel-&linux-version; root=/dev/hda4 EOF -You may want to add an entry for your host distribution. It might look +Add an entry for the host distribution if desired. It might look like this: cat >> /boot/grub/menu.lst << "EOF" @@ -65,8 +112,8 @@ kernel /boot/kernel-2.4.20 root=/dev/hda3 initrd /boot/initrd-2.4.20 EOF -Also, if you happen to dual-boot Windows, the following entry should -allow booting it: +If dual-booting Windows, the following entry will allow +booting it: cat >> /boot/grub/menu.lst << "EOF" title Windows @@ -74,11 +121,16 @@ rootnoverify (hd0,0) chainloader +1 EOF -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: +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: mkdir /etc/grub && ln -s /boot/grub/menu.lst /etc/grub + diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index d936cf2ed..6fa80cadc 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -7,6 +7,10 @@ Introduction -See testing +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 9fe3bc889..4b775a3d9 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -3,26 +3,37 @@ %general-entities; ]> - + Linux-&linux-version; Linux +<para>The Linux package contains the kernel and the header files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> -<seglistitem><seg>All default options: 4.20 SBU</seg> -<seg>All default options: 181 MB</seg></seglistitem> +<seglistitem><seg>4.20 SBU</seg> +<seg>181 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Linux installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Findutils, +GCC, Glibc, Grep, Gzip, Make, Modutils, Perl, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>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 alternate methods to the way this +book configures the kernel. + Kernel version 2.6.10 has a security vulnerability that will allow user processes to gain root privledges upon loading of a kernel module. See: for more information. The following patch fixes this problem: @@ -33,50 +44,200 @@ processes to gain root privledges upon loading of a kernel module. See: 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. -If, in , you decided you want -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 -Configure the kernel via a menu-driven interface. BLFS has some -information regarding particular kernel configuration requirements of -packages outside of LFS at -. +For example, if using a Dutch keyboard, use +/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz/usr/share/kbd/keymaps/i386/ +qwerty/nl.map.gz. + +Configure the kernel via a menu-driven interface: make menuconfig +Alternatively, make oldconfig may be more appropriate in some +situations. See the README file for more +information. + +When configuring the kernel, be sure to enable the +Support for hot-pluggable devices option under the +General Setup menu. This enables hotplug events that +are used by udev to populate the /dev directory with device +nodes. + +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. + +For POSIX-shared memory support, ensure that the kernel config +option Virtual memory file system support is enabled. +It resides within the File systems menu and is normally +enabled by default. + +LFS bootscripts make the assumption that either both +Support for Host-side USB and USB device +filesystem have been compiled directly into the kernel, or +that neither is compiled at all. Bootscripts will not work properly +if it is a module (usbcore.ko). + +NPTL requires the kernel to be compiled with GCC 3.x, in +this case &gcc-version;. Compiling with 2.95.x is known to cause failures in +the glibc test suite, so it is not recommended to compile the kernel +with gcc 2.95.x. + Compile the kernel image and modules: make -Install the modules, if your kernel configuration uses them: +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. The modprobe.conf man page may also be +of interest. + +Be very careful when reading other documentation 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 + +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: make modules_install -The path to the kernel image may vary depending on the platform you're -using. Issue the following command to install the kernel: +If there are many modules and very little space, consider +stripping and compressing the modules. For most users, such +compression is not worth the time, but if the system is pressed for +space, see . + +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. Issue the following command to install the kernel: cp 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: + cp 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: + cp .config /boot/config-&linux-version; -If you are going to keep the kernel source tree around, you may want to -run chown -R 0:0 on the -linux-&linux-version; directory to ensure all files are -owned by user root. +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. + +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. Contents of Linux -See testing + +Installed files +kernel, kernel headers, +and System.map + + +Short Descriptions + + + +kernel + +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. +kernel + + + + +kernel headers + +Defines the interface to the services that the kernel provides. +The headers in the system's include directory should +always be the ones against which Glibc was +compiled and therefore, should not be replaced +when upgrading the kernel. +kernel headers + + + + +System.map + +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 + + + + -- cgit v1.2.3-54-g00ecf