On Sat, Nov 23, 2024 at 11:18:53PM -0600, Rob Landley wrote:
...
> I'm attempting to regression test as many targets as I can to get consistent
> basic behavior out of:
> 
>   https://landley.net/bin/mkroot/0.8.11/
> 
> I'm trying to get a new release out with the 6.12 kernel which is why I'm
> revisiting this now.
> 
> I've even got a test script that runs all the targets under qemu (booting
> them in parallel even) and checks that A) they boot and run userspace, B)
> they can talk to an emulated hard disk, C) they can talk to an emulated
> network, D) the clock gets set reasonably, E) it knows how to exit the
> emulator. You'd be surprised how many regressions there are in just that...
> 
> Speaking of which, is there a way to get or1k to exit the emulator? I told
> the kernel to reboot but it says "reboot failed, system halted" and hangs
> instead of exiting qemu. (My testroot runs qemu under "timeout -i 10" to
> kill it after 10 seconds of inactivity, I.E. nothing written to stdout, but
> it still counts as a failure on one of the criteria.)

With the or1k-sim board it is not possible.  Traditionally on or1k we use
special NOP instructions to reboot simulators i.e. 'l.nop 1'.  The QEMU team was
not happy to support this mechanism.

  
https://lore.kernel.org/openrisc/fb69c137317a365dcb549dfef1ecd2fbff48e92c.1492384862.git.sho...@gmail.com/T/#mef76d30d294aed84548b1e0d3e23aae499deaeec

As an alertnative we can use the 'virt' board which supports shutdown and
restart via the generic syscon drivers.

    $ grep -C1 SYSCON arch/openrisc/configs/virt_defconfig
    CONFIG_POWER_RESET=y
    CONFIG_POWER_RESET_SYSCON=y
    CONFIG_POWER_RESET_SYSCON_POWEROFF=y
    CONFIG_SYSCON_REBOOT_MODE=y
    # CONFIG_HWMON is not set

> > > > Note, I did find some issues with the kernel nor properly handling 
> > > > stdout-path.
> > > > It seems that if there are multiple uarts the first one will always be 
> > > > used as
> > > > the default uart.  Only the console= command line argument can be used 
> > > > to
> > > > override that.
> > > 
> > > I've never managed to get console= to go through to linux in
> > > qemu-system-or1k. The above tries but is ignored.
> > 
> > As I mentioned above this is a good clue and explains why the alignment 
> > "fix"
> > fixes your issue.
> 
> Happy to do it properly. Almost all the other targets can do console=, the
> FIXME was there to highlight the fact it didn't work right. (Silently
> working for the WRONG REASON is still bad when regression testing.)
> 
> > > It's also doing a statically linked initramfs because -initrd didn't work 
> > > on
> > > this target. Happy to update if it's been fixed, the other targets are
> > > almost all using -initrd to feed in an external cpio.gz
> > 
> > Using -initrd should work.  But also using the statically linked initramfs
> > should be fine too.  The setup I use for testing uses virt with a virtio 
> > block
> > driver.
> 
> Most of the other targets _don't_ use builtin initramfs, so you can swap
> them out "aftermarket" as it were. When it's separate you can examine and
> edit the contents without rebuilding the kernel...
> 
> > When using qemu with -initrd qemu will back the kernel, initrd and fdt one 
> > after
> > the other into memory as per.
> > 
> > [ kernel ] - Loads from 0x100 (based on elf layout)
> > [ initrd ] - page aligned
> > [  fdt   ] - page aligned devicetree (revert moved to 4 bytes aligned)
> > 
> > The fdt address gets placed into r3 which the kernel uses to find the qemu 
> > FDT.
> > Finding the FDT one of the first steps of the boot processes.
> 
> I updated my mkroot config:
> 
>   https://github.com/landley/toybox/commit/fb3ca98e2faa
> 
> I.E. changed the FIXME to ttyS0, removed BUILTIN=1 so it's no longer
> statically linking the initramfs image, and yanked the builtin DTB, and the
> result works with v9.2.0-rc1.
> 
> Still doesn't know how to exit qemu, though. (Is there a kernel symbol I can
> add to 6.12, or does qemu still not have an exit mechanism for this board
> yet?)
> 
> (FYI: be2csv is a shell function to convert bash's brace expansion syntax to
> a comma separated value list, and then csv2cfg is another shell function
> that turns the CSV into https://lwn.net/Articles/160497/ . The CSV is
> shipped as docs/linux-microconfig in the tarball if you're curious. That's
> how a 400 line bash script can build a Linux system that boots to a shell
> prompt for a dozen architectures. The or1k config is now 2 lines, for
> example. 3 with the "if or1k" check. The variables it assigns to are
> documented around line 190.)

That looks good. I need to work on getting my integration testing better, Ill
look into your tools for that.

-Stafford

Reply via email to