From b8f282b8e0ee1e2c36694071c26b6b796f50c0a1 Mon Sep 17 00:00:00 2001 From: Benjamin ROBIN Date: Tue, 20 May 2025 22:35:15 +0200 Subject: bootm: Fix bmi->images pointer not initialized in some cases When building with only bootz command, without bootm, images pointer inside bootm_info structure is not initialized. And since this structure is stored in stack, the generated error is kind of random, but most of the time this will generate: "ramdisk - allocation error". Also, after analysis, this problem could occur with the command booti, if the command bootm is disabled. Currently bootm_init() is called by: do_bootz(), do_bootm(), do_booti() and by do_stm32prog(). And all of these commands execute bootm_run_states() which access the images pointer stored into bootm_info structure. So, to fix this issue, just do the assignment unconditionally. Fixes: c2211ff65136 ("bootm: Add more fields to bootm_info") Signed-off-by: Benjamin ROBIN Reviewed-by: Tom Rini --- boot/bootm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'boot') diff --git a/boot/bootm.c b/boot/bootm.c index f6aa32746b7..108ca7fb472 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -1169,8 +1169,7 @@ void bootm_init(struct bootm_info *bmi) { memset(bmi, '\0', sizeof(struct bootm_info)); bmi->boot_progress = true; - if (IS_ENABLED(CONFIG_CMD_BOOTM)) - bmi->images = &images; + bmi->images = &images; } /** -- cgit v1.2.3 From b22a276f039f818d5564bec6637071cfc8a7e432 Mon Sep 17 00:00:00 2001 From: Eddie Kovsky Date: Wed, 21 May 2025 15:26:59 -0600 Subject: image: android: fix ramdisk default address Commit 21e7fa0e3ac5 ("image: android: handle ramdisk default address") changed the default behavior for header versions less than or equal to 2. The ramdisk address (img_data.ramdisk_ptr) is only assigned to *rd_data if the physical load address (img_data.ramdisk_addr) is equal to 0 or the Android default ramdisk address. /* Ramdisk can be used in-place, use current ptr */ if (img_data.ramdisk_addr == 0 || img_data.ramdisk_addr == ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR) { *rd_data = img_data.ramdisk_ptr; } else { ramdisk_ptr = img_data.ramdisk_addr; *rd_data = ramdisk_ptr; memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr, img_data.ramdisk_size); } When the img_data.ramdisk_addr and the img_data.kernel_addr are the same *rd_data needs to be assigned to the ramdisk address (ramdisk_ptr), not the physical address (ramdisk_addr). As a result of the current behavior, we can no longer boot a kernel on the Renesas R-Car S4 board. Add an additional check to the if clause so that the ramdisk address is assigned when the kernel address and the ramdisk address are the same, restoring the previous default behavior. Fixes: 21e7fa0e3ac5 ("image: android: handle ramdisk default address") Signed-off-by: Eddie Kovsky Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # khadas vim3 --- boot/image-android.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot') diff --git a/boot/image-android.c b/boot/image-android.c index 1746b018900..459cdb8456c 100644 --- a/boot/image-android.c +++ b/boot/image-android.c @@ -488,7 +488,8 @@ int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img, } else { /* Ramdisk can be used in-place, use current ptr */ if (img_data.ramdisk_addr == 0 || - img_data.ramdisk_addr == ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR) { + img_data.ramdisk_addr == ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR || + img_data.ramdisk_addr == img_data.kernel_addr) { *rd_data = img_data.ramdisk_ptr; } else { ramdisk_ptr = img_data.ramdisk_addr; -- cgit v1.2.3 From 31e215fde81417299e45a6ae4a7ee880fac84c37 Mon Sep 17 00:00:00 2001 From: Mayuresh Chitale Date: Thu, 29 May 2025 03:30:51 +0000 Subject: Revert "riscv: image: Add new image type for RV64" This reverts commit 14a4792a71db3561bea065415ac1f2ac69ef32b5 as discussed in [1]. [1] https://lists.denx.de/pipermail/u-boot/2025-May/590841.html Signed-off-by: Mayuresh Chitale Reviewed-by: Leo Yu-Chi Liang --- boot/image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'boot') diff --git a/boot/image.c b/boot/image.c index 45299a7dc33..139c5bd035a 100644 --- a/boot/image.c +++ b/boot/image.c @@ -92,8 +92,7 @@ static const table_entry_t uimage_arch[] = { { IH_ARCH_ARC, "arc", "ARC", }, { IH_ARCH_X86_64, "x86_64", "AMD x86_64", }, { IH_ARCH_XTENSA, "xtensa", "Xtensa", }, - { IH_ARCH_RISCV, "riscv", "RISC-V 32 Bit",}, - { IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",}, + { IH_ARCH_RISCV, "riscv", "RISC-V", }, { -1, "", "", }, }; -- cgit v1.2.3