Skip to contentSkip to conversation

image: android: fix abootimg support

PATCH New Christian Gmeiner 2 participants 2 messages May 29, 2020 – Jun 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image: android: fix abootimg support

abootimg creates images where all load addresses are 0.

Android Boot Image Info:
* file name = artifacts/fastboot.img
* image size = 31381504 bytes (29.93 MB)
page size = 2048 bytes
* Boot Name = ""
* kernel size = 9397406 bytes (8.96 MB)
ramdisk size = 21981144 bytes (20.96 MB)
* load addresses:

  kernel:       0x00000000
  ramdisk:      0x00000000
  tags:         0x00000000

Without this fix we end in a data abort:

Booting kernel at 0x15000000...
* kernel: cmdline image address = 0x15000000 Kernel load addr 0x00000000 size 9178 KiB Kernel command line: ip=dhcp console=ttymxc0,115200n8 kernel data at 0x15000800, len = 0x008f649e (9397406)
* ramdisk: cmdline image address = 0x15000000 RAM disk load addr 0x00000000 size 21473 KiB ramdisk start = 0x158f7000, ramdisk end = 0x16def35c kernel loaded at 0x00000000, end = 0x00000000 Loading Kernel Image
data abort

pc : [<8ff8c004>]	   lr : [<5d7ac70f>]

sp : 8f57ed64 ip : 48f17668 fp : 00000000
r10: 00000002 r9 : 8f58aed0 r8 : 03fa4c58
r7 : 5e842497 r6 : fbe73965 r5 : 7c459955 r4 : df020fde
r3 : 1b7aa45b r2 : 007f23fe r1 : 15104820 r0 : 00104000
Flags: nzCv IRQs off FIQs off Mode SVC_32 (T)

Code: f07c e8b1 51f8 3a20 (e8a0) 51f8

Resetting CPU ...
resetting ...

---
 common/image-android.c | 7 +++++++
 1 file changed, 7 insertions(+)
common/image-android.c +7 -0
index 6af9baa121..18f7c8db03 100644
@@ -33,6 +33,13 @@ static ulong android_image_get_kernel_addr(const struct andr_img_hdr *hdr)
 	if (hdr->kernel_addr == ANDROID_IMAGE_DEFAULT_KERNEL_ADDR)
 		return (ulong)hdr + hdr->page_size;
 
+	/*
+	 * abootimg creates images where all load addresses are 0
+	 * and we need to fix them.
+	 */
+	if (hdr->kernel_addr == 0 && hdr->ramdisk_addr == 0)
+		return env_get_ulong("kernel_addr_r", 16, 0);
+
 	return hdr->kernel_addr;
 }
 
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 image: android: fix abootimg support

Quoted 33 lines · Christian Gmeiner

abootimg creates images where all load addresses are 0.

Android Boot Image Info:
* file name = artifacts/fastboot.img
* image size = 31381504 bytes (29.93 MB)
page size = 2048 bytes
* Boot Name = ""
* kernel size = 9397406 bytes (8.96 MB)
ramdisk size = 21981144 bytes (20.96 MB)
* load addresses:

  kernel:       0x00000000
  ramdisk:      0x00000000
  tags:         0x00000000

Without this fix we end in a data abort:

Booting kernel at 0x15000000...
* kernel: cmdline image address = 0x15000000 Kernel load addr 0x00000000 size 9178 KiB Kernel command line: ip=dhcp console=ttymxc0,115200n8 kernel data at 0x15000800, len = 0x008f649e (9397406)
* ramdisk: cmdline image address = 0x15000000 RAM disk load addr 0x00000000 size 21473 KiB ramdisk start = 0x158f7000, ramdisk end = 0x16def35c kernel loaded at 0x00000000, end = 0x00000000 Loading Kernel Image
data abort

pc : [<8ff8c004>]	   lr : [<5d7ac70f>]

sp : 8f57ed64 ip : 48f17668 fp : 00000000
r10: 00000002 r9 : 8f58aed0 r8 : 03fa4c58
r7 : 5e842497 r6 : fbe73965 r5 : 7c459955 r4 : df020fde
r3 : 1b7aa45b r2 : 007f23fe r1 : 15104820 r0 : 00104000
Flags: nzCv IRQs off FIQs off Mode SVC_32 (T)

Quoted 5 lines
Code: f07c e8b1 51f8 3a20 (e8a0) 51f8

Resetting CPU ...
resetting ...

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: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200603/3443d295/attachment.sig>