]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
0a823aa2 HW |
2 | /* |
3 | * (C) Copyright 2007 by OpenMoko, Inc. | |
4 | * Author: Harald Welte <[email protected]> | |
0a823aa2 HW |
5 | */ |
6 | ||
d678a59d | 7 | #include <common.h> |
0a823aa2 | 8 | #include <command.h> |
0c670fc1 | 9 | #include <gzip.h> |
0a823aa2 | 10 | #include <malloc.h> |
0a823aa2 | 11 | |
d726f225 MY |
12 | #include "license_data_gz.h" |
13 | #include "license_data_size.h" | |
14 | ||
09140113 SG |
15 | static int do_license(struct cmd_tbl *cmdtp, int flag, int argc, |
16 | char *const argv[]) | |
0a823aa2 | 17 | { |
d726f225 MY |
18 | char *dst; |
19 | unsigned long len = data_size; | |
20 | int ret = CMD_RET_SUCCESS; | |
0a823aa2 | 21 | |
d726f225 | 22 | dst = malloc(data_size + 1); |
0a823aa2 | 23 | if (!dst) |
d726f225 | 24 | return CMD_RET_FAILURE; |
0a823aa2 | 25 | |
d726f225 MY |
26 | ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len); |
27 | if (ret) { | |
0a823aa2 | 28 | printf("Error uncompressing license text\n"); |
d726f225 MY |
29 | ret = CMD_RET_FAILURE; |
30 | goto free; | |
0a823aa2 | 31 | } |
d726f225 MY |
32 | |
33 | dst[data_size] = 0; | |
0a823aa2 | 34 | puts(dst); |
d726f225 MY |
35 | |
36 | free: | |
0a823aa2 HW |
37 | free(dst); |
38 | ||
d726f225 | 39 | return ret; |
0a823aa2 HW |
40 | } |
41 | ||
388a29d0 FM |
42 | U_BOOT_CMD( |
43 | license, 1, 1, do_license, | |
a89c33db WD |
44 | "print GPL license text", |
45 | "" | |
46 | ); |