[Concept,5/6] acpi: bgrt: Move the BGRT image into the images directory

Message ID 20251001230537.3324058-6-sjg@u-boot.org
State New
Headers
Series video: Tidy up embedded graphical images |

Commit Message

Simon Glass Oct. 1, 2025, 11:05 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Move the BGRT image to use the same video_image linker-list approach
as the other embedded image. Move it into the drivers/video/images
directory and rename it to 'bgrt.bmp' since we know it is an image.

Drop the old bgrt Makefile rule as it is no-longer needed.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/video/images/Makefile                 |   4 ++++
 .../video/images/bgrt.bmp                     | Bin
 lib/acpi/Makefile                             |   2 --
 lib/acpi/acpi_extra.c                         |  22 ++++--------------
 scripts/Makefile.lib                          |  18 --------------
 5 files changed, 8 insertions(+), 38 deletions(-)
 rename lib/acpi/bgrt_image.bmp => drivers/video/images/bgrt.bmp (100%)
  

Patch

diff --git a/drivers/video/images/Makefile b/drivers/video/images/Makefile
index d3aca2ee7f7..9b0d85cd2c8 100644
--- a/drivers/video/images/Makefile
+++ b/drivers/video/images/Makefile
@@ -3,3 +3,7 @@ 
 # Copyright 2025 Simon Glass <sjg@chromium.org>
 
 obj-$(CONFIG_VIDEO_LOGO) += u_boot.o
+
+ifdef CONFIG_$(PHASE_)GENERATE_ACPI_TABLE
+obj-y += bgrt.o
+endif
diff --git a/lib/acpi/bgrt_image.bmp b/drivers/video/images/bgrt.bmp
similarity index 100%
rename from lib/acpi/bgrt_image.bmp
rename to drivers/video/images/bgrt.bmp
diff --git a/lib/acpi/Makefile b/lib/acpi/Makefile
index a4850fcc108..4b9b1ef8029 100644
--- a/lib/acpi/Makefile
+++ b/lib/acpi/Makefile
@@ -12,8 +12,6 @@  obj-$(CONFIG_$(PHASE_)ACPIGEN) += acpi_table.o
 obj-y += acpi_extra.o
 obj-y += acpi_writer.o
 
-obj-y += bgrt_image.o
-
 # With QEMU the ACPI tables come from there, not from U-Boot
 ifndef CONFIG_QFW_ACPI
 obj-y += base.o
diff --git a/lib/acpi/acpi_extra.c b/lib/acpi/acpi_extra.c
index 7620f953add..709f64305b5 100644
--- a/lib/acpi/acpi_extra.c
+++ b/lib/acpi/acpi_extra.c
@@ -13,23 +13,6 @@ 
 #include <video.h>
 #include <acpi/acpi_table.h>
 
-#define BGRT_DECL(_name) \
-	extern u8 __bgrt_ ## _name ## _begin[]; \
-	extern u8 __bgrt_ ## _name ## _end[]
-
-#define BGRT_START(_name)	__bgrt_ ## _name ## _begin
-#define BGRT_END(_name)	__bgrt_ ## _name ## _end
-
-BGRT_DECL(image);
-
-static void *bgrt_get_image(int *sizep)
-{
-	if (sizep)
-		*sizep = BGRT_END(image) - BGRT_START(image);
-
-	return BGRT_START(image);
-}
-
 int acpi_write_bgrt(struct acpi_ctx *ctx)
 {
 	struct udevice *dev;
@@ -42,7 +25,10 @@  int acpi_write_bgrt(struct acpi_ctx *ctx)
 	/* If video is available, use the screen size to centre the logo */
 	have_video = !uclass_first_device_err(UCLASS_VIDEO, &dev);
 
-	logo = bgrt_get_image(&size);
+	if (!IS_ENABLED(CONFIG_VIDEO))
+		return -ENOENT;
+
+	logo = video_image_get(bgrt, &size);
 
 	/* If there's no logo data, there's nothing to report */
 	if (!logo)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e812327b585..6a64760de5e 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -561,24 +561,6 @@  $(obj)/%.S: $(src)/%.bmp
 	$(call cmd,S_image)
 endif
 
-# Generate an assembly file to wrap the EFI 'Boot Graphics Resource Table' image
-quiet_cmd_S_bgrt= BGRT    $@
-# Modified for U-Boot
-cmd_S_bgrt=						\
-(							\
-	echo '.section .rodata.bgrt.init,"a"';		\
-	echo '.balign 16';				\
-	echo '.global __$(*F)_image_begin';		\
-	echo '__$(*F)_image_begin:';			\
-	echo '.incbin "$<" ';				\
-	echo '__$(*F)_image_end:';			\
-	echo '.global __$(*F)_image_end';			\
-	echo '.balign 16';				\
-) > $@
-
-$(obj)/%_image.S: $(src)/%_image.bmp
-	$(call cmd,S_bgrt)
-
 # EFI applications
 # A Makefile target *.efi is built as EFI application.
 # A Makefile target *_efi.S wraps *.efi as built-in EFI application.