summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-04-04 12:17:05 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-04-17 09:00:44 +0200
commit5f000f251ba269c395057528a2f100511d29ba04 (patch)
tree078968a44ffc2adb5fe2d295be2631c34e5c507d
parentef9bb93c2a66ecd29015aad5ba527cc986625939 (diff)
downloadbarebox-5f000f251ba269c395057528a2f100511d29ba04.tar.gz
scripts: gen-dtb-s: reference OF IMD entries automatically
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. -- v1 -> v2: - use dword, to fix build for 64-bit (Sascha) - place IMD reference before STRUCT_ALIGNMENT Suggested-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230404101706.2237453-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/asm-generic/pointer.h30
-rwxr-xr-xscripts/gen-dtb-s9
2 files changed, 39 insertions, 0 deletions
diff --git a/include/asm-generic/pointer.h b/include/asm-generic/pointer.h
new file mode 100644
index 0000000000..8b9600b029
--- /dev/null
+++ b/include/asm-generic/pointer.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ASM_GENERIC_PTR_H___
+#define __ASM_GENERIC_PTR_H___
+
+#if __SIZEOF_POINTER__ == 8
+#ifdef __ASSEMBLY__
+#define ASM_PTR .quad
+#define ASM_SZPTR 8
+#define ASM_LGPTR 3
+#else
+#define ASM_PTR ".quad"
+#define ASM_SZPTR "8"
+#define ASM_LGPTR "3"
+#endif
+#elif __SIZEOF_POINTER__ == 4
+#ifdef __ASSEMBLY__
+#define ASM_PTR .word
+#define ASM_SZPTR 4
+#define ASM_LGPTR 2
+#else
+#define ASM_PTR ".word"
+#define ASM_SZPTR "4"
+#define ASM_LGPTR "2"
+#endif
+#else
+#error "Unexpected __SIZEOF_POINTER__"
+#endif
+
+#endif /* __ASM_GENERIC_PTR_H___ */
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index c5c46a4d86..f6fa152593 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -5,6 +5,7 @@ dtb=$2
imd=$3
echo "#include <asm/barebox.lds.h>"
+echo "#include <asm-generic/pointer.h>"
le32() {
printf ".byte 0x%02x, 0x%02x, 0x%02x, 0x%02x\n" \
@@ -49,6 +50,10 @@ echo "__dtb_${name}_start:"
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"
compressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb.z)
@@ -65,5 +70,9 @@ 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 ".balign ASM_SZPTR"
+ echo "ASM_PTR __barebox_imd_OF_${name}"
+fi
echo ".balign STRUCT_ALIGNMENT"
echo "#endif"