arm: afs: Set the filesize env. var. on load
PATCH 1/1 arm: afs: Set the filesize env. var. on load
The afs load command copies data to RAM. Set the filesize environment variable to record how much data was 'loaded'
Signed-off-by Robert Catherall <[email protected]>
--- cmd/armflash.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
cmd/armflash.c +10 -2
@@ -180,6 +180,7 @@ static int load_image(const char * const name, const ulong address) {struct afs_image *afi =NULL ;int i; +loff_t len_read =0 ;parse_flash ();for (i =0 ; i < num_afs_images; i++) {
@@ -197,6 +198,7 @@ static int load_image(const char * const name, const ulong address)for (i =0 ; i < afi->region_count; i++) {ulong from, to; +u32 size; from = afi->flash_mem_start + afi->regions[i].offset;if (address) {
@@ -208,14 +210,20 @@ static int load_image(const char * const name, const ulong address)return CMD_RET_FAILURE ; } -memcpy ((void *)to, (void *)from, afi->regions[i].size); + size = afi->regions[i].size; +memcpy ((void *)to, (void *)from, size);printf ("loaded region %d from %08lX to %08lX, %08X bytes\n" , i, from, to, - afi->regions[i].size); + size); + + len_read += size; } + +env_set_hex ("filesize" , len_read); +return CMD_RET_SUCCESS ; }
Signature · 1 line
2.17.1
On Thu, 23 Nov 2023 14:16:01 +0000
Robert Catherall <[email protected]> wrote:
Hi Robert,
Quoted 2 lines
The
afs loadcommand copies data to RAM. Set the filesize environment variable to record how much data was 'loaded'
Thanks for sending this, I realised this was indeed missing just recently!
Quoted 1 line
Signed-off-by Robert Catherall <[email protected]>
Reviewed-by Andre Przywara <[email protected]>
Tested-by Andre Przywara <[email protected]>
Cheers,
Andre
Quoted 47 lines
--- cmd/armflash.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)cmd/armflash.c +10
-2@@ -180,6 +180,7 @@ static int load_image(const char * const name, const ulong address) {struct afs_image *afi =NULL ;int i; +loff_t len_read =0 ;parse_flash ();for (i =0 ; i < num_afs_images; i++) {@@ -197,6 +198,7 @@ static int load_image(const char * const name, const ulong address)for (i =0 ; i < afi->region_count; i++) {ulong from, to; +u32 size; from = afi->flash_mem_start + afi->regions[i].offset;if (address) {@@ -208,14 +210,20 @@ static int load_image(const char * const name, const ulong address)return CMD_RET_FAILURE ; } -memcpy ((void *)to, (void *)from, afi->regions[i].size); + size = afi->regions[i].size; +memcpy ((void *)to, (void *)from, size);printf ("loaded region %d from %08lX to %08lX, %08X bytes\n" , i, from, to, - afi->regions[i].size); + size); + + len_read += size; } + +env_set_hex ("filesize" , len_read); +return CMD_RET_SUCCESS ; }
Quoted 6 lines · Robert Catherall
The
afs loadcommand copies data to RAM. Set the filesize environment variable to record how much data was 'loaded'Signed-off-by Robert Catherall <[email protected]>Reviewed-by Andre Przywara <[email protected]>Tested-by Andre Przywara <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom