요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Use cases
initrd_table_override.rst:31-49BIOS 수정 전 workaround, vendor 호환 환경과 ACPI debugging에 사용합니다.
Override procedure
initrd_table_override.rst:50-100Table 추출·수정·compile·cpio packaging·boot verification의 전체 절차입니다.
Userspace tools
initrd_table_override.rst:101-115ACPICA와 pmtools의 iasl, acpixtract, acpidump 출처를 안내합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
================================
Upgrading ACPI tables via initrd
================================
What is this about
==================
If the ACPI_TABLE_UPGRADE compile option is true, it is possible to
upgrade the ACPI execution environment that is defined by the ACPI tables
via upgrading the ACPI tables provided by the BIOS with an instrumented,
modified, more recent version one, or installing brand new ACPI tables.
When building initrd with kernel in a single image, option
ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this
feature to work.
For a full list of ACPI tables that can be upgraded/installed, take a look
at the char `*table_sigs[MAX_ACPI_SIGNATURE];` definition in
drivers/acpi/tables.c.
All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
be overridable, except:
- ACPI_SIG_RSDP (has a signature of 6 bytes)
- ACPI_SIG_FACS (does not have an ordinary ACPI table header)
Both could get implemented as well.
What is this for
================
Complain to your platform/BIOS vendor if you find a bug which is so severe
that a workaround is not accepted in the Linux kernel. And this facility
allows you to upgrade the buggy tables before your platform/BIOS vendor
releases an upgraded BIOS binary.
This facility can be used by platform/BIOS vendors to provide a Linux
compatible environment without modifying the underlying platform firmware.
This facility also provides a powerful feature to easily debug and test
ACPI BIOS table compatibility with the Linux kernel by modifying old
platform provided ACPI tables or inserting new ACPI tables.
It can and should be enabled in any kernel because there is no functional
change with not instrumented initrds.
How does it work
================
::
# Extract the machine's ACPI tables:
cd /tmp
acpidump >acpidump
acpixtract -a acpidump
# Disassemble, modify and recompile them:
iasl -d *.dat
# For example add this statement into a _PRT (PCI Routing Table) function
# of the DSDT:
Store("HELLO WORLD", debug)
# And increase the OEM Revision. For example, before modification:
DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
# After modification:
DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
iasl -sa dsdt.dsl
# Add the raw ACPI tables to an uncompressed cpio archive.
# They must be put into a /kernel/firmware/acpi directory inside the cpio
# archive. Note that if the table put here matches a platform table
# (similar Table Signature, and similar OEMID, and similar OEM Table ID)
# with a more recent OEM Revision, the platform table will be upgraded by
# this table. If the table put here doesn't match a platform table
# (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
# ID), this table will be appended.
mkdir -p kernel/firmware/acpi
cp dsdt.aml kernel/firmware/acpi
# A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
# (see osl.c):
iasl -sa facp.dsl
iasl -sa ssdt1.dsl
cp facp.aml kernel/firmware/acpi
cp ssdt1.aml kernel/firmware/acpi
# The uncompressed cpio archive must be the first. Other, typically
# compressed cpio archives, must be concatenated on top of the uncompressed
# one. Following command creates the uncompressed cpio archive and
# concatenates the original initrd on top:
find kernel | cpio -H newc --create > /boot/instrumented_initrd
cat /boot/initrd >>/boot/instrumented_initrd
# reboot with increased acpi debug level, e.g. boot params:
acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
# and check your syslog:
[ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
iasl is able to disassemble and recompile quite a lot different,
also static ACPI tables.
Where to retrieve userspace tools
=================================
iasl and acpixtract are part of Intel's ACPICA project:
https://acpica.org/
and should be packaged by distributions (for example in the acpica package
on SUSE).
acpidump can be found in Len Browns pmtools:
ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
This tool is also part of the acpica package on SUSE.
Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
/sys/firmware/acpi/tables
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
initrd를 통한 ACPI table upgrade
1-30이 GPL-2.0 문서는 initrd를 사용해 ACPI table을 upgrade하는 방법을 설명합니다. `ACPI_TABLE_UPGRADE` compile option이 true이면 BIOS가 제공한 ACPI table을 instrumentation한 수정본 또는 더 최신 version으로 교체하거나 완전히 새로운 ACPI table을 설치해 ACPI execution environment를 upgrade할 수 있습니다.
Kernel과 initrd를 단일 image로 build할 때 이 기능을 쓰려면 `ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD`도 true여야 합니다.
Upgrade하거나 설치할 수 있는 ACPI table 전체 목록은 `drivers/acpi/tables.c`의 `char *table_sigs[MAX_ACPI_SIGNATURE];` 정의를 확인합니다. Intel ACPI compiler/disassembler인 `iasl`이 아는 table은 원칙적으로 모두 override할 수 있지만, signature가 6 bytes인 `ACPI_SIG_RSDP`와 일반 ACPI table header가 없는 `ACPI_SIG_FACS`는 예외입니다. 두 예외도 구현은 가능합니다.
기능 활성화 조건과 현재 예외를 구분합니다.
이 기능의 목적
31-49Linux kernel에 workaround가 받아들여지지 않을 만큼 심각한 bug를 발견하면 platform/BIOS vendor에 문제를 제기해야 합니다. 이 기능을 사용하면 vendor가 upgrade된 BIOS binary를 내놓기 전에 결함 있는 table을 먼저 교체할 수 있습니다.
Platform/BIOS vendor는 기반 platform firmware를 수정하지 않고도 Linux-compatible environment를 제공하는 데 이 기능을 사용할 수 있습니다.
기존 platform ACPI table을 수정하거나 새 table을 삽입해 ACPI BIOS table과 Linux kernel의 compatibility를 쉽게 debug하고 test하는 강력한 수단이기도 합니다.
Instrumentation하지 않은 initrd에서는 기능 변화가 없으므로 어느 kernel에서나 활성화할 수 있고 활성화하는 것이 좋습니다.
ACPI table 추출·수정·적재 절차
50-100Machine의 ACPI table을 `acpidump`와 `acpixtract`로 추출하고 `iasl`로 disassemble합니다. 예제는 DSDT의 `_PRT` function에 debug message를 추가하고 OEM Revision을 `0x00000000`에서 `0x00000001`로 올린 뒤 다시 compile합니다.
생성한 raw table은 uncompressed cpio archive 안의 `/kernel/firmware/acpi` directory에 둡니다. Table Signature, OEMID, OEM Table ID가 platform table과 같고 OEM Revision이 더 최신이면 기존 table을 upgrade합니다. 세 identity 중 하나라도 다르면 새 table로 append합니다.
현재 허용하는 initrd ACPI table 수는 `NR_ACPI_INITRD_TABLES (64)`입니다. Uncompressed cpio archive가 먼저 와야 하며, 기존의 보통 compressed initrd archive를 그 뒤에 이어 붙입니다. Reboot할 때 ACPI debug level과 layer를 높이고 syslog에서 `_PRT`와 `HELLO WORLD` message를 확인합니다.
::
# Extract the machine's ACPI tables:
cd /tmp
acpidump >acpidump
acpixtract -a acpidump
# Disassemble, modify and recompile them:
iasl -d *.dat
# For example add this statement into a _PRT (PCI Routing Table) function
# of the DSDT:
Store("HELLO WORLD", debug)
# And increase the OEM Revision. For example, before modification:
DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
# After modification:
DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
iasl -sa dsdt.dsl
# Add the raw ACPI tables to an uncompressed cpio archive.
# They must be put into a /kernel/firmware/acpi directory inside the cpio
# archive. Note that if the table put here matches a platform table
# (similar Table Signature, and similar OEMID, and similar OEM Table ID)
# with a more recent OEM Revision, the platform table will be upgraded by
# this table. If the table put here doesn't match a platform table
# (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
# ID), this table will be appended.
mkdir -p kernel/firmware/acpi
cp dsdt.aml kernel/firmware/acpi
# A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
# (see osl.c):
iasl -sa facp.dsl
iasl -sa ssdt1.dsl
cp facp.aml kernel/firmware/acpi
cp ssdt1.aml kernel/firmware/acpi
# The uncompressed cpio archive must be the first. Other, typically
# compressed cpio archives, must be concatenated on top of the uncompressed
# one. Following command creates the uncompressed cpio archive and
# concatenates the original initrd on top:
find kernel | cpio -H newc --create > /boot/instrumented_initrd
cat /boot/initrd >>/boot/instrumented_initrd
# reboot with increased acpi debug level, e.g. boot params:
acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
# and check your syslog:
[ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
`iasl`은 다양한 ACPI table을 disassemble하고 recompile할 수 있으며, static ACPI table도 상당수 처리합니다.
Platform table 추출부터 boot-time 교체 확인까지의 전체 순서입니다.
Identity와 OEM Revision에 따라 table을 교체하거나 추가합니다.
Userspace tool 구하기
101-115`iasl`과 `acpixtract`는 Intel ACPICA project(`https://acpica.org/`)의 일부이며 distribution package로 제공되어야 합니다. SUSE에서는 예를 들어 `acpica` package에 들어 있습니다.
`acpidump`는 Len Brown의 pmtools(`ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump`)에서 구할 수 있고 SUSE의 `acpica` package에도 포함됩니다.
또 다른 방법으로 최신 kernel에서는 사용 중인 ACPI table을 `/sys/firmware/acpi/tables`에서 가져올 수 있습니다.
추출과 compile에 필요한 도구의 출처입니다.
Upgrade capability
initrd_table_override.rst:1-30기능 활성화 option, override 가능 범위와 RSDP/FACS 예외를 정리합니다.