mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/2] scripts: gen-dtb-s: reference OF IMD entries automatically
@ 2023-04-04 10:17 Ahmad Fatoum
  2023-04-04 10:17 ` [PATCH v2 2/2] treewide: remove no-longer needed IMD_USED_OF Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ahmad Fatoum @ 2023-04-04 10:17 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We currently require IMD_OF_USED to get the DT compatible into the
barebox image data meta section. As the PBL is already referencing the
DT to pass it along to barebox proper, let's add a reference from the DT
to the image data section to make IMD_OF_USED unnecessary.

Suggested-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
--
v1 -> v2:
  - use dword, to fix build for 64-bit (Sascha)
  - place IMD reference before STRUCT_ALIGNMENT
---
 scripts/gen-dtb-s | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index c5c46a4d8675..6309a814a483 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -49,6 +49,9 @@ echo "__dtb_${name}_start:"
 echo ".incbin \"$dtb\""
 echo "__dtb_${name}_end:"
 echo ".global __dtb_${name}_end"
+if [ "$imd" = "y" ]; then
+	echo ".dword __barebox_imd_OF_${name}"
+fi
 echo ".balign STRUCT_ALIGNMENT"
 
 compressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb.z)
@@ -65,5 +68,8 @@ printf ".int 0x%08x\n"  $uncompressed
 echo ".incbin \"$dtb.z\""
 echo "__dtb_z_${name}_end:"
 echo ".global __dtb_z_${name}_end"
+if [ "$imd" = "y" ]; then
+	echo ".dword __barebox_imd_OF_${name}"
+fi
 echo ".balign STRUCT_ALIGNMENT"
 echo "#endif"
-- 
2.39.2




^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH] fixup! scripts: gen-dtb-s: reference OF IMD entries automatically
@ 2023-04-14 14:11 Ahmad Fatoum
  2023-04-17  7:00 ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2023-04-14 14:11 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While the reference is just there, so linker garbage collection doesn't
remove it, it's still a reference and it will be relocated.

This means it must be aligned, otherwise we will crash doing an unaligned
access during relocation if device tree size isn't evenly divisible by
pointer length...

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/gen-dtb-s | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 6a624e0bd5d0..f6fa1525933e 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -51,6 +51,7 @@ echo ".incbin \"$dtb\""
 echo "__dtb_${name}_end:"
 echo ".global __dtb_${name}_end"
 if [ "$imd" = "y" ]; then
+	echo ".balign ASM_SZPTR"
 	echo "ASM_PTR __barebox_imd_OF_${name}"
 fi
 echo ".balign STRUCT_ALIGNMENT"
@@ -70,6 +71,7 @@ echo ".incbin \"$dtb.z\""
 echo "__dtb_z_${name}_end:"
 echo ".global __dtb_z_${name}_end"
 if [ "$imd" = "y" ]; then
+	echo ".balign ASM_SZPTR"
 	echo "ASM_PTR __barebox_imd_OF_${name}"
 fi
 echo ".balign STRUCT_ALIGNMENT"
-- 
2.39.2




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

end of thread, other threads:[~2023-04-17  7:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 10:17 [PATCH v2 1/2] scripts: gen-dtb-s: reference OF IMD entries automatically Ahmad Fatoum
2023-04-04 10:17 ` [PATCH v2 2/2] treewide: remove no-longer needed IMD_USED_OF Ahmad Fatoum
2023-04-11 13:10 ` [PATCH v2 1/2] scripts: gen-dtb-s: reference OF IMD entries automatically Sascha Hauer
2023-04-12 10:58 ` Sascha Hauer
2023-04-12 11:22   ` [PATCH] fixup! " Ahmad Fatoum
2023-04-12 14:12     ` Sascha Hauer
2023-04-13  7:26     ` Sascha Hauer
2023-04-14 14:11 Ahmad Fatoum
2023-04-17  7:00 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox