bootm_find_os() leaves images.os.arch at IH_ARCH_INVALID for Android boot
images, so the arm64 Image relocation in bootm_load_os() (booti_setup()) is
skipped. An uncompressed kernel from a v3/v4 boot image is then executed in
place at boot.img + page size, which is not 2 MiB aligned. The kernel
reports "Kernel image misaligned at boot, please fix your bootloader!" and
dies early (observed as a stack overflow in start_kernel() with a GKI 6.12
kernel on QEMU virt).

Mark the kernel with the default architecture, like the legacy and FIT
paths effectively do, so booti_setup() moves it to a properly aligned
address.

Signed-off-by: Igor Opaniuk <[email protected]>
---
 boot/bootm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/boot/bootm.c b/boot/bootm.c
index b6ae0163b27..75b34f39cca 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -432,6 +432,7 @@ static int bootm_find_os(const char *cmd_name, const char 
*addr_fit)
                images.os.type = IH_TYPE_KERNEL;
                images.os.comp = android_image_get_kcomp(boot_img, 
vendor_boot_img);
                images.os.os = IH_OS_LINUX;
+               images.os.arch = IH_ARCH_DEFAULT;
                images.os.end = android_image_get_end(boot_img, 
vendor_boot_img);
                images.os.load = android_image_get_kload(boot_img, 
vendor_boot_img);
                images.ep = images.os.load;

---
base-commit: ed869863c7e2aca50d57a05d843830dd843138c4
change-id: 20261011-upstream-bootm_android_b4-4e94dca526b5

Best regards,
--  
Igor Opaniuk <[email protected]>

Reply via email to