/********************************************************************* * Author:samson * date:04/27/2015 * Test PL Atform: * GCC (Ubuntu 4.8.2-19ubuntu1) 4.8.2 * GNU bash, 4.3.11 (1)-release (X86_64-PC-LINUX-GNU) * *******************************************************************/
For LFS, the version selected is LFS 7.7, the documentation and the list of source packages that should be downloaded can be downloaded to the following address:
http://www.linuxfromscratch.org/lfs/downloads/stable/, where the contents of the Wget-list file are the address of the downloaded package, Lfs-book-7.7.pdf is a step-by LFS operation and precautions.
[email protected]:/home/ufo# lsblk
name MAJ:MIN RM SIZE RO TYPE mountpoint
sda 8:0 0 45g 0 disk
├─sda1 8:1 0 43.1g 0 part/
├─sda2 8:2 0 1k 0 part
└─sda5 8:5 0 1.9g 0 Part [swap]
sdb 8:16 0 20g 0 disk
├─sdb1 8:17 0 15.5g 0 part/mnt/lfs
└─sdb2 8:18 0 4.5g 0 Part
sr0 11:0 1 222M 0 rom& nbsp /MEDIA/CDROM0
//View the host's fstab configuration to see that the host is using the SDA hard drive, which is the first hard drive
[Email protected]:/home/ufo# cat/etc/fstab
#/etc/fstab:static File System information.
#
# use ' Blkid ' to print the universally unique identifier for a
# device; This is used with uuid= as a more robust-to name devices
# that works even if disks is added and removed. See Fstab (5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
#/was on/dev/sda1 during installation
UUID=A22E5A2C-9642-40EC-8FF8-15563B649944/EXT4 Errors=remount-ro 0 1
# Swap was on/dev/sda5 during installation
uuid=8ea7c2a2-3d4b-4bc8-ab49-0724190fba8d None swap SW 0 0
/dev/sr0/media/cdrom0 udf,iso9660 User,noauto 0 0
/dev/fd0/media/floppy0 Auto Rw,user,noauto 0 0
//Use Blkid to view the UUID of each partition to correspond to the UUID in the above fstab to find the corresponding disk partition.
[Email protected]:/home/ufo# blkid
/dev/sda5:uuid= "8ea7c2a2-3d4b-4bc8-ab49-0724190fba8d" type= "swap"
/dev/sda1:uuid= "a22e5a2c-9642-40ec-8ff8-15563b649944" type= "Ext4"
/dev/sdb1:uuid= "81F51AC1-1E1C-4238-82FA-8EF65D6F7FA2" type= "Ext4"
/dev/sdb2:uuid= "1c603624-94f8-4dfd-bfe9-31a4f5857b94" type= "swap"
/dev/sr0:label= "Debian 7.8.0 amd64 1" type= "iso9660 "
Among them, from the above command can be seen, SDA is mainly used for the host, we will be in the SDB (that is, the second hard drive) to build the LFS environment. Select Sdb1 as the LFS root partition, SDB2 is the swap space of the LFS, through the above Blkid know (when executing this command, the hard disk space has been analyzed, and has been formatted).
The following commands are performed on a host:
//Use the kernel 4 files from the host Debian in the LFS environment to boot
cp/boot/config-3.2.0-4-amd64/boot/initrd.img-3.2.0-4-amd64/boot/vmlinuz-3.2.0-4-amd64/boot/ system.map-3.2.0-4-amd64/mnt/lfs/boot/
//update-grub is a stub for running Grub-mkconfig-o/boot/grub/grub.cfg to generate a grub2 config file.
//In the host environment, execute the following command to update the grub item based on the host system, i.e. add the custom LFS to the Grub menu.
UPDATE-GRUB2
//Modify the Fstab of the LFS environment ( recommended to modify in chroot environment )
Vim/etc/fstab
# Begin/etc/fstab
# File system mount-point type options Dump fsck
# Order
/DEV/SDA1/EXT4 Defaults 1 1
/dev/sda2 swap swap Pri=1 0 0
PROC/PROC proc Nosuid,noexec,nodev 0 0
Sysfs/sys Sysfs Nosuid,noexec,nodev 0 0
Devpts/dev/pts devpts gid=5,mode=620 0 0
Tmpfs/run TMPFS Defaults 0 0
Devtmpfs/dev Devtmpfs mode=0755,nosuid 0 0
# End/etc/fstab
Then reboot to go to the Grub selection menu and select LFS related to start the LFS system.
163
LFS Kernel Panic solution replacement kernel and configuration fstab, etc.