Skip to contentSkip to conversation

Support boot Android image without address on bootm command

PATCH In review Shawn Guo 2 participants 3 messages Feb 22, 2019 – Apr 24, 2019

lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/1 Support boot Android image without address on bootm command

It works perfectly fine to boot an Android boot.img with bootm command followed by an explicit address argument that holds the image. But if we have boot.img downloaded into default 'loadaddr', and then boot it using bootm command without the address argument, we will run into problem, because U-Boot fails to find ramdisk and fdt (second area) in boot.img.

The current Android image support assumes there is always an address argument on bootm command. However just like booting any other images, 'loadaddr' should be used when address argument is missing from bootm command. It patches boot_get_ramdisk() and boot_get_fdt() a bit to support this quite common usage of bootm command for Android image.

---
 common/image-fdt.c | 2 +-
 common/image.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/image-fdt.c +1 -1
index 57f150311392..8009932f1405 100644
@@ -246,7 +246,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 	*of_flat_tree = NULL;
 	*of_size = 0;
 
-	img_addr = simple_strtoul(argv[0], NULL, 16);
+	img_addr = (argc == 0) ? load_addr : simple_strtoul(argv[0], NULL, 16);
 	buf = map_sysmem(img_addr, 0);
 
 	if (argc > 2)
common/image.c +1 -1
index 4d4248f234fb..75b84d50091d 100644
@@ -957,7 +957,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 	 */
 	buf = map_sysmem(images->os.start, 0);
 	if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
-		select = argv[0];
+		select = (argc == 0) ? env_get("loadaddr") : argv[0];
 #endif
 
 	if (argc >= 2)
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 Support boot Android image without address on bootm command

Quoted 7 lines · Shawn Guo

It works perfectly fine to boot an Android boot.img with bootm command followed by an explicit address argument that holds the image. But if we have boot.img downloaded into default 'loadaddr', and then boot it using bootm command without the address argument, we will run into problem, because U-Boot fails to find ramdisk and fdt (second area) in boot.img.

Quoted 7 lines

The current Android image support assumes there is always an address argument on bootm command. However just like booting any other images, 'loadaddr' should be used when address argument is missing from bootm command. It patches boot_get_ramdisk() and boot_get_fdt() a bit to support this quite common usage of bootm command for Android image.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190222/84399db2/attachment.sig>
#2 lore raw
In reply to Shawn Guo
Quoted 7 lines · Shawn Guo

It works perfectly fine to boot an Android boot.img with bootm command followed by an explicit address argument that holds the image. But if we have boot.img downloaded into default 'loadaddr', and then boot it using bootm command without the address argument, we will run into problem, because U-Boot fails to find ramdisk and fdt (second area) in boot.img.

Quoted 8 lines

The current Android image support assumes there is always an address argument on bootm command. However just like booting any other images, 'loadaddr' should be used when address argument is missing from bootm command. It patches boot_get_ramdisk() and boot_get_fdt() a bit to support this quite common usage of bootm command for Android image.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/706e9a8a/attachment.sig>