Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI / tables: table override from built-in initrd

In some scenario, we need to build initrd with kernel in a single image.
This can simplify system deployment process by downloading the whole system
once, such as in IC verification.

This patch adds support to override ACPI tables from built-in initrd.

Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
[ rjw: Minor cleanups ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Shunyong Yang and committed by
Rafael J. Wysocki
98a455d9 1c7fc5cb

+27 -2
+4
Documentation/acpi/initrd_table_override.txt
··· 14 14 via upgrading the ACPI tables provided by the BIOS with an instrumented, 15 15 modified, more recent version one, or installing brand new ACPI tables. 16 16 17 + When building initrd with kernel in a single image, option 18 + ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this 19 + feature to work. 20 + 17 21 For a full list of ACPI tables that can be upgraded/installed, take a look 18 22 at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in 19 23 drivers/acpi/tables.c.
+10
drivers/acpi/Kconfig
··· 357 357 initrd, therefore it's safe to say Y. 358 358 See Documentation/acpi/initrd_table_override.txt for details 359 359 360 + config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD 361 + bool "Override ACPI tables from built-in initrd" 362 + depends on ACPI_TABLE_UPGRADE 363 + depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION="" 364 + help 365 + This option provides functionality to override arbitrary ACPI tables 366 + from built-in uncompressed initrd. 367 + 368 + See Documentation/acpi/initrd_table_override.txt for details 369 + 360 370 config ACPI_DEBUG 361 371 bool "Debug Statements" 362 372 help
+10 -2
drivers/acpi/tables.c
··· 473 473 474 474 void __init acpi_table_upgrade(void) 475 475 { 476 - void *data = (void *)initrd_start; 477 - size_t size = initrd_end - initrd_start; 476 + void *data; 477 + size_t size; 478 478 int sig, no, table_nr = 0, total_offset = 0; 479 479 long offset = 0; 480 480 struct acpi_table_header *table; 481 481 char cpio_path[32] = "kernel/firmware/acpi/"; 482 482 struct cpio_data file; 483 + 484 + if (IS_ENABLED(CONFIG_ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD)) { 485 + data = __initramfs_start; 486 + size = __initramfs_size; 487 + } else { 488 + data = (void *)initrd_start; 489 + size = initrd_end - initrd_start; 490 + } 483 491 484 492 if (data == NULL || size == 0) 485 493 return;
+3
include/linux/initrd.h
··· 25 25 extern unsigned long phys_initrd_size; 26 26 27 27 extern unsigned int real_root_dev; 28 + 29 + extern char __initramfs_start[]; 30 + extern unsigned long __initramfs_size;