diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/logo/Kconfig | 20 | ||||
-rw-r--r-- | lib/logo/Makefile | 43 | ||||
-rw-r--r-- | lib/logo/logo.c | 8 |
3 files changed, 56 insertions, 15 deletions
diff --git a/lib/logo/Kconfig b/lib/logo/Kconfig index 56ec76afb6..64ba0e11e6 100644 --- a/lib/logo/Kconfig +++ b/lib/logo/Kconfig @@ -5,10 +5,28 @@ menuconfig BAREBOX_LOGO help Say yes here to build the barebox logos. This adds ImageMagick's convert tool to the build dependencies. The logo can be found under - /logo/barebox-logo-<width>.png in the running barebox. + /logo/barebox-logo-<width>.<ext> in the running barebox. if BAREBOX_LOGO +choice + prompt "Logo image encoding format to be used" + default BAREBOX_LOGO_PNG + +config BAREBOX_LOGO_PNG + bool "png" + select PNG + help + Encode logo with the PNG image format + +config BAREBOX_LOGO_BMP + bool "bmp" + select BMP + help + Encode logo with the BMP image format + +endchoice + config BAREBOX_LOGO_64 bool "include 64x32 pixel logo" diff --git a/lib/logo/Makefile b/lib/logo/Makefile index 3e36cf911f..4829151fd6 100644 --- a/lib/logo/Makefile +++ b/lib/logo/Makefile @@ -1,18 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-only -OPTS_barebox-logo-w64.bblogo = -resize 64 +OPTS_barebox-logo-w64 = -resize 64 bblogo-$(CONFIG_BAREBOX_LOGO_64) += barebox-logo-w64 -OPTS_barebox-logo-w240.bblogo = -resize 240 +OPTS_barebox-logo-w240 = -resize 240 bblogo-$(CONFIG_BAREBOX_LOGO_240) += barebox-logo-w240 -OPTS_barebox-logo-w320.bblogo = -resize 320 +OPTS_barebox-logo-w320 = -resize 320 bblogo-$(CONFIG_BAREBOX_LOGO_320) += barebox-logo-w320 -OPTS_barebox-logo-w400.bblogo = -resize 400 +OPTS_barebox-logo-w400 = -resize 400 bblogo-$(CONFIG_BAREBOX_LOGO_400) += barebox-logo-w400 -OPTS_barebox-logo-w640.bblogo = -resize 640 +OPTS_barebox-logo-w640 = -resize 640 bblogo-$(CONFIG_BAREBOX_LOGO_640) += barebox-logo-w640 obj-y += $(patsubst %,%.bblogo.o,$(bblogo-y)) @@ -39,15 +39,32 @@ cmd_logo_S = \ %.bblogo.S: %.bblogo FORCE $(call if_changed,logo_S) +quiet_cmd_logo = LOGO $@ + cmd_logo = cp $< $@ + +ifdef CONFIG_BAREBOX_LOGO_PNG +extra-y += $(patsubst %,%.png,$(bblogo-y)) +%.bblogo: %.png FORCE + $(call if_changed,logo) +endif +ifdef CONFIG_BAREBOX_LOGO_BMP +extra-y += $(patsubst %,%.bmp,$(bblogo-y)) +%.bblogo: %.bmp FORCE + $(call if_changed,logo) +endif + CONVERTOPTS += -background none -quiet_cmd_logo = PNG $@ -cmd_logo = \ -( \ - convert $(OPTS_$(@F)) $(CONVERTOPTS) $< png:$@; \ -) +quiet_cmd_bmp = BMP $@ + cmd_bmp = convert $(OPTS_$(@F:.bmp=)) $(CONVERTOPTS) $< bmp:$@ -%.bblogo: $(srctree)/Documentation/barebox.svg FORCE - $(call if_changed,logo) +%.bmp: $(srctree)/Documentation/barebox.svg FORCE + $(call if_changed,bmp) + +quiet_cmd_png = PNG $@ + cmd_png = convert $(OPTS_$(@F:.png=)) $(CONVERTOPTS) $< png:$@ + +%.png: $(srctree)/Documentation/barebox.svg FORCE + $(call if_changed,png) -clean-files += *.bblogo *.bblogo.S +clean-files += *.png *.bmp *.bblogo *.bblogo.S diff --git a/lib/logo/logo.c b/lib/logo/logo.c index 8349b060ac..200eb992b3 100644 --- a/lib/logo/logo.c +++ b/lib/logo/logo.c @@ -32,8 +32,14 @@ static void load_logo(int width, void *start, void *end) { char *filename; size_t size = end - start; + char *ext = ""; - filename = basprintf("/logo/barebox-logo-%d.png", width); + if (IS_ENABLED(CONFIG_BAREBOX_LOGO_PNG)) + ext = "png"; + else if (IS_ENABLED(CONFIG_BAREBOX_LOGO_BMP)) + ext = "bmp"; + + filename = basprintf("/logo/barebox-logo-%d.%s", width, ext); write_file(filename, start, size); free(filename); } |