diff --git a/Documentation/barebox.svg b/Documentation/barebox.svg new file mode 100644 index 0000000..4d104fa --- /dev/null +++ b/Documentation/barebox.svg @@ -0,0 +1,102 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/lib/Kconfig b/lib/Kconfig index 62695f1..fb4f6e9 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -57,6 +57,8 @@ source lib/gui/Kconfig +source lib/logo/Kconfig + source lib/bootstrap/Kconfig config PRINTF_UUID diff --git a/lib/Makefile b/lib/Makefile index 6a3e9fd..6f64ef9 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -54,3 +54,4 @@ obj-y += bitmap.o obj-y += gcd.o obj-y += hexdump.o +obj-$(CONFIG_BAREBOX_LOGO) += logo/ diff --git a/lib/logo/.gitignore b/lib/logo/.gitignore new file mode 100644 index 0000000..0d5475c --- /dev/null +++ b/lib/logo/.gitignore @@ -0,0 +1,10 @@ +barebox-logo-w64.bblogo +barebox-logo-w64.bblogo.S +barebox-logo-w240.bblogo +barebox-logo-w240.bblogo.S +barebox-logo-w320.bblogo +barebox-logo-w320.bblogo.S +barebox-logo-w400.bblogo +barebox-logo-w400.bblogo.S +barebox-logo-w640.bblogo +barebox-logo-w640.bblogo.S diff --git a/lib/logo/Kconfig b/lib/logo/Kconfig new file mode 100644 index 0000000..5b40d75 --- /dev/null +++ b/lib/logo/Kconfig @@ -0,0 +1,21 @@ +menuconfig BAREBOX_LOGO + bool "include barebox logos in build" + help + Say yes here to build the barebox logos. This adds inkscape to the build + dependencies. The logo can be found under /logo/barebox-logo-.png + in the running barebox. + +config BAREBOX_LOGO_64 + bool "include 64x32 pixel logo" + +config BAREBOX_LOGO_240 + bool "include 240x120 pixel logo" + +config BAREBOX_LOGO_320 + bool "include 320x160 pixel logo" + +config BAREBOX_LOGO_400 + bool "include 400x200 pixel logo" + +config BAREBOX_LOGO_640 + bool "include 640x320 pixel logo" diff --git a/lib/logo/Makefile b/lib/logo/Makefile new file mode 100644 index 0000000..f5f229f --- /dev/null +++ b/lib/logo/Makefile @@ -0,0 +1,51 @@ + +OPTS_barebox-logo-w64.bblogo="-w 64" +bblogo-$(CONFIG_BAREBOX_LOGO_64) += barebox-logo-w64 + +OPTS_barebox-logo-w240.bblogo="-w 240" +bblogo-$(CONFIG_BAREBOX_LOGO_240) += barebox-logo-w240 + +OPTS_barebox-logo-w320.bblogo="-w 320" +bblogo-$(CONFIG_BAREBOX_LOGO_320) += barebox-logo-w320 + +OPTS_barebox-logo-w400.bblogo="-w 400" +bblogo-$(CONFIG_BAREBOX_LOGO_400) += barebox-logo-w400 + +OPTS_barebox-logo-w640.bblogo="-w 640" +bblogo-$(CONFIG_BAREBOX_LOGO_640) += barebox-logo-w640 + +obj-y += $(patsubst %,%.bblogo.o,$(bblogo-y)) +extra-y += $(patsubst %,%.bblogo,$(bblogo-y)) +extra-y += $(patsubst %,%.bblogo.S,$(bblogo-y)) +extra-y += $(patsubst %,%.bblogo.o,$(bblogo-y)) + +obj-$(CONFIG_BAREBOX_LOGO) += logo.o + +quiet_cmd_logo_S = LOGO.S $@ +cmd_logo_S = \ +( \ + echo '\#include '; \ + echo '.section .bblogo.rodata.$(subst -,_,$(*F)),"a"'; \ + echo '.balign STRUCT_ALIGNMENT'; \ + echo '.global __bblogo_$(subst -,_,$(*F))_start'; \ + echo '__bblogo_$(subst -,_,$(*F))_start:'; \ + echo '.incbin "$<" '; \ + echo '__bblogo_$(subst -,_,$(*F))_end:'; \ + echo '.global __bblogo_$(subst -,_,$(*F))_end'; \ + echo '.balign STRUCT_ALIGNMENT'; \ +) > $@ + +%.bblogo.S: %.bblogo FORCE + $(call if_changed,logo_S) + +quiet_cmd_logo = LOGO.S $@ +cmd_logo = \ +( \ + echo OPTS: $(OPTS_$(@F)); \ + inkscape -z $(OPTS_$(@F)) -e $@ $< > /dev/null; \ +) + +%.bblogo: $(srctree)/Documentation/barebox.svg FORCE + $(call if_changed,logo) + +clean-files += *.bblogo *.bblogo.S diff --git a/lib/logo/logo.c b/lib/logo/logo.c new file mode 100644 index 0000000..614d8c0 --- /dev/null +++ b/lib/logo/logo.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015 Sascha Hauer , Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include + +#define DEFINE_LOGO(width) \ + extern char __bblogo_barebox_logo_w##width##_start[]; \ + extern char __bblogo_barebox_logo_w##width##_end[]; \ + \ + static void load_logo_##width(void) \ + { \ + if (!IS_ENABLED(CONFIG_BAREBOX_LOGO_##width)) \ + return; \ + load_logo(width, __bblogo_barebox_logo_w##width##_start, \ + __bblogo_barebox_logo_w##width##_end); \ + } + +static void load_logo(int width, void *start, void *end) +{ + char *filename; + size_t size = end - start; + + filename = asprintf("/logo/barebox-logo-%d.png", width); + write_file(filename, start, size); + free(filename); +} + +DEFINE_LOGO(64); +DEFINE_LOGO(240); +DEFINE_LOGO(320); +DEFINE_LOGO(400); +DEFINE_LOGO(640); + +static int logo_init(void) +{ + int ret; + + ret = make_directory("/logo"); + if (ret) + return ret; + + load_logo_64(); + load_logo_240(); + load_logo_320(); + load_logo_400(); + load_logo_640(); + + return 0; +} +postenvironment_initcall(logo_init);