All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: zboot: put appended dtb into a section
@ 2020-10-26 12:29 Chuanhong Guo
  2020-10-26 13:11 ` John Thomson
  2020-11-06 10:48 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Chuanhong Guo @ 2020-10-26 12:29 UTC (permalink / raw)
  To: linux-mips; +Cc: Chuanhong Guo, Thomas Bogendoerfer, John Thomson, open list

This will make a separated section for dtb appear in ELF, and we can
then use objcopy to patch a dtb into vmlinuz when RAW_APPENDED_DTB
is set in kernel config.

command to patch a dtb:
objcopy --set-section-flags=.appended_dtb=alloc,contents \
        --update-section=.appended_dtb=<target>.dtb vmlinuz

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
---
Note:
This should supersede this patch on linux-mips:
[2/2] mips: boot compressed: add support for vlinuz ELF DTB [0]

[0] https://patchwork.kernel.org/project/linux-mips/patch/20201015201100.4130-2-git@johnthomson.fastmail.com.au/
 
 arch/mips/boot/compressed/ld.script | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 2ed08fbef8e7..0ebb667274d6 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -31,9 +31,12 @@ SECTIONS
 		CONSTRUCTORS
 		. = ALIGN(16);
 	}
-	__appended_dtb = .;
-	/* leave space for appended DTB */
-	. += 0x100000;
+
+	.appended_dtb : {
+		__appended_dtb = .;
+		/* leave space for appended DTB */
+		. += 0x100000;
+	}
 
 	_edata = .;
 	/* End of data section */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: zboot: put appended dtb into a section
  2020-10-26 12:29 [PATCH] MIPS: zboot: put appended dtb into a section Chuanhong Guo
@ 2020-10-26 13:11 ` John Thomson
  2020-11-06 10:48 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: John Thomson @ 2020-10-26 13:11 UTC (permalink / raw)
  To: Chuanhong Guo, linux-mips; +Cc: Thomas Bogendoerfer, open list

On Mon, 26 Oct 2020, at 12:29, Chuanhong Guo wrote:
> This will make a separated section for dtb appear in ELF, and we can
> then use objcopy to patch a dtb into vmlinuz when RAW_APPENDED_DTB
> is set in kernel config.

Thank you Chuanhong Guo, this worked for me.

I have successfully network boot tested this change on ath79 hardware:
- kernel vmlinuz.bin
  then appended DTB, and packed into a uImage (out of kernel tree)
- kernel vmlinuz
  then updated ELF DTB appended_dtb section, and ELF booted

Cheers,
-- 
  John Thomson

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: zboot: put appended dtb into a section
  2020-10-26 12:29 [PATCH] MIPS: zboot: put appended dtb into a section Chuanhong Guo
  2020-10-26 13:11 ` John Thomson
@ 2020-11-06 10:48 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-06 10:48 UTC (permalink / raw)
  To: Chuanhong Guo; +Cc: linux-mips, John Thomson, open list

On Mon, Oct 26, 2020 at 08:29:25PM +0800, Chuanhong Guo wrote:
> This will make a separated section for dtb appear in ELF, and we can
> then use objcopy to patch a dtb into vmlinuz when RAW_APPENDED_DTB
> is set in kernel config.
> 
> command to patch a dtb:
> objcopy --set-section-flags=.appended_dtb=alloc,contents \
>         --update-section=.appended_dtb=<target>.dtb vmlinuz
> 
> Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
> ---
> Note:
> This should supersede this patch on linux-mips:
> [2/2] mips: boot compressed: add support for vlinuz ELF DTB [0]
> 
> [0] https://patchwork.kernel.org/project/linux-mips/patch/20201015201100.4130-2-git@johnthomson.fastmail.com.au/
>  
>  arch/mips/boot/compressed/ld.script | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-06 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 12:29 [PATCH] MIPS: zboot: put appended dtb into a section Chuanhong Guo
2020-10-26 13:11 ` John Thomson
2020-11-06 10:48 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.