From 6ae4e8084f91670bc8b2a137c5fee9e69e32274c Mon Sep 17 00:00:00 2001 From: Aiden Isik Date: Thu, 14 May 2026 18:33:56 +0100 Subject: [PATCH] main: Pass address of address of DTB to patch_dtb Pass the address of the address of the DTB to patch_dtb in boot.c, rather than just the address to the DTB. This allows the modified DTB address to overwrite the address of the original DTB, fixing a bug where the ramdisk address was not being passed to the kernel via the DTB successfully. --- include/main/boot-fdt.h | 2 +- main/boot-fdt.c | 6 +++--- main/boot.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/main/boot-fdt.h b/include/main/boot-fdt.h index 2a33b44..62c8297 100644 --- a/include/main/boot-fdt.h +++ b/include/main/boot-fdt.h @@ -6,6 +6,6 @@ #ifndef BOOT_FDT_H_ #define BOOT_FDT_H_ -void patch_dtb(void* dt); +void patch_dtb(void** dt); #endif // BOOT_FDT_H_ diff --git a/main/boot-fdt.c b/main/boot-fdt.c index 66b68e1..2de83c4 100644 --- a/main/boot-fdt.c +++ b/main/boot-fdt.c @@ -8,13 +8,13 @@ static char fdt_buf[CONFIG_FDT_BUF_SIZE]; -void patch_dtb(void* dt) +void patch_dtb(void** dt) { int ret; - ret = ramdisk_handler_patch_dtb(dt, &fdt_buf, sizeof(fdt_buf)); + ret = ramdisk_handler_patch_dtb(*dt, &fdt_buf, sizeof(fdt_buf)); if (ret != 0) printk(KERN_ERR, "failed to patch dtb\n"); else - dt = &fdt_buf; + *dt = &fdt_buf; } diff --git a/main/boot.c b/main/boot.c index edafd29..9fa3010 100644 --- a/main/boot.c +++ b/main/boot.c @@ -12,7 +12,7 @@ void boot_kernel(void* dt, void* kernel, void* ramdisk) { #ifdef CONFIG_LIBFDT - patch_dtb(dt); + patch_dtb(&dt); #endif printk(KERN_INFO, "Booting kernel...\n");