[PATCH] boot: android: fix booting without a ramdisk

Michael Walle mwalle at kernel.org
Sat Jul 27 01:00:35 CEST 2024


android_image_get_ramdisk() will return an error if there is no ramdisk.
Using the android image without a ramdisk worked until commit
1ce8e10f3b4b ("image: Fix up ANDROID_BOOT_IMAGE ramdisk code") because
that return code wasn't checked. Now that it is checked, don't return an
error in the (valid) case that there is no ramdisk in the image.

With this, I'm able to boot a linux kernel using fastboot again:

  fastboot --base 0x41000000 --header-version 2 --dtb /path/to/dtb \
  --cmdline "root=/dev/mmcblk0p1 rootwait" boot path/to/Image

Signed-off-by: Michael Walle <mwalle at kernel.org>
---
 boot/image-android.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boot/image-android.c b/boot/image-android.c
index 09c7a44e058..0900579ee8c 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -395,7 +395,7 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img,
 
 	if (!img_data.ramdisk_size) {
 		*rd_data = *rd_len = 0;
-		return -1;
+		return 0;
 	}
 	if (img_data.header_version > 2) {
 		ramdisk_ptr = img_data.ramdisk_addr;
-- 
2.39.2



More information about the U-Boot mailing list