From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZFHa9-0001ET-QM for barebox@lists.infradead.org; Wed, 15 Jul 2015 07:58:23 +0000 From: Sascha Hauer Date: Wed, 15 Jul 2015 09:57:57 +0200 Message-Id: <1436947077-31143-2-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1436947077-31143-1-git-send-email-s.hauer@pengutronix.de> References: <1436947077-31143-1-git-send-email-s.hauer@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 2/2] Add new barebox logo to the tree To: Barebox List This adds the new barebox logo to the tree. This is added as svg image which is converted to different png images during build time. The logo can be found under /logo/barebox-logo-.png in the running barebox. Signed-off-by: Sascha Hauer --- Documentation/barebox.svg | 102 ++++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig | 2 + lib/Makefile | 1 + lib/logo/Kconfig | 21 ++++++++++ lib/logo/Makefile | 51 +++++++++++++++++++++++ lib/logo/logo.c | 66 ++++++++++++++++++++++++++++++ 6 files changed, 243 insertions(+) create mode 100644 Documentation/barebox.svg create mode 100644 lib/logo/Kconfig create mode 100644 lib/logo/Makefile create mode 100644 lib/logo/logo.c 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 @@ config STMP_DEVICE 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 += libfile.o obj-y += bitmap.o obj-y += gcd.o obj-y += hexdump.o +obj-$(CONFIG_BAREBOX_LOGO) += logo/ 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); -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox