From: "requiem." Subject: Fw: Compiling bsd.rd / bsd.update with custom kernel patches? To: tech@openbsd.org Date: Wed, 18 Jun 2025 20:06:58 +0100 Dear Tech@, I have written an e-mail earlier about this to misc@ but it was suggested this is a better place for this query. I have an older Macbook that needs some kernel patching in order to avoid long boot times. (Details here: https://openbsdonapple.wiki/doku.php?id=misc:acpi_patch) 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 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? Thanks, rqm