1 From: Alexey Brodkin <abrodkin@synopsys.com>
2 Subject: openwrt: arc - add OWRTDTB section
4 This change allows OpenWRT to patch resulting kernel binary with
7 That allows us to re-use exactky the same vmlinux on different boards
8 given its ARC core configurations match (at least cache line sizes etc).
10 ""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external
11 .dtb right after it, keeping the string in place.
13 Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
15 arch/arc/kernel/head.S | 10 ++++++++++
16 arch/arc/kernel/setup.c | 4 +++-
17 arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++
18 3 files changed, 26 insertions(+), 1 deletion(-)
20 --- a/arch/arc/kernel/head.S
21 +++ b/arch/arc/kernel/head.S
26 +; Here "patch-dtb" will embed external .dtb
27 +; Note "patch-dtb" searches for ASCII "OWRTDTB:" string
28 +; and pastes .dtb right after it, hense the string precedes
29 +; __image_dtb symbol.
30 + .section .owrt, "aw",@progbits
36 .section .init.text, "ax",@progbits
38 ;----------------------------------------------------------------
39 --- a/arch/arc/kernel/setup.c
40 +++ b/arch/arc/kernel/setup.c
41 @@ -444,7 +444,7 @@ ignore_uboot_args:
44 if (use_embedded_dtb) {
45 - machine_desc = setup_machine_fdt(__dtb_start);
46 + machine_desc = setup_machine_fdt(&__image_dtb);
48 panic("Embedded DT invalid\n");
50 @@ -460,6 +460,8 @@ ignore_uboot_args:
54 +extern struct boot_param_header __image_dtb;
56 void __init setup_arch(char **cmdline_p)
59 --- a/arch/arc/kernel/vmlinux.lds.S
60 +++ b/arch/arc/kernel/vmlinux.lds.S
61 @@ -30,6 +30,19 @@ SECTIONS
63 . = CONFIG_LINUX_LINK_BASE;
66 + * In OpenWRT we want to patch built binary embedding .dtb of choice.
67 + * This is implemented with "patch-dtb" utility which searches for
68 + * "OWRTDTB:" string in first 16k of image and if it is found
69 + * copies .dtb right after mentioned string.
71 + * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it.
75 + . = ALIGN(PAGE_SIZE);
78 _int_vec_base_lds = .;