linuxboot / book

LinuxBoot book which contains the documentation in markdown format
https://book.linuxboot.org/
Creative Commons Attribution Share Alike 4.0 International
273 stars 46 forks source link

QEMU localboot cannot see block devices #38

Open aroobam opened 4 years ago

aroobam commented 4 years ago

Hi team, I got the complete build instructions working and able to run in qemu. I get as far as the "Systemboot" text art and then a boot loop starts. First fbnetboot is tried ( I don't have network configured ) and then sit0 and then localboot, which I am trying to get to work, by attaching an .iso as a cdrom device to the qemu command line.

madhan@madhan-HP-Notebook:~/coreboot$ sudo qemu-system-x86_64 -M q35 -enable-kvm -bios build/coreboot.rom -m 1024 -object rng-random,filename=/dev/urandom,id=rng0 -vga cirrus --serial /dev/tty -cdrom ./ubuntu-18.04.3-live-server-amd64.iso

However it seems like no block devices are seen. I tried attaching a scsi device, a block device and an usb device (all qcow2 image files that I could get to work in "HEADS" earlier) but same result. Also the uroot shell does not have lspci, lsmod, insmod etc. and so I am not able to look at the devices enumerated. But firstly, how do I know the tinylinux payload that we built got control or not? Should we dig into this on the uroot side or the tinylinux side? Any pointers please?

2019/12/02 16:02:19 Running boot command: [localboot -grub -d]
2019/12/02 16:02:19 Getting list of supported filesystems
2019/12/02 16:02:19 Supported file systems: [ext3 ext2 ext4 iso9660 udf]
2019/12/02 16:02:19 trying to mount all the available block devices with all the supported file system types
2019/12/02 16:02:19 mounted: []
2019/12/02 16:02:19 No boot configuration found
2019/12/02 16:02:19 Error executing &{/bbin/localboot [localboot -grub -d] []  <nil> 0xc00000e020 0xc00000e028 [] <nil> 0xc0000db2f0 exit status 1 <nil> <nil> true [0xc00000e148 0xc00000e020 0xc00000e028] [0xc00000e148] [] [] 0xc0000708a0 <nil>}: exit status 1

Thanks, Madhan

JulienVdG commented 4 years ago

Hello, I've not tried to run your case however when I did first try an iso with the -cdrom option of qemu I found that my kernel configuration missed CONFIG_BLK_DEV_SR=y.

https://github.com/JulienVdG/test-linuxboot-buildroot/commit/30a207f58be6b0eb6e03c97cb010394fc17ed3a4

Another point is that localboot does only parse grub config not syslinux (isolinux) so if your CD does not have a grub config, localboot will not find it (but I guess it should at list display the block devices it found)

Hope this helps, Julien VdG

rjoleary commented 4 years ago

This is a bit of a shot in the dark, but for a raw block device, I've had success with this in the past:

Arguments to qemu (where FILENAME is a file on the host):

-drive file=rw:FILENAME,if=none,id=disk -device ich9-ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0

Config options for the kernel:

CONFIG_BLOCK=y
CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_BLK_DEV_SD=y

In the kernel, the block device should be /dev/sda
aroobam commented 4 years ago

Got the CD-ROM boot to work. Tried some qcow2 images with SCSI boot. Did not work, though the device is identified. Will did in a little more and update. Guess it is an image format / grub compatibility thing. Thanks guys!