1.工具和文档
acpica-tools(iasl, acpidump, acpixtract)
(依赖:gcc flex bison)
kernel/Doc/acpi/initrd_table_override.txt
2.安装编译acpica-tools。
$ tar xzf acpica-unix-VERSION.tar.gz
$ cd acpica-unix-VERSION
$ make iasl
$ make acpixtract
$ make acpidump
3.安装这些命令到bin下
install -m 555 -s generate/unix/acpixtract/obj/acpixtract /usr/bin/acpixtract
install -m 555 -s generate/unix/acpidump/obj/acpidump /usr/bin/acpidump
install -m 555 -s generate/unix/iasl/obj/iasl /usr/bin/iasl
4.dump系统的acpi table信息
[root@localhost tmp]# acpidump > acpidump
[root@localhost tmp]# acpixtract -a acpidump
Intel ACPI Component Architecture
ACPI Binary Table Extraction Utility version 20131218-64 [Jan 7 2014]
Copyright (c) 2000 - 2013 Intel Corporation
Acpi table [RSDP] - 36 bytes written to rsdp.dat
Acpi table [RSDT] - 84 bytes written to rsdt.dat
Acpi table [XSDT] - 132 bytes written to xsdt.dat
Acpi table [DSDT] - 7614 bytes written to dsdt.dat
Acpi table [FACS] - 64 bytes written to facs.dat
Acpi table [FACP] - 244 bytes written to facp.dat
Acpi table [APIC] - 3660 bytes written to apic.dat
Acpi table [SRAT] - 552 bytes written to srat.dat
Acpi table [SLIT] - 108 bytes written to slit.dat
Acpi table [SPCR] - 80 bytes written to spcr.dat
Acpi table [SPMI] - 65 bytes written to spmi.dat
Acpi table [SSDT] - 10818 bytes written to ssdt1.dat
Acpi table [MCFG] - 60 bytes written to mcfg.dat
Acpi table [HPET] - 56 bytes written to hpet.dat
Acpi table [DMAR] - 72 bytes written to dmar.dat
Acpi table [EINJ] - 304 bytes written to einj.dat
Acpi table [SSDT] - 242 bytes written to ssdt2.dat
5.编辑acpi table(SRAT 为例)
反汇编srat.dat为文本格式:
[root@localhost tmp]# iasl -d srat.dat
Intel ACPI Component Architecture
ASL Optimizing Compiler version 20131218-64 [Jan 7 2014]
Copyright (c) 2000 - 2013 Intel Corporation
Loading Acpi table from file srat.dat
Acpi Data Table [SRAT] decoded
Formatted output: srat.dsl - 17730 bytes
会生成对应的srat.dsl文件,这个就可以直接用editor编辑了:
[1B2h 0434 4] Proximity Domain : 00000004
[1B6h 0438 2] Reserved1 : 0000
[1B8h 0440 8] Base Address : 0000000000000000
[1C0h 0448 8] Address Length : 0000000080000000
[1C8h 0456 4] Reserved2 : 00000000
[1CCh 0460 4] Flags (decoded below) : 00000001
Enabled : 1
Hot Pluggable : 1 0 --> 1
Non-Volatile : 0
[1D0h 0464 8] Reserved3 : 0000000000000000
[1D8h 0472 1] Subtable Type : 01 [Memory Affinity]
[1D9h 0473 1] Length : 28
[1DAh 0474 4] Proximity Domain : 00000004
[1DEh 0478 2] Reserved1 : 0000
[1E0h 0480 8] Base Address : 0000000100000000
[1E8h 0488 8] Address Length : 0000000380000000
[1F0h 0496 4] Reserved2 : 00000000
[1F4h 0500 4] Flags (decoded below) : 00000001
Enabled : 1
Hot Pluggable : 1 0 --> 1
Non-Volatile : 0
[1F8h 0504 8] Reserved3 : 0000000000000000
[200h 0512 1] Subtable Type : 01 [Memory Affinity]
[201h 0513 1] Length : 28
这里是把一段内存范围从非hotplug编程可hotplug,就是把对应的标志位改以下。
完了之后就要把.dsl的文本重新编译成汇编文件
6.重新生成srat table的汇编文件
[root@localhost tmp]# iasl -sa srat.dsl
Intel ACPI Component Architecture
ASL Optimizing Compiler version 20131218-64 [Jan 7 2014]
Copyright (c) 2000 - 2013 Intel Corporation
Table Input: srat.dsl - 321 lines, 17930 bytes, 263 fields
Binary Output: srat.aml - 552 bytes
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks
[root@localhost tmp]# ls | grep srat
srat.aml
srat.dat
srat.dsl
7.后面的操作很重要,其实也很简单
将新的新的acpi table的汇编文件*.aml拷贝到kernel/firmware/acpi格式的目录下面,
然后把这些.aml汇编文件打包成一个没有压缩的cpio文件:
[root@localhost tmp]# mkdir -p kernel/firmware/acpi
[root@localhost tmp]# cp srat.aml kernel/firmware/acpi
[root@localhost tmp]# find kernel | cpio -H newc --create > instrumented_initrd
3 blocks
8.追加initrad文件到新的instrumented_initrd后面,这样就是保证acpi table的override在initrd执行前完成
cat /boot/initrd >> instrumented_initrd
cp instrumented_initrd /boot
修改grub的initrd项,让其指定到新的initrd。
Over.
阅读(2776) | 评论(0) | 转发(0) |