Skip to content

Instantly share code, notes, and snippets.

@Th3Fanbus
Last active April 26, 2021 09:33
Show Gist options
  • Save Th3Fanbus/407fbe109e5d358e22287cf83cdc27a0 to your computer and use it in GitHub Desktop.
Save Th3Fanbus/407fbe109e5d358e22287cf83cdc27a0 to your computer and use it in GitHub Desktop.
How to apply a DSDT override
# Instructions derived from: https://wiki.archlinux.org/index.php/DSDT
########################################################################
# Recompiling it yourself #
# https://wiki.archlinux.org/index.php/DSDT#Recompiling_it_yourself #
########################################################################
# Extract the binary ACPI tables
sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.dat
# Disassemble the ACPI tables to a .dsl file
iasl -d dsdt.dat
# Attempt to create a hex AML table from the .dsl file
iasl -tc dsdt.dsl
# Manual step: Fix any compilation errors. A common source of errors is
# when iasl has to guess the type of unresolved external dependencies
# and fails to identify an external function that takes some arguments.
# Manual step: Increase the OEM version in the DSDT's DefinitionBlock.
# Otherwise, the kernel will not apply the modified ACPI table. For
# example, before increasing the OEM version:
#
# DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
#
# After increasing the OEM version:
#
# DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
# Create the hex AML table again after fixing all errors and increasing the OEM version
iasl -tc dsdt.dsl
########################################################################
# Using modified code, using a cpio archive #
# https://wiki.archlinux.org/index.php/DSDT#Using_a_CPIO_archive #
########################################################################
# This method requires the ACPI_TABLE_UPGRADE=y kernel config to be enabled!
# First, create the following folder structure
mkdir -p kernel/firmware/acpi
# Copy the patched DSDT into the newly-created kernel/firmware/acpi folder
cp dsdt.aml kernel/firmware/acpi
# Create a CPIO archive containing the patched DSDT
find kernel | cpio -H newc --create > acpi_override
# Copy the archive to the /boot directory
sudo cp acpi_override /boot
# Manual step: Configure the bootloader to load the newly-created CPIO
# archive as an initrd. The exact procedure depends on the bootloader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment