On Tue, Sep 13, 2022 at 5:39 PM Clément Chigot <[email protected]> wrote: > > Hi all, > > I'm wondering if there is an official way to load bare metal software > within qemu emulations. > I've seen a lot of people (including us) using -kernel. However, the > doc seems to imply that the generic loader would be a better approach > (cf [1]). I know that the compatibility with older Qemus is one of the > reasons why -kernel is still highly used. I've also seen that the > reset vector can be initialized automatically by -kernel unlike with > the generic loader (this is the case with RiscV AFAICT). > But is there any kind of official recommendation on that topic ? > > I'm asking that because a recent change in RiscV Polarfire Soc is > forcing -dtb to be passed along -kernel. But in case of bare board > software, -dtb isn't needed (at least in our use case). > I've a patch that allows "-dtb" to be missing with "-kernel" only if > "-bios none" is provided. But I'm not sure if this is the right way to > say "it's a bare board software". > > @Bin Meng you're the one that added this -kernel support in PolarFire > Soc. Thus, is my approach looking good for you or do you have a better > one in mind ? >
As Peter said, you probably need to use the generic loader for your use case. The "-kernel" is mainly for the Linux kernel, or a kernel with Linux kernel compatible boot protocol. In this case, Linux kernel won't boot without a proper DTB provided, as QEMU PolarFire machine does not generate a DTB like other RISC-V machines. > [1] https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-8 Regards, Bin
