Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 by OpenMoko, Inc. |
| 3 | * Author: Harald Welte <laforge@openmoko.org> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | |
Tom Rini | 286856c | 2016-03-15 12:49:12 -0400 | [diff] [blame] | 10 | /* Licenses/gpl-2.0.txt is currently 18092 bytes in size */ |
Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 11 | #define LICENSE_MAX 20480 |
| 12 | |
| 13 | #include <command.h> |
| 14 | #include <malloc.h> |
| 15 | #include <license.h> |
Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 16 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 17 | int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 18 | { |
Tom Rini | 286856c | 2016-03-15 12:49:12 -0400 | [diff] [blame] | 19 | char *dst = malloc(LICENSE_MAX); |
Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 20 | unsigned long len = LICENSE_MAX; |
| 21 | |
| 22 | if (!dst) |
| 23 | return -1; |
| 24 | |
Tom Rini | 286856c | 2016-03-15 12:49:12 -0400 | [diff] [blame] | 25 | if (gunzip(dst, LICENSE_MAX, license_gzip, &len) != 0) { |
Harald Welte | 5708dbf | 2008-07-09 22:30:30 +0800 | [diff] [blame] | 26 | printf("Error uncompressing license text\n"); |
| 27 | free(dst); |
| 28 | return -1; |
| 29 | } |
| 30 | puts(dst); |
| 31 | free(dst); |
| 32 | |
| 33 | return 0; |
| 34 | } |
| 35 | |
Frans Meulenbroeks | 7675a09 | 2010-07-31 15:01:53 +0200 | [diff] [blame] | 36 | U_BOOT_CMD( |
| 37 | license, 1, 1, do_license, |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 38 | "print GPL license text", |
| 39 | "" |
| 40 | ); |