From a454ba0156a247d74fc985577bb165e3362991a8 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Wed, 17 Dec 2025 18:36:50 -0800 Subject: [PATCH] Fix ramdisk setup to correctly handle initbootimage assignment The previous implementation did not update the bootimage pointer when an initbootimage was present, which was leading to improper memcpy in subsequent operations. This commit ensures that when initbootimage is provided, both the boot_hdr and bootimage pointers are updated to reference initbootimage. Tracked-On: None Signed-off-by: Jeremy Compostella --- libkernelflinger/android.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libkernelflinger/android.c b/libkernelflinger/android.c index 2eb26c17..3f9facc3 100644 --- a/libkernelflinger/android.c +++ b/libkernelflinger/android.c @@ -628,8 +628,10 @@ static EFI_STATUS setup_ramdisk(UINT8 *bootimage, UINT8 *initbootimage, UINT8 *v struct vendor_boot_img_hdr_v4 *vendor_hdr = (struct vendor_boot_img_hdr_v4 *)vendorbootimage; struct boot_img_hdr_v4 *boot_hdr = (struct boot_img_hdr_v4 *)bootimage; - if (initbootimage) - boot_hdr = (struct boot_img_hdr_v4 *)initbootimage; + if (initbootimage) { + boot_hdr = (struct boot_img_hdr_v4 *)initbootimage; + bootimage = initbootimage; + } UINT32 page_size = vendor_hdr->page_size; UINT32 vendor_ramdisk_offset = ALIGN(sizeof(struct vendor_boot_img_hdr_v4), page_size);