Skip to content

Commit 3d7ee34

Browse files
Ard BiesheuvelIngo Molnar
authored andcommitted
efi/libstub/arm: Add opt-in Kconfig option for the DTB loader
There are various ways a platform can provide a device tree binary to the kernel, with different levels of sophistication: - ideally, the UEFI firmware, which is tightly coupled with the platform, provides a device tree image directly as a UEFI configuration table, and typically permits the contents to be manipulated either via menu options or via UEFI environment variables that specify a replacement image, - GRUB for ARM has a 'devicetree' directive which allows a device tree image to be loaded from any location accessible to GRUB, and supersede the one provided by the firmware, - the EFI stub implements a dtb= command line option that allows a device tree image to be loaded from a file residing in the same file system as the one the kernel image was loaded from. The dtb= command line option was never intended to be more than a development feature, to allow the other options to be implemented in parallel. So let's make it an opt-in feature that is disabled by default, but can be re-enabled at will. Note that we already disable the dtb= command line option when we detect that we are running with UEFI Secure Boot enabled. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Alexander Graf <agraf@suse.de> Acked-by: Leif Lindholm <leif.lindholm@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20180711094040.12506-7-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f5dcc21 commit 3d7ee34

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

drivers/firmware/efi/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ config EFI_RUNTIME_WRAPPERS
8787
config EFI_ARMSTUB
8888
bool
8989

90+
config EFI_ARMSTUB_DTB_LOADER
91+
bool "Enable the DTB loader"
92+
depends on EFI_ARMSTUB
93+
help
94+
Select this config option to add support for the dtb= command
95+
line parameter, allowing a device tree blob to be loaded into
96+
memory from the EFI System Partition by the stub.
97+
98+
The device tree is typically provided by the platform or by
99+
the bootloader, so this option is mostly for development
100+
purposes only.
101+
90102
config EFI_BOOTLOADER_CONTROL
91103
tristate "EFI Bootloader Control"
92104
depends on EFI_VARS

drivers/firmware/efi/libstub/arm-stub.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,10 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
202202
* 'dtb=' unless UEFI Secure Boot is disabled. We assume that secure
203203
* boot is enabled if we can't determine its state.
204204
*/
205-
if (secure_boot != efi_secureboot_mode_disabled &&
206-
strstr(cmdline_ptr, "dtb=")) {
207-
pr_efi(sys_table, "Ignoring DTB from command line.\n");
205+
if (!IS_ENABLED(CONFIG_EFI_ARMSTUB_DTB_LOADER) ||
206+
secure_boot != efi_secureboot_mode_disabled) {
207+
if (strstr(cmdline_ptr, "dtb="))
208+
pr_efi(sys_table, "Ignoring DTB from command line.\n");
208209
} else {
209210
status = handle_cmdline_files(sys_table, image, cmdline_ptr,
210211
"dtb=",

0 commit comments

Comments
 (0)