* [PATCH] MIPS: OCTEON: compute the FDT CRC in device_tree_init()
@ 2026-10-27 6:02 Orgad Shaneh
2026-11-17 16:12 ` Thomas Bogendoerfer
0 siblings, 1 reply; 2+ messages in thread
From: Orgad Shaneh @ 2026-10-27 6:02 UTC (permalink / raw)
To: tsbogend; +Cc: linux-mips, linux-kernel, ardb
device_tree_init() assigns initial_boot_params directly and never calls
early_init_dt_verify(), so of_fdt_crc32 stays 0 and every boot logs
OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
whether the blob was passed by the bootloader, appended or built in.
Call early_init_dt_verify() once the prune and the MAC address fill-in
are done with the blob, so the CRC matches what of_fdt_raw_init() reads
back. x86 had the same omission, fixed by commit 628df9dc5ad8
("x86/devicetree: Initialize device tree before using it").
Fixes: 08d53aa58cb1 ("of/fdt: export fdt blob as /sys/firmware/fdt")
Assisted-by: LLM
Signed-off-by: Orgad Shaneh <orgads@gmail.com>
---
Tested on a CN6335 board (internal device tree, Cavium U-Boot 1.1.1),
in a 7.3-based tree: the warning is gone and /sys/firmware/fdt holds the
11551-byte blob. mips-next with cavium_octeon_defconfig prints the
warning on the same board without this patch.
arch/mips/cavium-octeon/setup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 7497be7b9431..fa8273799b94 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -1213,6 +1213,8 @@ void __init device_tree_init(void)
}
if (fill_mac)
octeon_fill_mac_addresses();
+ /* After the edits above, so the CRC covers the final blob */
+ early_init_dt_verify(initial_boot_params, __pa(initial_boot_params));
unflatten_and_copy_device_tree();
init_octeon_system_type();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] MIPS: OCTEON: compute the FDT CRC in device_tree_init()
2026-10-27 6:02 [PATCH] MIPS: OCTEON: compute the FDT CRC in device_tree_init() Orgad Shaneh
@ 2026-11-17 16:12 ` Thomas Bogendoerfer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2026-11-17 16:12 UTC (permalink / raw)
To: Orgad Shaneh; +Cc: linux-mips, linux-kernel, ardb
On Tue, Oct 27, 2026 at 06:02:14AM +0000, Orgad Shaneh wrote:
> device_tree_init() assigns initial_boot_params directly and never calls
> early_init_dt_verify(), so of_fdt_crc32 stays 0 and every boot logs
>
> OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
>
> whether the blob was passed by the bootloader, appended or built in.
> Call early_init_dt_verify() once the prune and the MAC address fill-in
> are done with the blob, so the CRC matches what of_fdt_raw_init() reads
> back. x86 had the same omission, fixed by commit 628df9dc5ad8
> ("x86/devicetree: Initialize device tree before using it").
>
> Fixes: 08d53aa58cb1 ("of/fdt: export fdt blob as /sys/firmware/fdt")
> Assisted-by: LLM
> Signed-off-by: Orgad Shaneh <orgads@gmail.com>
> ---
> Tested on a CN6335 board (internal device tree, Cavium U-Boot 1.1.1),
> in a 7.3-based tree: the warning is gone and /sys/firmware/fdt holds the
> 11551-byte blob. mips-next with cavium_octeon_defconfig prints the
> warning on the same board without this patch.
>
> arch/mips/cavium-octeon/setup.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
> index 7497be7b9431..fa8273799b94 100644
> --- a/arch/mips/cavium-octeon/setup.c
> +++ b/arch/mips/cavium-octeon/setup.c
> @@ -1213,6 +1213,8 @@ void __init device_tree_init(void)
> }
> if (fill_mac)
> octeon_fill_mac_addresses();
> + /* After the edits above, so the CRC covers the final blob */
> + early_init_dt_verify(initial_boot_params, __pa(initial_boot_params));
> unflatten_and_copy_device_tree();
> init_octeon_system_type();
> }
I've applied https://lore.kernel.org/all/20261025192918.586220-1-carl.smith@alliedtelesis.co.nz/ to mips-next, which is doing the same.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 16:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 6:02 [PATCH] MIPS: OCTEON: compute the FDT CRC in device_tree_init() Orgad Shaneh
2026-11-17 16:12 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox