To learn about Linux startup process I placed grub in a disk image file and tried to boot using qemu. I currently has not put any kernel image into the drive just grub. I installed grub using
kpartx -av mydrive.img
grub-install --no-floppy /dev/loop0
I wanted to go through the boot sequence step by step, so I expected grub to claim that the kernel is missing, then I want to fix that by installing the kernel, and continue adding stuff all the way up to X.
Now I get
error: no such device
But expected
error: no configuration file
form rescue prompt, ls gives
(hd0) (fd0)
Questions:
- Why is the /boot/grub directory empty [SOLVED, I needed to remap
/bootsogrub-installinstalls grub in the guest system] - What device is grub looking for? Is that something that refers to the host system? [Partially solved, the UUID is the same as the UUID for the virtual file system]
- Why cannot Grub find the device?
- What is the minimal to put in grub.cfg after putting the kernel in place
Chrooting to the guest system will not work, since there is nothing there yet.
Here is the partition table for the virtual drive:
Disk mydrive.img: 264 MB, 264241152 byte
32 huvuden, 63 sektorer/spår, 256 cylindrar, totalt 516096 sektorer
Enheter = sektorer av 1 · 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Diskidentifierare: 0xebe6ebdb
Enhet Start Början Slut Block Id System
mydrive.img1 2048 516095 257024 83 Linux
After remapping the host /boot directory, files are copied to the guest /boot directory. But now I only see (hd0) in QEMU.