Skip to content

Commit 87db537

Browse files
aakoskinralfbaechle
authored andcommitted
MIPS: vmlinux: create a section for appended DTB
For bootloaders that support booting only ELF kernels and load only ELF segments to memory there is no easy way to supply DTB without kernel recompilation. For that purpose, create a section called .appended_dtb that can be later updated with board-specific DTB using binutils e.g. at kernel installation time. Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/11114/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent d00d920 commit 87db537

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

arch/mips/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,6 +2736,20 @@ choice
27362736
help
27372737
Do not enable appended dtb support.
27382738

2739+
config MIPS_ELF_APPENDED_DTB
2740+
bool "vmlinux"
2741+
help
2742+
With this option, the boot code will look for a device tree binary
2743+
DTB) included in the vmlinux ELF section .appended_dtb. By default
2744+
it is empty and the DTB can be appended using binutils command
2745+
objcopy:
2746+
2747+
objcopy --update-section .appended_dtb=<filename>.dtb vmlinux
2748+
2749+
This is meant as a backward compatiblity convenience for those
2750+
systems with a bootloader that can't be upgraded to accommodate
2751+
the documented boot protocol using a device tree.
2752+
27392753
config MIPS_RAW_APPENDED_DTB
27402754
bool "vmlinux.bin"
27412755
help

arch/mips/kernel/setup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
#include <asm/smp-ops.h>
4040
#include <asm/prom.h>
4141

42+
#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
43+
const char __section(.appended_dtb) __appended_dtb[0x100000];
44+
#endif /* CONFIG_MIPS_ELF_APPENDED_DTB */
45+
4246
struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
4347

4448
EXPORT_SYMBOL(cpu_data);

arch/mips/kernel/vmlinux.lds.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ SECTIONS
132132
__appended_dtb = .;
133133
/* leave space for appended DTB */
134134
. += 0x100000;
135+
#elif defined(CONFIG_MIPS_ELF_APPENDED_DTB)
136+
.appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
137+
*(.appended_dtb)
138+
KEEP(*(.appended_dtb))
139+
}
135140
#endif
136141
/*
137142
* Align to 64K in attempt to eliminate holes before the

0 commit comments

Comments
 (0)