2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2008-07-09 14:30:30 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2007 by OpenMoko, Inc.
|
|
|
|
* Author: Harald Welte <laforge@openmoko.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2019-08-01 15:46:36 +00:00
|
|
|
#include <gzip.h>
|
2008-07-09 14:30:30 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
|
2017-01-30 02:12:08 +00:00
|
|
|
#include "license_data_gz.h"
|
|
|
|
#include "license_data_size.h"
|
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
static int do_license(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
|
|
char *const argv[])
|
2008-07-09 14:30:30 +00:00
|
|
|
{
|
2017-01-30 02:12:08 +00:00
|
|
|
char *dst;
|
|
|
|
unsigned long len = data_size;
|
|
|
|
int ret = CMD_RET_SUCCESS;
|
2008-07-09 14:30:30 +00:00
|
|
|
|
2017-01-30 02:12:08 +00:00
|
|
|
dst = malloc(data_size + 1);
|
2008-07-09 14:30:30 +00:00
|
|
|
if (!dst)
|
2017-01-30 02:12:08 +00:00
|
|
|
return CMD_RET_FAILURE;
|
2008-07-09 14:30:30 +00:00
|
|
|
|
2017-01-30 02:12:08 +00:00
|
|
|
ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len);
|
|
|
|
if (ret) {
|
2008-07-09 14:30:30 +00:00
|
|
|
printf("Error uncompressing license text\n");
|
2017-01-30 02:12:08 +00:00
|
|
|
ret = CMD_RET_FAILURE;
|
|
|
|
goto free;
|
2008-07-09 14:30:30 +00:00
|
|
|
}
|
2017-01-30 02:12:08 +00:00
|
|
|
|
|
|
|
dst[data_size] = 0;
|
2008-07-09 14:30:30 +00:00
|
|
|
puts(dst);
|
2017-01-30 02:12:08 +00:00
|
|
|
|
|
|
|
free:
|
2008-07-09 14:30:30 +00:00
|
|
|
free(dst);
|
|
|
|
|
2017-01-30 02:12:08 +00:00
|
|
|
return ret;
|
2008-07-09 14:30:30 +00:00
|
|
|
}
|
|
|
|
|
2010-07-31 13:01:53 +00:00
|
|
|
U_BOOT_CMD(
|
|
|
|
license, 1, 1, do_license,
|
2009-05-24 15:06:54 +00:00
|
|
|
"print GPL license text",
|
|
|
|
""
|
|
|
|
);
|