Home | History | Annotate | Download | only in cmd
      1 // SPDX-License-Identifier: GPL-2.0+
      2 /*
      3  * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro (at) socionext.com>
      4  */
      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 
     13 static 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 
     33 free:
     34 	free(dst);
     35 
     36 	return ret;
     37 }
     38 
     39 U_BOOT_CMD(
     40 	config, 1, 1, do_config,
     41 	"print .config",
     42 	""
     43 );
     44