[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Booting Debian Raspberry Pi image under QEMU?



On Fri, Nov 14, 2025 at 10:04:48AM -0500, Robert Heller wrote:
> At Fri, 14 Nov 2025 14:33:04 +0100 <tomas@tuxteam.de> wrote:
> 
> >
> > Hi,
> >
> > I'm trying to boot a Debian raspberry Pi image under qemu; specifically,
> > it is

[...]

> Two things that are partitular to Raspberry Pi's:
> 
> The Raspberry Pi "images" are for a two partituon uSD.  The first partition is
> a *FAT* file system, and contains the kernel and init ramdisk, along with the
> the boot overlays. etc.  The Raspberry Pi boot ROM/bootloader is a unique
> beast.  I am not sure if qemu really implements the Raspberry Pi boot ROM.

Thanks for mentioning it: yes, I looked into that, via loopback and mounting.
I have some experience building some, for a Raspi 2B. There, it was the
graphics coprocessor what initiated the boot sequence, AFAIR, so you needed
some blob for that one.

> I guess what you are trying to do is get around the Raspberry Pi boot
> ROM/bootloader by passing the kernel directly yo qemu.  If you are doing that,
> then the vmlinuz and initrd.img files must be on the host file system.  Eg
> *qemu* is NOT going to look for them in 20231109_raspi_4_bookworm.img.
> 
> You need to mount the image (eg losetup -P / mount), and then *copy* the
> vmlinuz and initrd.img files out.

Yes, Didier already hinted at that: -kernel and -initrd most probably point
at files living "outside" the image, i.e. in the host file system, thus
bypassing the whole pre-boot magic. This will be the next thing I try.

Whether QEMU's "-machine raspi4b" supports the whole boot sequence (i.e.
"all inside the image") is another interesting avenue, but in this case,
-kernel and -initrd would be (most probably, see above) wrong (it would
be the bootloader's job to find that stuff inside of the image).

Perhaps something to take to the QEMU mailing list.

> Secondly, I am not sure if the root FS you are specifying above
> (/dev/mmcblk1p2) is going to work, unless you specify the proper 'if" for
> the -drive option.  Eg:
> 
>     -drive if=sd,format=raw,20231109_raspi_4_bookworm.img

*AH* good point, thanks :-)

Luckily tomorrow is sunday...

Cheers and thanks!
-- 
tomás

Attachment: signature.asc
Description: PGP signature


Reply to: