summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-03-15 12:49:12 -0400
committerTom Rini <trini@konsulko.com>2016-03-22 12:16:13 -0400
commit8a7367accaaf88f90773a37fc9257d184bf448d2 (patch)
tree7db05bb79d66c25f37bbec4a124f34ac591b5393 /tools
parentcd0fa5bff8052b19bde6967c2734f323c9848568 (diff)
downloadu-boot-8a7367accaaf88f90773a37fc9257d184bf448d2.tar.gz
cmd: Fix license command
The license command isn't usually built and has a few problems: - The rules to generate license.h haven't worked in a long time, re-write these based on the bmp_logo.h rules. - 'tok' is unused and the license text size has increased - bin2header.c wasn't grabbing unistd.h to know the prototype for read(). Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile11
-rw-r--r--tools/bin2header.c1
2 files changed, 10 insertions, 2 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 1e4b4aaa02..da50e1bffc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -31,7 +31,6 @@ CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
-# TODO: CONFIG_CMD_LICENSE does not work
hostprogs-$(CONFIG_CMD_LICENSE) += bin2header
hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
@@ -212,6 +211,10 @@ endif
endif # !LOGO_BMP
+# Generated gziped GPL-2.0 license text
+LICENSE_H = $(objtree)/include/license.h
+LICENSE-$(CONFIG_CMD_LICENSE) += $(LICENSE_H)
+
#
# Use native tools and options
# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
@@ -226,7 +229,7 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
-D__KERNEL_STRICT_NAMES \
-D_GNU_SOURCE
-__build: $(LOGO-y)
+__build: $(LOGO-y) $(LICENSE-y)
$(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
@@ -234,6 +237,10 @@ $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
+$(LICENSE_H): $(obj)/bin2header $(srctree)/Licenses/gpl-2.0.txt
+ cat $(srctree)/Licenses/gpl-2.0.txt | gzip -9 -c | \
+ $(obj)/bin2header license_gzip > $(LICENSE_H)
+
# Let clean descend into subdirs
subdir- += env
diff --git a/tools/bin2header.c b/tools/bin2header.c
index 27a5b6aab6..6c2c23f624 100644
--- a/tools/bin2header.c
+++ b/tools/bin2header.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
int main(int argc, char **argv)
{