Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
misc:acpi_patch [2025/04/25 15:11] – created h3artbl33d | misc:acpi_patch [2025/04/29 00:10] (current) – rqm | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Patch to fix the ACPI weirdness on some models - TODO!! | + | ====== The Dreaded ACPI Timeout Bug ====== |
+ | |||
+ | Some models can experience really, really long boot times with OpenBSD. This bug has been known for a while and seems to have appeared around OpenBSD 7.6. It has [[https:// | ||
+ | |||
+ | ===== The Symptoms ===== | ||
+ | Booting the stock installer or kernel will cause the boot procedure to hang quite early on, usually after identifying the hard disks: | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | As @brynet@bsd.network pointed out, it is caused by "some kind of regression that triggers a weird ACPI firmware bug on this machine." | ||
+ | |||
+ | The machine **will** boot, eventually, if you leave it long enough, usually 2+ hours. However, without applying a simple patch to the kernel, it will do the same thing every single time you boot the machine. | ||
+ | |||
+ | ===== Affected Models ===== | ||
+ | * [[:A1502]] Early 2015 Macbook Pro | ||
+ | * Maybe others? | ||
+ | |||
+ | ==== Patch to fix the ACPI bug ==== | ||
< | < | ||
Line 20: | Line 37: | ||
int | int | ||
</ | </ | ||
+ | |||
+ | ==== How to patch ==== | ||
+ | |||
+ | You have two options: build a custom installer and install your system with a patched kernel, or going the "slow way" and wait out the long boot time on booting the installer; installing the system; waiting out the first boot; then patching the kernel for the machine you are on. | ||
+ | |||
+ | Before you start, give the following manual pages a good read, you will have a much clearer understanding of what's going on: | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * If going the " | ||
+ | |||
+ | === I. The Slow Boot Way === | ||
+ | Waiting out the slow boot times is probably a little bit easier, and it doesn' | ||
+ | |||
+ | So after you have downloaded the latest '' | ||
+ | |||
+ | == 0. Setting some ENV variables == | ||
+ | It makes your life easier if you set the $CVSROOT env variable in your '' | ||
+ | |||
+ | First, pick a server close to you from the list at the bottom of the [[https:// | ||
+ | |||
+ | Then add to your dotfile of choice the below: | ||
+ | < | ||
+ | export CVSROOT=anoncvs@url-to-your-cvs-server-of-cho.ice:/ | ||
+ | </ | ||
+ | And source it: | ||
+ | < | ||
+ | $ . ~/ | ||
+ | </ | ||
+ | |||
+ | == 1. Add your user to the source groups == | ||
+ | You need to be a member of '' | ||
+ | < | ||
+ | # usermod -G wsrc,wobj $YOURUSERNAME | ||
+ | </ | ||
+ | |||
+ | == 2. CVS Checkout the Tree of the Sauce == | ||
+ | It is important that you get the sources for the branch you follow. Check the instructions under **" | ||
+ | |||
+ | If you are on '' | ||
+ | |||
+ | First checkout takes a while, but once done, you should have the source tree in ''/ | ||
+ | |||
+ | == 3. Patch / Edit the appropriate files == | ||
+ | Paste the contents of the Patch above into a new file (let's call it < | ||
+ | < | ||
+ | $ patch < mac_acpi_patch.diff | ||
+ | </ | ||
+ | |||
+ | You can of course simply comment out the two (!) affected lines manually; [[https:// | ||
+ | |||
+ | == 4. Compiling == | ||
+ | Follow the '' | ||
+ | As root, first, change directories to the appropriate directory in ''/ | ||
+ | < | ||
+ | $ doas -s | ||
+ | # cd / | ||
+ | </ | ||
+ | |||
+ | Then proceed as the manual suggests, with root privileges - otherwise "make install" | ||
+ | < | ||
+ | # make obj | ||
+ | # make config | ||
+ | # make && make install | ||
+ | </ | ||
+ | |||
+ | After you reboot, the new kernel should be the one in use. It will be easy to tell whether the patch worked, because if your system boots " | ||
+ | |||
+ | |||
+ | |||
+ | ---- | ||
+ | FIXME FIXME FIXME | ||
+ | PLEASE DISREGARD BELOW FOR THE TIME BEING, IT IS A WIP AND KNOWN TO BE INCORRECT. | ||
+ | FIXME FIXME FIXME | ||
+ | ---- | ||
+ | |||
+ | === II. The Custom Installer Way === | ||
+ | |||
+ | Creating a custom installer requires you to have another amd64 machine running OpenBSD. You will be able to build the kernel at the version your OpenBSD machine is already on. You need to make sure you are fetching the appropriate version of the sources, like above. | ||
+ | |||
+ | The procedure, in short, involves building the custom GENERIC.MP image as well as a custom RAMDISK, but WITHOUT running '' | ||
+ | |||
+ | == 0. Preliminaries == | ||
+ | |||
+ | You will also need a copy of '' | ||
+ | |||
+ | If you are on '' | ||
+ | < | ||
+ | $ sysctl kern.version | ||
+ | kern.version=OpenBSD 7.7-current (GENERIC.MP) #0: Wed Apr 23 20:21:10 BST 2025 | ||
+ | [..snip..] | ||
+ | </ | ||
+ | |||
+ | Note the date; in the above example, it's **"Apr 23 2025" | ||
+ | |||
+ | A good place to get previous snapshots is on '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | ==== Upgrading your system after patching ==== | ||
+ | Should a new release come out, unless there' | ||
+ | |||
+ | On your working, normally booting system, you need to patch in place like with "The Slow Boot Way" above. | ||
+ | |||
+ | First, you need to **follow the " | ||
+ | |||
+ | When updating it will skip " | ||
+ | < | ||
+ | # cd / | ||
+ | # cvs update -C acpi.c | ||
+ | </ | ||
+ | |||
+ | This will then move your own version of '' | ||
+ | < | ||
+ | # diff acpi.c .# | ||
+ | </ | ||
+ | |||
+ | If the only two lines that differ are the ones you commented out with the above patch, just '' | ||
+ | |||
+ | === Download the upgrade === | ||
+ | Fetch the release you are upgrading to, but without rebooting and installing automatically. | ||
+ | |||
+ | On '' | ||
+ | < | ||
+ | # sysupgrade -ns | ||
+ | </ | ||
+ | |||
+ | On '' | ||
+ | < | ||
+ | # sysupgrade -n | ||
+ | </ | ||
+ | |||
+ | Sysupgrade will download the new files for the download, you will find then under ''/ | ||
+ | |||
+ | === Make and install the Ramdisk === | ||
+ | To build '' | ||
+ | < | ||
+ | $ doas -s | ||
+ | # cd / | ||
+ | # make obj | ||
+ | # make config | ||
+ | # make | ||
+ | [...eventually...] | ||
+ | ctfstrip -S -o bsd bsd.gdb | ||
+ | # install -bp / | ||
+ | </ | ||
+ | |||
+ | This will give you a " | ||
+ | |||
+ | === Make and install the patched kernel again === | ||
+ | |||
+ | Before rebooting, you need to re-compile '' | ||
+ | |||
+ | < | ||
+ | $ doas -s | ||
+ | # cd / | ||
+ | # make obj | ||
+ | # make config | ||
+ | # make | ||
+ | [...eventually...] | ||
+ | ctfstrip -S -o bsd bsd.gdb | ||
+ | # install -bp / | ||
+ | </ | ||
+ | |||
+ | Reboot... Done! |