Bug 292341 - 15 / 16 doesn't boot on a G5 apple ppc64, doesn't boot in qemu either!
Summary: 15 / 16 doesn't boot on a G5 apple ppc64, doesn't boot in qemu either!
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: powerpc (show other bugs)
Version: 15.0-RELEASE
Hardware: powerpc Any
: --- Affects Some People
Assignee: Adrian Chadd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-10 17:23 UTC by Adrian Chadd
Modified: 2026-01-30 05:07 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Chadd freebsd_committer freebsd_triage 2026-01-10 17:23:29 UTC
I can't boot 15 or 16 on a G5 apple, but I can boot 12, 13 and 14.
(Well, "boot", but it makes it to the loader and kernel.)

It's easily reproducible with qemu, so you don't need hardware to reproduce/fix this!

my config:

```
#!/bin/sh

# PPC970 (G5) mac emulation testing

# TODO: this thread has some info about their ppc64 SMP tinkering
# https://forums.macrumors.com/threads/smp-for-qemu-syetem-ppc64-wip.2450008/

# It would be nice to see SMP support for 970mp on mac99 and then
# use it for regression testing on FreeBSD!

# Booting cdrom:
#
# boot cd:,\\:tbxi

#       -hda drive-1.raw \
#
#       -drive id=drive1,file=drive-1.raw,if=none -device virtio-blk-pci,drive=drive1 \
#       -cdrom ../iso/FreeBSD-16.0-CURRENT-powerpc-powerpc64-20251222-nullhash-nullcount-disc1.iso \
#       -netdev tap,ifname=tap0,script=no,id=net0 -device virtio-net-pci,netdev=net0,mac=00:08:01:12:00:01

#       -drive file=../iso/FreeBSD-16.0-CURRENT-powerpc-powerpc64-20251222-nullhash-nullcount-disc1.iso,format=raw,media=cdrom,read
only=on,index=2
#       -drive file=../iso/FreeBSD-14.3-RELEASE-powerpc-powerpc64-bootonly.iso,format=raw,media=cdrom,readonly=on,index=2

qemu-system-ppc64 \
        -machine mac99,via=pmu \
        -cpu 970fx \
        -smp 1 \
        -drive file=wd0.img,format=raw,media=disk,snapshot=on \
        -drive file=../iso/FreeBSD-15.0-STABLE-powerpc-powerpc64-20260101-785d429c2b93-281645-bootonly.iso,format=raw,media=cdrom,r
eadonly=on,index=2
```

to reproduce:

* fetch the above iso images so you can test 14, 15, 16
* truncate -s 1G wd0.img
* ./run.sh
* at the openfirmware prompt, do "boot cd:,\\:tbxi"

It works for 14 (and 13, and 12) but not 15 or 16 - it spits out this

"No valid state has been set by load or init-program"
Comment 1 Adrian Chadd freebsd_committer freebsd_triage 2026-01-10 20:52:20 UTC
Note: qemu version

qemu-devel-10.1.20251031       QEMU CPU Emulator - development version
Comment 2 Chattrapat Sangmanee 2026-01-10 22:11:45 UTC
I'm bisecting it, hopefully to get something out of it soon.

Also do you have a G5? and what model it is?

Because in my own 14.3 fork have a fully working SMP (tested on G5 Dual core 970MP). But I need another tester to confirm.

https://github.com/aomsin2526/freebsd-src/commits/releng/14.3-ps3/

