|
| 1 | +# Google Summer of Code 2025 @ FreeBSD |
| 2 | +Mentor: Warner Losh @bsdimp <[email protected]> |
| 3 | +Student: Kayla (Kat) Powell @kpowkitty <[email protected]> |
| 4 | +--------------- |
| 5 | +## ACPI Initialization in Loader with Lua Bindings |
| 6 | +Intel's Advanced Configuration and Power Interface (ACPI) brought power management out of the BIOS |
| 7 | +and into the operating system. We can make it even more powerful by creating an interface |
| 8 | +to script it. Currently, the scripting language of choice in FreeBSD (rather than POSIX `sh`, `bash`, or `awk`) |
| 9 | +is Lua. Therefore, this project aims to initialize a portion of ACPI in the FreeBSD bootloader, with respect |
| 10 | +to its storage, memory, and stdlib constraints, so we can enumerate and evaluate objects on the device trees to |
| 11 | +provide an interface to Lua. |
| 12 | + |
| 13 | +## Milestones |
| 14 | +[x] `OsdMemory.c` for `amd64` (`arm64` postponed) |
| 15 | +[x] `AcpiInitializeSubsystem` |
| 16 | +[x] `AcpiInitializeTables` |
| 17 | +[x] `AcpiEnableSubsystem` in reduced hardware mode, with events enabled |
| 18 | +[x] `AcpiLoadTables` |
| 19 | +[x] `AcpiWalkNamespace` |
| 20 | +[x] `AcpiEvaluateObject` |
| 21 | +[x] ACPICA initialized in loader for `amd64` |
| 22 | +[x] lacpi_object.c (V1) |
| 23 | + -- V1: Users can evaluate objects |
| 24 | +[x] lacpi_data.c (V1) |
| 25 | + -- V1: Users can attach, get, detach data from nodes |
| 26 | +[x] lacpi_walk.c (V1) |
| 27 | + -- V1: Walk and read nodes off the namespace |
| 28 | + -- V2: Namespace format -- TBR |
| 29 | + -- V3: Strategies for walking the namespace -- TBR |
| 30 | +[x] Man page update |
| 31 | + |
| 32 | +**Future goals of this project include arm64 compat and extending the interface.** |
| 33 | + |
| 34 | +### For more information, please consult these resources: |
| 35 | +[ACPI Lua Bindings FreeBSD project wiki page](https://wiki.freebsd.org/SummerOfCode2025Projects/ACPI%20Initialization%20in%20Loader%20With%20Lua%20Bindings) |
| 36 | +[Write-up](https://kmpow.com/content/gsoc-writeup) |
| 37 | + |
| 38 | +--------------- |
| 39 | + |
| 40 | +## Building |
| 41 | +This project requires an amd64 UEFI FreeBSD system. |
| 42 | + |
| 43 | +The current working version of this project is found on branch `acpi_init`. |
| 44 | + |
| 45 | +1. Clone the repo |
| 46 | +``` |
| 47 | +$ git clone [email protected]:kpowkitty/freebsd-src.git |
| 48 | +$ git checkout acpi_init |
| 49 | +``` |
| 50 | + |
| 51 | +2. Build the necessary dependencies and install the loader image |
| 52 | +``` |
| 53 | +$ cd stand/efi |
| 54 | +# make -j $MAX_JOBS && make install |
| 55 | +``` |
| 56 | + |
| 57 | +3. Reboot |
| 58 | +``` |
| 59 | +# shutdown -r now |
| 60 | +``` |
| 61 | + |
| 62 | +## System Recovery |
| 63 | +In general cases, to recover your system, you need to mount your drive |
| 64 | +on a live iso and replace your drive's `loader.efi` with the live iso image's `loader.efi`. |
0 commit comments