From: "requiem." Subject: Re: Compiling bsd.rd / bsd.update with custom kernel patches? To: Stuart Henderson , tech@openbsd.org Date: Sat, 28 Jun 2025 22:23:08 +0100 On Thu, 19 Jun 2025 08:29:49 +0100 Stuart Henderson wrote: > On 2025/06/18 20:06, requiem. wrote: > > I can and successfully have done it before a few times but the > > problem is that whenever I need to upgrade the system on -current > > the bugs return as non-patched "bsd" and "bsd.rd" / "bsd.upgrade" > > files get installed via the normal install process. I would then > > need to wait out the long boot on upgrade and first boot, re-patch > > and install the kernel in place, etc. > > I would handle this by doing the upgrade differently. Basically follow > the steps from https://www.openbsd.org/faq/upgrade77.html#NoInstKern > but after untarring the sets, attempt to compile and install a > GENERIC.MP kernel from updated source (probably simpler on the > machine itself rather than another one). It won't always work (the > newly untarred binaries won't always work on the booted older kernel) > but most of the time it will, and the first stage will leave you with > an updated bsd and bsd.rd that you can boot (obviously with the extra > delay) as a fallback should you need it - though you're not likely to > need it very often. This worked like a treat. Thank you so much. Did the following: 1) fetch update via `sysupgrade -ns` and move the upgrade files to somewhere in /usr 2) update source tree and compile GENERIC.MP 3) follow the FAQ article for manual upgrade you linked above, EXCEPT, instead of moving the latest "official" `bsd` kernel I ended up moving the freshly compiled kernel (/sys/arch/amd64/compile/GENERIC.MP/obj/bsd.gdb) to /bsd 4) For the rest, follow the "manual installation" FAQ article again This really, really speeded things up for me. Thank you so much, greatly appreciated. > > > I have been trying to speed up this process by compiling the kernel > > on another machine running the same version. However I have not > > been too successful so I am asking for some guidance: > > > > Here's what I would hope to achieve: > > - on the affected mac, run `sysupgrade -ns && pkg_update -u -Dsnap` > > and not reboot > > - compile the patched bsd.rd and bsd.mp on another machine > > - swap out the mac's /bsd.upgrade with the patched bsd.rd as well > > as /home/_sysupgrade/bsd.rd and /home/_sysupgrade/bsd.mp > > - hopefully then reboot the macbook and boot normally without > > getting stuck for hours due to the acpi firmware bug it has > > > > Here's what I tried: > > - on the mac: `sysupgrade -ns` > > - on the other machine: > > ``` > > # patch < mypatch.diff > > # cd /sys/arch/amd64/compile/RAMDISK > > # make obj > > # make config > > # make > > # cp obj/bsd.gdb ~/bsd.rd.tocopy > > # cd /sys/arch/amd64/compile/GENERIC.MP > > # make obj > > # make config > > # make > > # cp obj/bsd.gdb ~/bsd.mp.tocopy > > ``` > > - copy over the new `bsd.{rd,mp}.tocopy` to the Macbook over the lan > > > > - on the mac again: > > ``` > > # cp ~/bsd.rd.tocopy /bsd.upgrade > > # cp ~/bsd.rd.tocopy /home/_sysupgrade/bsd.rd > > # cp ~/bsd.mp.tocopy /home/_sysupgrade/bsd.mp > > # reboot > > ``` > > > > Here's what happens: > > > > ``` > > upgrade detected: switching to /bsd.upgrade > > boot> > > booting sr0a:/bsd.upgrade [...] > > fchmod a-x sr0a/bsd.upgrade: failed > > entry point at 0x1001000 > > > > [machine reboots] > > ``` > > > > What am I doing wrong? How can I compile the ramdisk kernel only? > > That's done as part of "make release", see release(8). It needs a > built base system as well though. Manual upgrade is probably a lot > simpler for this situation though.