Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| misc:acpi_patch [2025/04/25 13:11] – created h3artbl33d | misc:acpi_patch [2025/10/29 22:26] (current) – h3artbl33d | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Patch to fix the ACPI weirdness on some models - TODO!! | + | ====== The Dreaded |
| + | 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 | ||
| + | * [[:A1466]] Macbook Air ([[https:// | ||
| + | * [[:A1465]] Early 2015 Macbook Air ([[https:// | ||
| + | |||
| + | ==== Lazy way to fix the ACPI bug ==== | ||
| + | |||
| + | We've prepared a custom image that contains the ACPI patch. If you trust us enough (hint: you shouldn' | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ==== Patch to fix the ACPI bug ==== | ||
| + | |||
| + | **Download links:** | ||
| + | * For OpenBSD 7.7 {{ : | ||
| + | * For OpenBSD 7.8 {{ : | ||
| + | |||
| + | ==== 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: | ||
| < | < | ||
| - | Index: sys/ | + | export CVSROOT=anoncvs@url-to-your-cvs-server-of-cho.ice:/cvs |
| - | =================================================================== | + | </code> |
| - | RCS file: / | + | And source it: |
| - | diff -u -p -u -r1.444 acpi.c | + | <code> |
| - | --- sys/ | + | $ . ~/.my-favourite-dotfile |
| - | +++ sys/dev/ | + | |
| - | @@ -823,8 +823,8 @@ acpi_pci_set_powerstate(pci_chipset_tag_ | + | |
| - | } | + | |
| - | # | + | |
| - | + | ||
| - | - if (state == ACPI_STATE_D0 && pre) | + | |
| - | - aml_evalname(sc, | + | |
| - | +// if (state == ACPI_STATE_D0 && pre) | + | |
| - | +// | + | |
| - | } | + | |
| - | + | ||
| - | int | + | |
| </ | </ | ||
| + | |||
| + | == 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 " | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ===== Updating the patched system ===== | ||
| + | If you want to avoid having to wait 2+ hours again TWICE everytime you have to update your system, there is, fortunately, | ||
| + | |||
| + | The below will be a walkthrough that follows '' | ||
| + | |||
| + | ==== 0. Preparation ==== | ||
| + | === 0.a. READ UP. Seriously. === | ||
| + | Read through the [[https:// | ||
| + | |||
| + | === 0.b. Preparation === | ||
| + | Follow the " | ||
| + | |||
| + | ==== 1. Get the upgrade files ==== | ||
| + | Fetch the updates and move them to a new location. When you run '' | ||
| + | < | ||
| + | # sysupgrade -ns | ||
| + | # mkdir /usr/update | ||
| + | # mv / | ||
| + | # rm / | ||
| + | </ | ||
| + | **NB**: On '' | ||
| + | |||
| + | ==== 2. Update the source tree ==== | ||
| + | Follow the **Anonymous CVS** guides for updating the source tree to the latest version. | ||
| + | ☛ **ASIDE** - What to do if acpi.c changes drastically and the patch doesn' | ||
| + | < | ||
| + | $ cd / | ||
| + | $ cvs update -C acpi.c | ||
| + | </ | ||
| + | CVS will tell you where it stashed the previous file, it usually starts with " | ||
| + | |||
| + | To update the source tree on '' | ||
| + | < | ||
| + | $ cd /usr/src | ||
| + | $ cvs -q up -Pd -A | ||
| + | </ | ||
| + | **NB**: On '' | ||
| + | |||
| + | ==== 3. Re-compile the GENERIC.MP Kernel ==== | ||
| + | See above, but run ''# | ||
| + | < | ||
| + | # cd / | ||
| + | # make clean | ||
| + | # make obj | ||
| + | # make config | ||
| + | # make | ||
| + | </ | ||
| + | Your newly compiled kernel file, '' | ||
| + | |||
| + | Now we have: | ||
| + | * The latest update files stored away safely | ||
| + | * The latest kernel, compiled with our own patch | ||
| + | |||
| + | So it is time to move on to the installation. | ||
| + | |||
| + | ==== 4. Manual installation ==== | ||
| + | This follows closely the official [[https:// | ||
| + | |||
| + | === 4.a. Make sure you have done all the preparation in the official guide === | ||
| + | Did you? | ||
| + | |||
| + | === 4.b Install the newly compiled kernel === | ||
| + | We did not run '' | ||
| + | < | ||
| + | # cd /usr/update | ||
| + | # ln -f /bsd /obsd | ||
| + | # cp / | ||
| + | # cp bsd.rd / | ||
| + | # cp bsd /bsd.sp # You might not even have this file, relatively safe to skip this last one if you do not intend to run in single-processor mode | ||
| + | </ | ||
| + | |||
| + | === 4.c follow the rest of the Manual Install Process === | ||
| + | Follow closely the linked manual installation guide, and continue the process: Enable KARL; Install new userland. Reboot. Run MAKEDEV, | ||
| + | |||
| + | DONE! | ||
| + | |||