Commit 8a7367accaaf88f90773a37fc9257d184bf448d2
1 parent
cd0fa5bff8
Exists in
v2017.01-smarct4x
and in
29 other branches
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>
Showing 5 changed files with 15 additions and 8 deletions Side-by-side Diff
Makefile
... | ... | @@ -1405,8 +1405,6 @@ |
1405 | 1405 | git log --no-merges U-Boot-1_1_5.. | \ |
1406 | 1406 | unexpand -a | sed -e 's/\s\s*$$//' > $@ |
1407 | 1407 | |
1408 | -include/license.h: tools/bin2header COPYING | |
1409 | - cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h | |
1410 | 1408 | ######################################################################### |
1411 | 1409 | |
1412 | 1410 | ### |
... | ... | @@ -1421,7 +1419,7 @@ |
1421 | 1419 | $(foreach d, spl tpl, $(patsubst %,$d/%, \ |
1422 | 1420 | $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) |
1423 | 1421 | |
1424 | -CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \ | |
1422 | +CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h include/license.h \ | |
1425 | 1423 | boot* u-boot* MLO* SPL System.map |
1426 | 1424 | |
1427 | 1425 | # Directories & files removed with 'make mrproper' |
cmd/license.c
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | |
8 | 8 | #include <common.h> |
9 | 9 | |
10 | -/* COPYING is currently 15951 bytes in size */ | |
10 | +/* Licenses/gpl-2.0.txt is currently 18092 bytes in size */ | |
11 | 11 | #define LICENSE_MAX 20480 |
12 | 12 | |
13 | 13 | #include <command.h> |
14 | 14 | |
... | ... | @@ -16,13 +16,13 @@ |
16 | 16 | |
17 | 17 | int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
18 | 18 | { |
19 | - char *tok, *dst = malloc(LICENSE_MAX); | |
19 | + char *dst = malloc(LICENSE_MAX); | |
20 | 20 | unsigned long len = LICENSE_MAX; |
21 | 21 | |
22 | 22 | if (!dst) |
23 | 23 | return -1; |
24 | 24 | |
25 | - if (gunzip(dst, LICENSE_MAX, license_gz, &len) != 0) { | |
25 | + if (gunzip(dst, LICENSE_MAX, license_gzip, &len) != 0) { | |
26 | 26 | printf("Error uncompressing license text\n"); |
27 | 27 | free(dst); |
28 | 28 | return -1; |
include/.gitignore
tools/Makefile
... | ... | @@ -31,7 +31,6 @@ |
31 | 31 | |
32 | 32 | hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params |
33 | 33 | |
34 | -# TODO: CONFIG_CMD_LICENSE does not work | |
35 | 34 | hostprogs-$(CONFIG_CMD_LICENSE) += bin2header |
36 | 35 | hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo |
37 | 36 | hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo |
... | ... | @@ -212,6 +211,10 @@ |
212 | 211 | |
213 | 212 | endif # !LOGO_BMP |
214 | 213 | |
214 | +# Generated gziped GPL-2.0 license text | |
215 | +LICENSE_H = $(objtree)/include/license.h | |
216 | +LICENSE-$(CONFIG_CMD_LICENSE) += $(LICENSE_H) | |
217 | + | |
215 | 218 | # |
216 | 219 | # Use native tools and options |
217 | 220 | # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps |
218 | 221 | |
... | ... | @@ -226,13 +229,17 @@ |
226 | 229 | -D__KERNEL_STRICT_NAMES \ |
227 | 230 | -D_GNU_SOURCE |
228 | 231 | |
229 | -__build: $(LOGO-y) | |
232 | +__build: $(LOGO-y) $(LICENSE-y) | |
230 | 233 | |
231 | 234 | $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) |
232 | 235 | $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ |
233 | 236 | |
234 | 237 | $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) |
235 | 238 | $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@ |
239 | + | |
240 | +$(LICENSE_H): $(obj)/bin2header $(srctree)/Licenses/gpl-2.0.txt | |
241 | + cat $(srctree)/Licenses/gpl-2.0.txt | gzip -9 -c | \ | |
242 | + $(obj)/bin2header license_gzip > $(LICENSE_H) | |
236 | 243 | |
237 | 244 | # Let clean descend into subdirs |
238 | 245 | subdir- += env |