kernel: bump 4.14 to 4.14.104
[openwrt/staging/wigyori.git] / target / linux / generic / pending-4.14 / 332-arc-add-OWRTDTB-section.patch
1 From: Alexey Brodkin <abrodkin@synopsys.com>
2 Subject: openwrt: arc - add OWRTDTB section
3
4 This change allows OpenWRT to patch resulting kernel binary with
5 external .dtb.
6
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).
9
10 ""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external
11 .dtb right after it, keeping the string in place.
12
13 Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
14 ---
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(-)
19
20 --- a/arch/arc/kernel/head.S
21 +++ b/arch/arc/kernel/head.S
22 @@ -59,6 +59,16 @@
23 #endif
24 .endm
25
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
31 + .ascii "OWRTDTB:"
32 +ENTRY(__image_dtb)
33 + .fill 0x4000
34 +END(__image_dtb)
35 +
36 .section .init.text, "ax",@progbits
37
38 ;----------------------------------------------------------------
39 --- a/arch/arc/kernel/setup.c
40 +++ b/arch/arc/kernel/setup.c
41 @@ -469,7 +469,7 @@ ignore_uboot_args:
42 #endif
43
44 if (use_embedded_dtb) {
45 - machine_desc = setup_machine_fdt(__dtb_start);
46 + machine_desc = setup_machine_fdt(&__image_dtb);
47 if (!machine_desc)
48 panic("Embedded DT invalid\n");
49 }
50 @@ -485,6 +485,8 @@ ignore_uboot_args:
51 }
52 }
53
54 +extern struct boot_param_header __image_dtb;
55 +
56 void __init setup_arch(char **cmdline_p)
57 {
58 handle_uboot_args();
59 --- a/arch/arc/kernel/vmlinux.lds.S
60 +++ b/arch/arc/kernel/vmlinux.lds.S
61 @@ -30,6 +30,19 @@ SECTIONS
62
63 . = CONFIG_LINUX_LINK_BASE;
64
65 + /*
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.
70 + *
71 + * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it.
72 + */
73 + .owrt : {
74 + *(.owrt)
75 + . = ALIGN(PAGE_SIZE);
76 + }
77 +
78 _int_vec_base_lds = .;
79 .vector : {
80 *(.vector)