[PATCH v2 5/5] logo: Add choice for the QOI image format option

Jules Maselbas jmaselbas at kalray.eu
Mon Jan 17 15:02:35 PST 2022


Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
---
 lib/logo/Kconfig  |  7 +++++++
 lib/logo/Makefile | 14 +++++++++++++-
 lib/logo/logo.c   |  2 ++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/lib/logo/Kconfig b/lib/logo/Kconfig
index 8edfaaeb51..a79806f54c 100644
--- a/lib/logo/Kconfig
+++ b/lib/logo/Kconfig
@@ -23,6 +23,13 @@ config BAREBOX_LOGO_BMP
 	help
 	  Encode logo with the BMP image format
 
+config BAREBOX_LOGO_QOI
+	bool "qoi"
+	select QOI
+	select QOICONV
+	help
+	  Encode logo with the QOI image format
+
 endchoice
 
 config BAREBOX_LOGO_64
diff --git a/lib/logo/Makefile b/lib/logo/Makefile
index 04c4906838..e04deb5536 100644
--- a/lib/logo/Makefile
+++ b/lib/logo/Makefile
@@ -51,6 +51,12 @@ extra-y += $(patsubst %,%.bmp,$(bblogo-y))
 %.bblogo: %.bmp FORCE
 	$(call if_changed,logo)
 endif
+ifdef CONFIG_BAREBOX_LOGO_QOI
+extra-y += $(patsubst %,%.png,$(bblogo-y))
+extra-y += $(patsubst %,%.qoi,$(bblogo-y))
+%.bblogo: %.qoi FORCE
+	$(call if_changed,logo)
+endif
 
 CONVERTOPTS += -background none
 
@@ -66,4 +72,10 @@ quiet_cmd_png = PNG     $@
 %.png: $(srctree)/Documentation/barebox.svg FORCE
 	$(call if_changed,png)
 
-clean-files += *.png *.bmp *.bblogo *.bblogo.S
+quiet_cmd_qoi = QOI     $@
+      cmd_qoi =	$(objtree)/scripts/qoiconv $< $@
+
+%.qoi: %.png FORCE
+	$(call if_changed,qoi)
+
+clean-files += *.png *.qoi *.bmp *.bblogo *.bblogo.S
diff --git a/lib/logo/logo.c b/lib/logo/logo.c
index 200eb992b3..a64f489939 100644
--- a/lib/logo/logo.c
+++ b/lib/logo/logo.c
@@ -38,6 +38,8 @@ static void load_logo(int width, void *start, void *end)
 		ext = "png";
 	else if (IS_ENABLED(CONFIG_BAREBOX_LOGO_BMP))
 		ext = "bmp";
+	else if (IS_ENABLED(CONFIG_BAREBOX_LOGO_QOI))
+		ext = "qoi";
 
 	filename = basprintf("/logo/barebox-logo-%d.%s", width, ext);
 	write_file(filename, start, size);
-- 
2.17.1




More information about the barebox mailing list