From: Rostislav Lisovy Date: Wed, 16 Jul 2014 10:48:51 +0200 Subject: [U-Boot] [PATCH] cmd_nand/cmd_ubi/cmd_nboot: Set environment variable 'filesize' Message-ID: <1405500531-25486-1-git-send-email-lisovy@merica.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The environment variable 'filesize' is commonly used for storing information about the size of the last read/retrieved file. The variable is essential when writing U-boot scripts. This patch adds the capability of storing the information about the size of read data into the 'filesize' variable for other commands (nand read/ubi read/nboot) as well. Signed-off-by: Rostislav Lisovy --- common/cmd_nand.c | 2 ++ common/cmd_ubi.c | 1 + 2 files changed, 3 insertions(+) diff --git a/common/cmd_nand.c b/common/cmd_nand.c index f9ced9d..8368f5f 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -730,6 +730,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf(" %zu bytes %s: %s\n", rwsize, read ? "read" : "written", ret ? "ERROR" : "OK"); + setenv_hex("filesize", rwsize); return ret == 0 ? 0 : 1; } @@ -959,6 +960,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, return 1; } bootstage_mark(BOOTSTAGE_ID_NAND_READ); + setenv_hex("filesize", cnt); #if defined(CONFIG_FIT) /* This cannot be done earlier, we need complete FIT image in RAM first */ diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 7c4d950..a9207c9 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -675,6 +675,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc == 3) { printf("Read %lld bytes from volume %s to %lx\n", size, argv[3], addr); + setenv_hex("filesize", size); return ubi_volume_read(argv[3], (char *)addr, size); } -- 1.9.1