Skip to contentSkip to conversation

image: fix Android ramdisk support when dtb is specified

PATCH In review Rob Herring 3 participants 4 messages Jul 17, 2015 – Aug 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image: fix Android ramdisk support when dtb is specified

If a dtb is specified on the command-line, the Android boot image ramdisk will not be found. Fix this so that we can specify the ramdisk address and dtb address. The syntax is to enter the Android boot image address for both the kernel and ramdisk.

---
 common/image.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
common/image.c +8 -10
index f0f0135..73fc288 100644
@@ -896,6 +896,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 
 	if (argc >= 2)
 		select = argv[1];
+
 	/*
 	 * Look for a '-' which indicates to ignore the
 	 * ramdisk argument
@@ -995,6 +996,12 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			images->fit_noffset_rd = rd_noffset;
 			break;
 #endif
+#ifdef CONFIG_ANDROID_BOOT_IMAGE
+		case IMAGE_FORMAT_ANDROID:
+			android_image_get_ramdisk((void *)images->os.start,
+				&rd_data, &rd_len);
+			break;
+#endif
 		default:
 #ifdef CONFIG_SUPPORT_RAW_INITRD
 			end = NULL;
@@ -1025,16 +1032,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 				(ulong)images->legacy_hdr_os);
 
 		image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
-	}
-#ifdef CONFIG_ANDROID_BOOT_IMAGE
-	else if ((genimg_get_format((void *)images->os.start)
-			== IMAGE_FORMAT_ANDROID) &&
-		 (!android_image_get_ramdisk((void *)images->os.start,
-		 &rd_data, &rd_len))) {
-		/* empty */
-	}
-#endif
-	else {
+	} else {
 		/*
 		 * no initrd image
 		 */
Signature · 1 line
2.1.0
#1 lore raw
Quoted 6 lines · Rob Herring

If a dtb is specified on the command-line, the Android boot image ramdisk will not be found. Fix this so that we can specify the ramdisk address and dtb address. The syntax is to enter the Android boot image address for both the kernel and ramdisk.

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: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150813/4acb4969/attachment.sig>
#2 lore raw

PATCH 1/1 image: fix Android ramdisk support when dtb is specified

In reply to Rob Herring

Le vendredi 17 juillet 2015 ? 10:57 -0500, Rob Herring a ?crit :

Quoted 4 lines

If a dtb is specified on the command-line, the Android boot image ramdisk will not be found. Fix this so that we can specify the ramdisk address and dtb address. The syntax is to enter the Android boot image address for both the kernel and ramdisk.

This commit breaks booting non-fdt Android images (the kernel doesn't find the initramfs, and neither does U-Boot).

The test to enter the code block where Android ramdisk support was moved is accessed with:
else if (select || genimg_has_config(images)) {

However, in a non-fdt context, select is NULL and genimg_has_config returns 0.

I suggest we either duplicate Android ramdisk support in the non-fdt path or adapt the condition to enter the code block where it was moved.

Quoted 38 lines
---
 common/image.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
common/image.c +7 -4
index f0f0135..73fc288 100644
@@ -896,6 +896,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 
 	if (argc >= 2)
 		select = argv[1];
+
 	/*
 	 * Look for a '-' which indicates to ignore the
 	 * ramdisk argument
@@ -995,6 +996,12 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			images->fit_noffset_rd = rd_noffset;
 			break;
 #endif
+#ifdef CONFIG_ANDROID_BOOT_IMAGE
+		case IMAGE_FORMAT_ANDROID:
+			android_image_get_ramdisk((void *)images->os.start,
+				&rd_data, &rd_len);
+			break;
+#endif
 		default:
 #ifdef CONFIG_SUPPORT_RAW_INITRD
 			end = NULL;
@@ -1025,16 +1032,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 				(ulong)images->legacy_hdr_os);
 
 		image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
-	}
-#ifdef CONFIG_ANDROID_BOOT_IMAGE
-	else if ((genimg_get_format((void *)images->os.start)
-			== IMAGE_FORMAT_ANDROID) &&

common/image.c int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, · line 1038

Quoted 10 lines
common/image.c +1 -6
-		 (!android_image_get_ramdisk((void *)images->os.start,
-		 &rd_data, &rd_len))) {
-		/* empty */
-	}
-#endif
-	else {
+	} else {
 		/*
 		 * no initrd image
 		 */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150827/6d61fad6/attachment.sig>

#3 lore raw

PATCH 1/1 image: fix Android ramdisk support when dtb is specified

Quoted 13 lines · Paul Kocialkowski

Le vendredi 17 juillet 2015 ? 10:57 -0500, Rob Herring a ?crit :

Quoted 4 lines

If a dtb is specified on the command-line, the Android boot image ramdisk will not be found. Fix this so that we can specify the ramdisk address and dtb address. The syntax is to enter the Android boot image address for both the kernel and ramdisk.

This commit breaks booting non-fdt Android images (the kernel doesn't find the initramfs, and neither does U-Boot).

The test to enter the code block where Android ramdisk support was moved is accessed with:
else if (select || genimg_has_config(images)) {

Quoted 5 lines

However, in a non-fdt context, select is NULL and genimg_has_config returns 0.

I suggest we either duplicate Android ramdisk support in the non-fdt path or adapt the condition to enter the code block where it was moved.

I've taken a third path, make the code check for Android images and then "know" what the address we want to check should be. Let me know if that patch fixes your problem, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150827/aacd6b16/attachment.sig>