the workaround for booting freebsd on broken kexec-lite firmware on openpower POWER8/POWER9

Adrian Chadd <[email protected]> Thu, 21 May 2026 11:28:28 -0700
Newsgroups gmane.os.freebsd.devel.ppc
Message-ID <CAJ-Vmo=fX20msrmWXE4N1VV5ivsRxfpN6OT=+9o7BNb6cZfaHw@mail.gmail.com>
hi!

i did some digging and brainstorming on irc with folks to figure out
if we could "hack" our way into booting freebsd on the broken
kexec-lite firmware on those ibm openpower boxes.

(I got lucky, the P8's i have don't have the latest firmware, so they
just booted!)

Anyway, after much chatting, we figured we could just try subtracting
the program load vaddr from the entry address and see if it worked,
and it did.

So I give you:

https://github.com/erikarn/elf_freebsd_ppc64_kboot_hack

This takes a normal kernel, rewrites its entry address, and writes it
back out for you.

I've verified this boots and runs fine on the OSU POWER9 hardware
(thanks Lance and OSU power lab!) and is likely much less troublesome
to maintain versus having to manually copy kexec-lite over each time.

It's a bit of a trip to get a working kernel ONTO the boot environment
for that first boot - and when I reboot this, i'll write some
instructions up, but the 30 second version is this.

* You can edit the boot menu entry and change the kernel path
* So change it to boot the kernel from /tmp/kernel
* copy your ppc64le kernel to a machine with the tool, run the tool,
copy it to /tmp on your petitboot instance
* and then boot that

Then after the installation is complete but before rebooting:

* copy main.c over to your machine
* compile it
* run it on a rw copy of the kernel
* put that in /boot/kernel/kernel

Then you can reboot into a working system.

You'll need to remember to do this each time you upgrade the kernel
version but at least
it's a path forward. I'll think about what we could do for a longer
term solution (eg whether we want to populate a kboot menu with two
kernels, one that's been patched and one that hasn't) but that's a
later problem for me.

Anyway, i hope this is helpful for people trying to figure out how to
get freebsd running on the newer openpower firmware that has that
regression.



-adrian