license.c 724 Bytes
Newer Older
1 2 3 4
/*
 * (C) Copyright 2007 by OpenMoko, Inc.
 * Author: Harald Welte <laforge@openmoko.org>
 *
5
 * SPDX-License-Identifier:	GPL-2.0+
6 7 8 9
 */

#include <common.h>

Tom Rini's avatar
Tom Rini committed
10
/* Licenses/gpl-2.0.txt is currently 18092 bytes in size */
11 12 13 14 15 16
#define LICENSE_MAX	20480

#include <command.h>
#include <malloc.h>
#include <license.h>

17
int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
18
{
Tom Rini's avatar
Tom Rini committed
19
	char *dst = malloc(LICENSE_MAX);
20 21 22 23 24
	unsigned long len = LICENSE_MAX;

	if (!dst)
		return -1;

Tom Rini's avatar
Tom Rini committed
25
	if (gunzip(dst, LICENSE_MAX, license_gzip, &len) != 0) {
26 27 28 29 30 31 32 33 34 35
		printf("Error uncompressing license text\n");
		free(dst);
		return -1;
	}
	puts(dst);
	free(dst);

	return 0;
}

36 37
U_BOOT_CMD(
	license, 1, 1, do_license,
38 39 40
	"print GPL license text",
	""
);