Thanks.
Comment 3 Adrian Chadd freebsd_committer freebsd_triage 2026-01-10 23:43:57 UTC
(In reply to Chattrapat Sangmanee from comment #2)

It's the dual ppc970 g5. i got it specifically to fix smp in -head :-)
Comment 4 Adrian Chadd freebsd_committer freebsd_triage 2026-01-11 03:55:21 UTC
Sigh, it's because the awk call in releases/powerpc/mkisoimages.sh is now returning 0.


[adrian@ref14-amd64 ~]$  echo 0x3a00 | awk '{printf("%x\n",$1/512);}'
1d


but

[adrian@ref15-amd64 ~]$ echo 0x3a00 | awk '{printf("%x\n",$1/512);}'
0

awk is no longer taking a hex number as a valid input.
Comment 5 Chattrapat Sangmanee 2026-01-11 04:07:43 UTC
Great to know, That's why I'm wondering why even 14 branch I just built doesn't work as well.

So it is the host machine then since I just upgraded my machine to 15.
Comment 6 Adrian Chadd freebsd_committer freebsd_triage 2026-01-11 04:08:10 UTC
https://reviews.freebsd.org/D54639 should fix it. It at least fixes things on qemu; I'll try booting this image tonight on the G5 to see if I enter the loader and it loads the kernel. (I haven't built a full release image in a long long time, I'll have to go figure that out again.)
Comment 7 Adrian Chadd freebsd_committer freebsd_triage 2026-01-11 04:09:09 UTC
(In reply to Chattrapat Sangmanee from comment #5)

Yeah! I only noticed it when I started trying to build using older build script, older loader, older kernel and it was still failing. So I started looking at the output of each step and .. voila!

Please let me know if that can spit out a working 15 and HEAD release iso that boots. Thanks!
Comment 8 Justin Hibbits freebsd_committer freebsd_triage 2026-01-11 04:56:55 UTC
(In reply to Adrian Chadd from comment #4)

Looks like this bug was brought in via f32a6403 ("Merge one true awk from 2024-01-22 for the Awk Second Edition support").  That removes the `#if 0`-outing of the checking for hex floats.

stable/14 somehow preserves the `#if 0`.
Comment 9 Chattrapat Sangmanee 2026-01-11 05:16:14 UTC
After patch applied my G5 is booting 15.0-RELEASE fine again. to live cd at least.

Also just in case,

You may want to try revert commit 3f24b505677a92cbcfa6ad3222df411917ef3e4e. for me revert this one alone fixed all problem I had with my g5 and ps3. So if you get random panics and don't know why maybe you can try revert it.
Comment 10 Chattrapat Sangmanee 2026-01-11 06:34:10 UTC
Update of above comment:

Revert that one alone isn't enough for it to build, so a6ca7519f89c52e9fab205cded0f2bf32d914cd6 must be reverted first as well.

I also tested on ps3, can also confirm that it boots 15.0 fine as well (good news).

Sorry for all this useless stuff, I just don't know where else to report.
Comment 11 Adrian Chadd freebsd_committer freebsd_triage 2026-01-11 07:01:54 UTC
(In reply to Chattrapat Sangmanee from comment #10)

oh this is great feedback, thanks!

I'll poke you about that specific reversion diff once this is fixed. If that's the MVP required to fix the dual CPU G5 issue then awesome!
Comment 12 commit-hook freebsd_committer freebsd_triage 2026-01-11 07:05:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=7afa03963c448a14b1735a10eaf84941b0b74862

commit 7afa03963c448a14b1735a10eaf84941b0b74862
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-01-11 03:59:41 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-01-11 07:04:57 +0000

    powerpc: fix release image building for Apple partitions

    awk changed somewhere between 14 and 15 and it stopped accepting
    a hexadecimal number as its input - it will always return 0.
    This results in a very badly written apple boot block.

    So just remove it; do the math in shell.

    PR:             kern/292341
    Differential Revision:  https://reviews.freebsd.org/D54639
    Reviewed by:    imp
    MFC after:      1 week

 release/powerpc/mkisoimages.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2026-01-12 21:35:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/doc/commit/?id=5c9832dab53e25f11cbe55161302c4dc5cbee430

commit 5c9832dab53e25f11cbe55161302c4dc5cbee430
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-12 18:47:45 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-01-12 21:34:56 +0000

    15.0/eratta: 15.0 doesn't boot on apple G5

    PR:             292341
    Reported by:    adrian

 website/content/en/releases/15.0R/errata.adoc | 4 ++++
 1 file changed, 4 insertions(+)
Comment 14 commit-hook freebsd_committer freebsd_triage 2026-01-16 06:27:17 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b5b8d69b23a73e932a8d46829b1ec65ba50be36

commit 4b5b8d69b23a73e932a8d46829b1ec65ba50be36
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-01-11 03:59:41 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-01-16 06:26:30 +0000

    powerpc: fix release image building for Apple partitions

    awk changed somewhere between 14 and 15 and it stopped accepting
    a hexadecimal number as its input - it will always return 0.
    This results in a very badly written apple boot block.

    So just remove it; do the math in shell.

    PR:             kern/292341
    Differential Revision:  https://reviews.freebsd.org/D54639
    Reviewed by:    imp
    MFC after:      1 week

    (cherry picked from commit 7afa03963c448a14b1735a10eaf84941b0b74862)

 release/powerpc/mkisoimages.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 15 commit-hook freebsd_committer freebsd_triage 2026-01-30 05:07:18 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8baa4e9647192e476a0a14a796e36aef6ea4607e

commit 8baa4e9647192e476a0a14a796e36aef6ea4607e
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-01-11 03:59:41 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-01-30 05:06:09 +0000

    powerpc: fix release image building for Apple partitions

    awk changed somewhere between 14 and 15 and it stopped accepting
    a hexadecimal number as its input - it will always return 0.
    This results in a very badly written apple boot block.

    So just remove it; do the math in shell.

    PR:             kern/292341
    Differential Revision:  https://reviews.freebsd.org/D54639
    Reviewed by:    imp
    MFC after:      1 week

    (cherry picked from commit 7afa03963c448a14b1735a10eaf84941b0b74862)

 release/powerpc/mkisoimages.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)