301-arm-compressed-add-appended-DTB-section.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 0843a61d6913bdac8889eb048ed89f7903059787 Mon Sep 17 00:00:00 2001
  2. From: Robert Marko <[email protected]>
  3. Date: Fri, 30 Oct 2020 13:36:31 +0100
  4. Subject: [PATCH] arm: compressed: add appended DTB section
  5. This adds a appended_dtb section to the ARM decompressor
  6. linker script.
  7. This allows using the existing ARM zImage appended DTB support for
  8. appending a DTB to the raw ELF kernel.
  9. Its size is set to 1MB max to match the zImage appended DTB size limit.
  10. To use it to pass the DTB to the kernel, objcopy is used:
  11. objcopy --set-section-flags=.appended_dtb=alloc,contents \
  12. --update-section=.appended_dtb=<target>.dtb vmlinux
  13. This is based off the following patch:
  14. https://github.com/openwrt/openwrt/commit/c063e27e02a9dcac0e7f5877fb154e58fa3e1a69
  15. Signed-off-by: Robert Marko <[email protected]>
  16. ---
  17. arch/arm/boot/compressed/vmlinux.lds.S | 9 ++++++++-
  18. 1 file changed, 8 insertions(+), 1 deletion(-)
  19. --- a/arch/arm/boot/compressed/vmlinux.lds.S
  20. +++ b/arch/arm/boot/compressed/vmlinux.lds.S
  21. @@ -103,6 +103,13 @@ SECTIONS
  22. _edata = .;
  23. + .appended_dtb : {
  24. + /* leave space for appended DTB */
  25. + . += 0x100000;
  26. + }
  27. +
  28. + _edata_dtb = .;
  29. +
  30. /*
  31. * The image_end section appears after any additional loadable sections
  32. * that the linker may decide to insert in the binary image. Having
  33. @@ -140,4 +147,4 @@ SECTIONS
  34. ARM_ASSERTS
  35. }
  36. -ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");
  37. +ASSERT(_edata_real == _edata_dtb, "error: zImage file size is incorrect");