ubifs: allow loading to above 4GiB
PATCH v2 1/1 ubifs: allow loading to above 4GiB
The ubifsload command is truncating any address above 4GiB as it casts this address to an u32, instead of using an unsigned long which most of the other load commands do. Change this to an unsigned long to allow loading into high memory for boards which use these areas.
Fixes the following error:
=> ubifsload 0x2100000000 /boot/Image.lzma Loading file '/boot/Image.lzma' to addr 0x00000000... Unhandled exception: Store/AMO access fault
---
v2:
- fixed debug print
--- cmd/ubifs.c | 4 ++-- fs/ubifs/ubifs.c | 4 ++-- include/ubifs_uboot.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
cmd/ubifs.c +2 -2
@@ -111,7 +111,7 @@ static int do_ubifs_load(struct cmd_tbl *cmdtp, int flag, int argc,char *filename;char *endp;int ret; -u32 addr; +unsigned long addr;u32 size =0 ;if (!ubifs_mounted) {
@@ -133,7 +133,7 @@ static int do_ubifs_load(struct cmd_tbl *cmdtp, int flag, int argc,if (endp == argv[3 ])return CMD_RET_USAGE ; } -debug ("Loading file '%s' to address 0x%08x (size %d)\n" , filename, addr, size); +debug ("Loading file '%s' to address 0x%08lx (size %d)\n" , filename, addr, size); ret =ubifs_load (filename, addr, size);if (ret) {
fs/ubifs/ubifs.c +2 -2
@@ -925,12 +925,12 @@ void ubifs_close(void) }/* Compat wrappers for common/cmd_ubifs.c */ -int ubifs_load (char *filename,u32 addr,u32 size) +int ubifs_load (char *filename,unsigned long addr,u32 size) {loff_t actread;int err; -printf ("Loading file '%s' to addr 0x%08x...\n" , filename, addr); +printf ("Loading file '%s' to addr 0x%08lx...\n" , filename, addr); err =ubifs_read (filename, (void *)(uintptr_t )addr,0 , size, &actread);if (err ==0 ) {
include/ubifs_uboot.h +1 -1
@@ -21,7 +21,7 @@ int ubifs_init(void);int uboot_ubifs_mount (char *vol_name);void uboot_ubifs_umount (void );int ubifs_is_mounted (void ); -int ubifs_load (char *filename,u32 addr,u32 size); +int ubifs_load (char *filename,unsigned long addr,u32 size);int ubifs_set_blk_dev (struct blk_desc *rbdd,struct disk_partition *info);int ubifs_ls (const char *dir_name);
Signature · 1 line
2.39.2
Hello Ben,
Quoted 13 lines · Ben Dooks
The ubifsload command is truncating any address above 4GiB as it casts this address to an u32, instead of using an unsigned long which most of the other load commands do. Change this to an unsigned long to allow loading into high memory for boards which use these areas.
Fixes the following error:
=> ubifsload
0x2100000000/boot/Image.lzmaLoading file '/boot/Image.lzma' to addr0x00000000... Unhandled exception: Store/AMO access faultSigned-off-by Ben Dooks <[email protected]>Signed-off-by Ben Dooks <[email protected]>
Quoted 8 lines
---
v2:
- fixed debug print--- cmd/ubifs.c | 4 ++-- fs/ubifs/ubifs.c | 4 ++-- include/ubifs_uboot.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
Applied to u-boot-ubi.git master
Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]