OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 | @@ -49,6 +49,16 @@ |
||
23 | 1: |
||
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 | @@ -421,6 +421,8 @@ static inline int is_kernel(unsigned lon |
||
42 | return 0; |
||
43 | } |
||
44 | |||
45 | +extern struct boot_param_header __image_dtb; |
||
46 | + |
||
47 | void __init setup_arch(char **cmdline_p) |
||
48 | { |
||
49 | #ifdef CONFIG_ARC_UBOOT_SUPPORT |
||
50 | @@ -434,7 +436,7 @@ void __init setup_arch(char **cmdline_p) |
||
51 | #endif |
||
52 | { |
||
53 | /* No, so try the embedded one */ |
||
54 | - machine_desc = setup_machine_fdt(__dtb_start); |
||
55 | + machine_desc = setup_machine_fdt(&__image_dtb); |
||
56 | if (!machine_desc) |
||
57 | panic("Embedded DT invalid\n"); |
||
58 | |||
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) |