From d957da5c1a71ca91743f6b962a9adf0c7f093645 Mon Sep 17 00:00:00 2001 From: Daniel Palmer Date: Mon, 6 Jan 2025 10:35:08 +0900 Subject: [PATCH] m68k: dt embedding --- arch/m68k/dts/Makefile | 2 ++ arch/m68k/dts/embedded_dtbs.S | 12 ++++++++++++ arch/m68k/kernel/setup_mm.c | 11 +++++++++++ arch/m68k/kernel/vmlinux-std.lds | 6 ++++++ 4 files changed, 31 insertions(+) create mode 100644 arch/m68k/dts/embedded_dtbs.S diff --git a/arch/m68k/dts/Makefile b/arch/m68k/dts/Makefile index ca4d64a73f49..e2cb53e6d2db 100644 --- a/arch/m68k/dts/Makefile +++ b/arch/m68k/dts/Makefile @@ -1,3 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 dtb-y += \ mvme147.dtb + +obj-y += embedded_dtbs.o diff --git a/arch/m68k/dts/embedded_dtbs.S b/arch/m68k/dts/embedded_dtbs.S new file mode 100644 index 000000000000..139851e77b39 --- /dev/null +++ b/arch/m68k/dts/embedded_dtbs.S @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include + + .section ".embedded_dtbs","aw" + + .balign PAGE_SIZE + +SYM_DATA_START(mvme147_dtb) + .incbin "arch/m68k/dts/mvme147.dtb" +SYM_DATA_END_LABEL(mvme147_dtb, SYM_L_GLOBAL, mvme147_dtb_end) diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 6d358124259e..a5feb561064d 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -293,6 +293,17 @@ void __init setup_arch(char **cmdline_p) } } + // TODO: This is wrong, the blob is in the init section so it needs to be copied + // but PoC + if (!fdt_blob) + { + extern void *mvme147_dtb; + + pr_info("FDT blob was not provided, will use embedded one if available\n"); + if (MACH_IS_MVME147) + fdt_blob = mvme147_dtb; + } + if (fdt_blob) m68k_setup_fdt(); diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds index 1ccdd04ae462..3e40b6cf36a4 100644 --- a/arch/m68k/kernel/vmlinux-std.lds +++ b/arch/m68k/kernel/vmlinux-std.lds @@ -43,6 +43,12 @@ SECTIONS __init_begin = .; INIT_TEXT_SECTION(PAGE_SIZE) :data INIT_DATA_SECTION(16) + STRUCT_ALIGN(); + .embedded_dtbs : { + embedded_dtbs = .; + *(.embedded_dtbs) + KEEP(*(.embedded_dtbs)) + } .m68k_fixup : { __start_fixup = .; *(.m68k_fixup) -- 2.45.2