Vmware虚拟机编译lfs内核启动出错的解决

Vmware虚拟机编译lfs内核启动出错的解决

在Vmware虚拟机里面编译lfs 7.10的内核后,启动出现如下错误:
kernel panic -not syncing:VFS:Unable to mount root fs on unknown block(0,0)

可能的原因有两个:

1- scsi驱动没有编译到内核,检查如下的选项是否选择

→ Device Drivers→ SCSI device support
<*> SCSI disk support
<*> SCSI generic support

→ Device Drivers→ SCSI device support→ SCSI low-level drivers
-*- LSI MPT Fusion SAS 3.0 & SAS 2.0 Device Driver
(128) LSI MPT Fusion SAS 2.0 Max number of SG Entries (16 - 256)
(128) LSI MPT Fusion SAS 3.0 Max number of SG Entries (16 - 256)
<*> Legacy MPT2SAS config option

→ Device Drivers
[*] Fusion MPT device support —>

→ Device Drivers→ Fusion MPT device support
— Fusion MPT device support
<*> Fusion MPT ScsiHost drivers for SPI
<*> Fusion MPT ScsiHost drivers for SAS
(128) Maximum number of scatter gather entries (16 - 128)
<*> Fusion MPT misc device (ioctl) driver
[*] Fusion MPT logging facility

2- grub.cfg的启动配置有误

我的lfs的文件系统如下所示:

root:/sources/linux-4.7.2# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc3 28579128 4177724 22926620 16% /
/dev/sdc1 280003 16852 248695 7% /boot
devtmpfs 2005424 0 2005424 0% /dev
tmpfs 2015392 0 2015392 0% /run

我的lfs是在centos7的第三个磁盘/dev/sdc上安装,并且把grub安装到/dev/sdc的mbr上。
当在BIOS里面把第三个磁盘启动顺序调到第一个的时候,grub.cfg如下配置,可以启动成功。

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,1)
menuentry “GNU/Linux, Linux 4.7.2-lfs-7.10” {
linux /vmlinuz-4.7.2-lfs-7.10 root=/dev/sdc3 ro
}

注意:

set root=(hd0,1) 此hd的顺序和BIOS里面设置的硬盘启动顺序一致。

root=/dev/sdc3 此sd的顺序和内核探测到的硬盘顺序一致。

你可能感兴趣的:(lfs,Linux,Kernel)