developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 1 | From 7d1531c81c0fb4c93bea8dc316043ad0e4d0c270 Mon Sep 17 00:00:00 2001 |
| 2 | From: Chuanhong Guo <gch981213@gmail.com> |
| 3 | Date: Sun, 25 Oct 2020 23:19:40 +0800 |
| 4 | Subject: [PATCH] MIPS: zboot: put appended dtb into a section |
| 5 | |
| 6 | This will make a separated section for dtb appear in ELF, and we can |
| 7 | then use objcopy to patch a dtb into vmlinuz when RAW_APPENDED_DTB |
| 8 | is set in kernel config. |
| 9 | |
| 10 | command to patch a dtb: |
| 11 | objcopy --set-section-flags=.appended_dtb=alloc,contents \ |
| 12 | --update-section=.appended_dtb=<target>.dtb vmlinuz vmlinuz-dtb |
| 13 | |
| 14 | Signed-off-by: Chuanhong Guo <gch981213@gmail.com> |
| 15 | --- |
| 16 | arch/mips/boot/compressed/ld.script | 9 ++++++--- |
| 17 | 1 file changed, 6 insertions(+), 3 deletions(-) |
| 18 | |
| 19 | --- a/arch/mips/boot/compressed/ld.script |
| 20 | +++ b/arch/mips/boot/compressed/ld.script |
| 21 | @@ -31,9 +31,12 @@ SECTIONS |
| 22 | CONSTRUCTORS |
| 23 | . = ALIGN(16); |
| 24 | } |
| 25 | - __appended_dtb = .; |
| 26 | - /* leave space for appended DTB */ |
| 27 | - . += 0x100000; |
| 28 | + |
| 29 | + .appended_dtb : { |
| 30 | + __appended_dtb = .; |
| 31 | + /* leave space for appended DTB */ |
| 32 | + . += 0x100000; |
| 33 | + } |
| 34 | |
| 35 | _edata = .; |
| 36 | /* End of data section */ |