Setup
Partitions:
# fdisk -l /dev/sda
...
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 51199 49152 24M c W95 FAT32 (LBA)
/dev/sda2 51200 204799 153600 75M 83 Linux
Syslinux configuration:
UI menu.c32
LABEL linux
LINUX ../bzImage
APPEND nomodeset rootfstype=ext4 root=/dev/sda2
/init
:
#!/bin/sh
mount -t proc proc proc
mount -t sysfs sysfs sys
mount -t devtmpfs udev dev
/bin/sh
poweroff -f
Testing
Booting via QEMU works:
# qemu-system-x86_64 /dev/sda
However, booting on my laptop gives:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
If I use an initrd:
...
APPEND nomodeset rootfstype=tmpfs initrd=../initrd.img
...then my laptop boots fine, despite the initrd not having any kernel modules
virtio-
orvhost-
device in QEMU configuration, the hardware certainly won't have that. Your kernel needs to include the driver(s) to handle the actual storage controller that is in your laptop hardware. In QEMU terms, it might benvme
orahci
if your laptop is reasonably modern; if your laptop is old enough to not have AHCI, then it gets more complex. You could include one driver for QEMU use and another for HW: if you tried that, you chose the wrong one for HW. – telcoM Oct 18 '23 at 17:18defconfig
. I'm fairly surenvme
andahci
are the correct drivers, but I'll checklspci
, etc. just in case. – GooseDeveloper Oct 18 '23 at 17:59arch/x86/configs/x86_64_defconfig
(wheremake defconfig
gets its defaults from, assuming x86_64) does specifyCONFIG_SATA_AHCI
,CONFIG_ATA_PIIX
and evenCONFIG_PATA_AMD
andCONFIG_PATA_OLDPIIX
, but (surprisingly) neitherCONFIG_NVME_CORE
norCONFIG_BLK_DEV_NVME
. – telcoM Oct 18 '23 at 18:42