blob: fcc9116a49778821dd07cf6777eeb724c18d91c0 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadabb92b422017-01-30 11:12:07 +09002/*
3 * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadabb92b422017-01-30 11:12:07 +09004 */
5
6#include <common.h>
7#include <command.h>
8#include <malloc.h>
9
10#include "config_data_gz.h"
11#include "config_data_size.h"
12
13static int do_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
14{
15 char *dst;
16 unsigned long len = data_size;
17 int ret = CMD_RET_SUCCESS;
18
19 dst = malloc(data_size + 1);
20 if (!dst)
21 return CMD_RET_FAILURE;
22
23 ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len);
24 if (ret) {
25 printf("failed to uncompress .config data\n");
26 ret = CMD_RET_FAILURE;
27 goto free;
28 }
29
30 dst[data_size] = 0;
31 puts(dst);
32
33free:
34 free(dst);
35
36 return ret;
37}
38
39U_BOOT_CMD(
40 config, 1, 1, do_config,
41 "print .config",
42 ""
43);