Commit 8a7367ac authored by Tom Rini's avatar Tom Rini

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: default avatarTom Rini <trini@konsulko.com>
parent cd0fa5bf
...@@ -1405,8 +1405,6 @@ CHANGELOG: ...@@ -1405,8 +1405,6 @@ CHANGELOG:
git log --no-merges U-Boot-1_1_5.. | \ git log --no-merges U-Boot-1_1_5.. | \
unexpand -a | sed -e 's/\s\s*$$//' > $@ unexpand -a | sed -e 's/\s\s*$$//' > $@
include/license.h: tools/bin2header COPYING
cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
######################################################################### #########################################################################
### ###
...@@ -1421,7 +1419,7 @@ CLEAN_DIRS += $(MODVERDIR) \ ...@@ -1421,7 +1419,7 @@ CLEAN_DIRS += $(MODVERDIR) \
$(foreach d, spl tpl, $(patsubst %,$d/%, \ $(foreach d, spl tpl, $(patsubst %,$d/%, \
$(filter-out include, $(shell ls -1 $d 2>/dev/null)))) $(filter-out include, $(shell ls -1 $d 2>/dev/null))))
CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h include/license.h \
boot* u-boot* MLO* SPL System.map boot* u-boot* MLO* SPL System.map
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <common.h> #include <common.h>
/* COPYING is currently 15951 bytes in size */ /* Licenses/gpl-2.0.txt is currently 18092 bytes in size */
#define LICENSE_MAX 20480 #define LICENSE_MAX 20480
#include <command.h> #include <command.h>
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{ {
char *tok, *dst = malloc(LICENSE_MAX); char *dst = malloc(LICENSE_MAX);
unsigned long len = LICENSE_MAX; unsigned long len = LICENSE_MAX;
if (!dst) if (!dst)
return -1; return -1;
if (gunzip(dst, LICENSE_MAX, license_gz, &len) != 0) { if (gunzip(dst, LICENSE_MAX, license_gzip, &len) != 0) {
printf("Error uncompressing license text\n"); printf("Error uncompressing license text\n");
free(dst); free(dst);
return -1; return -1;
......
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
/bmp_logo.h /bmp_logo.h
/bmp_logo_data.h /bmp_logo_data.h
/config.h /config.h
/license.h
...@@ -31,7 +31,6 @@ CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y) ...@@ -31,7 +31,6 @@ CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
# TODO: CONFIG_CMD_LICENSE does not work
hostprogs-$(CONFIG_CMD_LICENSE) += bin2header hostprogs-$(CONFIG_CMD_LICENSE) += bin2header
hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
...@@ -212,6 +211,10 @@ endif ...@@ -212,6 +211,10 @@ endif
endif # !LOGO_BMP 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 # Use native tools and options
# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
...@@ -226,7 +229,7 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \ ...@@ -226,7 +229,7 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
-D__KERNEL_STRICT_NAMES \ -D__KERNEL_STRICT_NAMES \
-D_GNU_SOURCE -D_GNU_SOURCE
__build: $(LOGO-y) __build: $(LOGO-y) $(LICENSE-y)
$(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
...@@ -234,6 +237,10 @@ $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) ...@@ -234,6 +237,10 @@ $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-data $(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 # Let clean descend into subdirs
subdir- += env subdir- += env
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment