LFS kernel panic solution: replacing kernel and configuring fstab, lfsfstab
/********************************************************************* * Author : Samson * Date : 04/27/2015 * Test platform: * gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 * GNU bash, 4.3.11(1)-release (x86_64-pc-linux-gnu) * *******************************************************************/
LFS 7.7 is the version used for LFS practice. You can download the relevant documentation and the list of source code packages to be downloaded from the following URL:
Http://www.linuxfromscratch.org/lfs/downloads/stable/, the content of the wget-listfile is the address of the downloaded package, lfs-book-7.7.pdf is the step-by-step operation and precautions of LFS operation.
The disk layout is as follows:
Root @ ufo:/home/ufo # lsblk
Name maj: MIN RM SIZE RO TYPE MOUNTPOINT
Sda 8:0 0 45G 0 disk
─ ── Sda1 80 43.1G 0 part/
├ ── Sda2 8:2 0 1 K 0 part
└ ── Sda5 0 1.9G 0 part [SWAP]
Sdb 8: 16 0 20G 0 disk
─ ── Sdb1 0 15.5G 0 part/mnt/lfs
└ ── Sdb2 0 4.5G 0 part
Sr0 :0 1 222 M 0 rom/media/cdrom0
// View the fstab configuration of the host to see that the host uses the sda hard disk, that is, the first hard disk.
Root @ ufo:/home/ufo # cat/etc/fstab
#/Etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for
# Device; this may be used with UUID = as a more robust way to name devices
# That works even if disks are 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-0724108fba8d none swap sw 0 0
/Dev/sr0/media/cdrom0 udf, iso9660 user, noauto 0 0 0
/Dev/fd0/media/floppy0 auto rw, user, noauto 0 0
// Use blkid to view the UUID of each partition and match the UUID in fstab to find the corresponding disk partition.
Root @ ufo:/home/ufo # blkid
/Dev/sda5: UUID = "8ea7c2a2-3d4b-4bc8-ab49-07241_fba8d" 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"
From the above command, we can see that sda is mainly used for host machines. We will build the LFS environment in sdb (the second hard disk. Select sdb1 as the LFS root partition, and sdb2 as the swap space of LFS. We can see through the blkid above (the hard disk space has been analyzed and formatted when executing this command ).
Run the following commands on the host machine:
// Use the kernel 4 files in the host machine Debian to build the file to the lfs environment 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. cfg to generate a grub2 config file.
// Execute the following command in the host environment to update the grub item of the host system, that is, add the customized LFS to the grub menu.
Update-grub2
// Modify the fstab of the LFS environment (it is recommended to modify it in the 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 pri = 1 0 0
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 restart the instance to go To the grub selection menu and select related LFS items to start the LFS system.
163