]> git.ipfire.org Git - people/ms/u-boot.git/blame - cmd/license.c
omap3_logic: Fix Environmental location
[people/ms/u-boot.git] / cmd / license.c
CommitLineData
0a823aa2
HW
1/*
2 * (C) Copyright 2007 by OpenMoko, Inc.
3 * Author: Harald Welte <laforge@openmoko.org>
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
0a823aa2
HW
6 */
7
8#include <common.h>
0a823aa2
HW
9#include <command.h>
10#include <malloc.h>
0a823aa2 11
d726f225
MY
12#include "license_data_gz.h"
13#include "license_data_size.h"
14
15static int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
0a823aa2 16{
d726f225
MY
17 char *dst;
18 unsigned long len = data_size;
19 int ret = CMD_RET_SUCCESS;
0a823aa2 20
d726f225 21 dst = malloc(data_size + 1);
0a823aa2 22 if (!dst)
d726f225 23 return CMD_RET_FAILURE;
0a823aa2 24
d726f225
MY
25 ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len);
26 if (ret) {
0a823aa2 27 printf("Error uncompressing license text\n");
d726f225
MY
28 ret = CMD_RET_FAILURE;
29 goto free;
0a823aa2 30 }
d726f225
MY
31
32 dst[data_size] = 0;
0a823aa2 33 puts(dst);
d726f225
MY
34
35free:
0a823aa2
HW
36 free(dst);
37
d726f225 38 return ret;
0a823aa2
HW
39}
40
388a29d0
FM
41U_BOOT_CMD(
42 license, 1, 1, do_license,
a89c33db
WD
43 "print GPL license text",
44 ""
45);