Skip to contentSkip to conversation

efi: loader: protocol: gop: guard behind CONFIG_EFI_LOADER_GOP

PATCH Applied Ahmad Fatoum 2 participants 3 messages Jan 20 – Jan 23

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 efi: loader: protocol: gop: guard behind CONFIG_EFI_LOADER_GOP

The gop protocol implementation uses fb_open, which is only available with CONFIG_IMAGE_RENDERER=y.

Add a dedicated symbol for it and have it select CONFIG_IMAGE_RENDERER=y to fix link errors for configurations with CONFIG_VIDEO=y, but no CONFIG_IMAGE_RENDERER.

Fixes d040f49ad0b3 ("efi: loader: protocol: add graphical output protocol support")
---
 efi/loader/protocols/Kconfig  | 18 ++++++++++++++++++
 efi/loader/protocols/Makefile |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
efi/loader/protocols/Kconfig +18 -0
index ba6f562b7585..ad7896065ab7 100644
@@ -2,6 +2,24 @@
 
 menu "UEFI protocol support"
 
+config EFI_LOADER_GOP
+	bool "Graphics output protocol"
+	depends on VIDEO
+	select IMAGE_RENDERER
+	default y
+	help
+    	  The graphics output protocol (GOP) provides UEFI applications access
+    	  to a framebuffer for graphical output. This allows booting of UEFI
+    	  applications and operating systems that require graphics support.
+
+    	  The protocol exposes the video mode information and framebuffer
+    	  details to UEFI payloads, enabling them to render graphics, display
+    	  boot menus, and provide visual feedback during boot.
+
+    	  If you have video support enabled and want to boot UEFI applications
+    	  that require graphics (such as GRUB with graphical menus or Linux
+    	  with EFIFB), say Y here.
+
 config EFI_LOADER_HII
 	bool "HII protocols"
 	default y
efi/loader/protocols/Makefile +1 -1
index a323927b89e3..d0b55bde4644 100644
@@ -2,7 +2,7 @@
 
 obj-$(CONFIG_FS) += file.o
 obj-$(CONFIG_DISK) += disk.o
-obj-$(CONFIG_VIDEO) += gop.o
+obj-$(CONFIG_EFI_LOADER_GOP) += gop.o
 obj-$(CONFIG_CONSOLE_FULL) += console.o
 obj-$(CONFIG_EFI_LOADER_HII) += hii.o hii_config.o
 obj-$(CONFIG_EFI_LOADER_UNICODE_COLLATION_PROTOCOL2) += unicode_collation.o
Signature · 1 line
2.47.3
#1 lore raw

PATCH 2/2 efi: loader: remove dependency on LIBFDT

LIBFDT is often available, because CONFIG_BOARD_GENERIC_DT pulls it in, but in the normal case, we unflatten DT and have no need for libfdt at all.

Remove the libfdt dependency from the EFI loader code by opencoding the magic check.

Fixes 229bc3b37e64 ("efi: loader: implement bootm handler")
---
 efi/loader/bootm.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
efi/loader/bootm.c +8 -3
index dffe53bcf9c8..da664847def8 100644
@@ -124,15 +124,20 @@ static efi_status_t copy_fdt(void **fdtp)
  */
 static efi_status_t efi_install_fdt(void *fdt)
 {
+	const struct fdt_header *hdr = fdt;
 	/*
 	 * The EBBR spec requires that we have either an FDT or an ACPI table
 	 * but not both.
 	 */
 	efi_status_t ret;
 
-	/* Install device tree */
-	if (fdt_check_header(fdt)) {
-		pr_err("invalid device tree\n");
+	if (hdr->magic != cpu_to_fdt32(FDT_MAGIC)) {
+		pr_err("bad magic: 0x%08x\n", fdt32_to_cpu(hdr->magic));
+		return EFI_LOAD_ERROR;
+	}
+
+	if (hdr->version != cpu_to_fdt32(17)) {
+		pr_err("bad dt version: 0x%08x\n", fdt32_to_cpu(hdr->version));
 		return EFI_LOAD_ERROR;
 	}
 
Signature · 1 line
2.47.3
Applied
#2 lore raw
In reply to Ahmad Fatoum
Quoted 8 lines · Ahmad Fatoum

The gop protocol implementation uses fb_open, which is only available with CONFIG_IMAGE_RENDERER=y.

Add a dedicated symbol for it and have it select CONFIG_IMAGE_RENDERER=y to fix link errors for configurations with CONFIG_VIDEO=y, but no CONFIG_IMAGE_RENDERER.

[...]

Applied, thanks!

[1/2] efi: loader: protocol: gop: guard behind CONFIG_EFI_LOADER_GOP
https://git.pengutronix.de/cgit/barebox/commit/?id=b67d157088f9 (link may not be stable)
[2/2] efi: loader: remove dependency on LIBFDT

      https://git.pengutronix.de/cgit/barebox/commit/?id=f1402601008e (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>