NetBSD-Bugs archive

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

port-sparc64/56829: miniroot.fs no longer boots



>Number:         56829
>Category:       port-sparc64
>Synopsis:       miniroot.fs no longer boots
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 13 15:10:00 +0000 2022
>Originator:     Harold Gutch
>Release:        HEAD
>Organization:
>Environment:
QEMU 7.0.0 running on Fedora 33; issue also occurs on hardware (U60)
>Description:
Booting miniroot.fs both on hardware (by Björn Johannesson who originally pointed this out via IRC) and in QEMU results in:

NetBSD IEEE 1275 Multi-FS Bootblock
Version $NetBSD: bootblk.fth,v 1.16 2021/07/24 21:31:36 andvar Exp $
NetBSD/sparc64 OpenFirmware Boot, Revision 1.20 (Mon May  2 10:50:02 UTC 2022)
OF_map_phys(0xfe64000,40960,0xfef64000,-1) failed
alloc: out of memory
EXIT


This has been the case since the switch to gcc10 (Apr 17 2021).
>How-To-Repeat:
curl -s https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/sparc64/installation/miniroot/miniroot.fs.gz | gzip -cd > miniroot.fs
qemu-system-sparc64 -nographic -m 128 -hda miniroot.fs -serial stdio -monitor none
>Fix:
It is sufficient to:
- EITHER build Locore.c with gcc9
  OR build Locore.c with gcc10 and -ON (with N < 2)
- link ofwboot (even with a post gcc10-switch toolchain)
- build miniroot.fs
to successfully boot.

Ultimately this is probably a compiler bug (introduced between gcc 9 and 10).  The following patch makes it also work, but so will also various other changes like initializing args.status with -1 and also printf() statements at various places.  In a similar spirit, removing lines 690/691 does NOT help (note that none of the other OF_* calls even checks status).

Until the actual bug is found and fixed, compiling Locore.c with -O1 (or -O0) is probably the best strategy.

diff -u src/src/sys/arch/sparc/stand/ofwboot/Locore.c Locore.c 
--- src/src/sys/arch/sparc/stand/ofwboot/Locore.c.old       2022-05-08 20:05:41.809070077 +0200
+++ src/src/sys/arch/sparc/stand/ofwboot/Locore.c    2022-05-13 13:16:07.292747887 +0200
@@ -684,6 +684,7 @@
        args.vaddr = ADR2CELL(vaddr);
        args.paddr_hi = HDQ2CELL_HI(paddr);
        args.paddr_lo = HDQ2CELL_LO(paddr);
+       args.status = 0;
 
        if (openfirmware(&args) == -1)
                return -1;



Home | Main Index | Thread Index | Old Index