diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-06 12:33:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-06 12:33:13 +0200 |
commit | b32e327d3e8be662c8d69db8c64e750a9118345a (patch) | |
tree | 88a46702863570ce4a4491aa7e28e950205cd44e /lib | |
parent | a8525f691dd74f9aa50ecd359408486217e956ba (diff) | |
parent | 4f8a7e916aefc83dd690bc39d1d82063ceabf314 (diff) | |
download | barebox-b32e327d3e8be662c8d69db8c64e750a9118345a.tar.gz barebox-b32e327d3e8be662c8d69db8c64e750a9118345a.tar.xz |
Merge branch 'for-next/logo'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 2 | ||||
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/logo/.gitignore | 10 | ||||
-rw-r--r-- | lib/logo/Kconfig | 21 | ||||
-rw-r--r-- | lib/logo/Makefile | 51 | ||||
-rw-r--r-- | lib/logo/logo.c | 66 |
6 files changed, 151 insertions, 0 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 6b3c98d6da..fbf9f0f348 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -59,6 +59,8 @@ source lib/gui/Kconfig source lib/fonts/Kconfig +source lib/logo/Kconfig + source lib/bootstrap/Kconfig config PRINTF_UUID diff --git a/lib/Makefile b/lib/Makefile index 395214c2bd..abb34cfbdb 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -55,3 +55,4 @@ obj-y += bitmap.o obj-y += gcd.o obj-y += hexdump.o obj-$(CONFIG_FONTS) += fonts/ +obj-$(CONFIG_BAREBOX_LOGO) += logo/ diff --git a/lib/logo/.gitignore b/lib/logo/.gitignore new file mode 100644 index 0000000000..0d5475cb78 --- /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 0000000000..5b40d758e2 --- /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-<width>.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 0000000000..f5f229f8fd --- /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 <asm-generic/barebox.lds.h>'; \ + 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 0000000000..614d8c0908 --- /dev/null +++ b/lib/logo/logo.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015 Sascha Hauer <s.hauer@pengutronix.de>, 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 <common.h> +#include <init.h> +#include <fs.h> +#include <libfile.h> +#include <malloc.h> + +#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); |