diff options
-rw-r--r-- | include/asm-generic/pointer.h | 30 | ||||
-rwxr-xr-x | scripts/gen-dtb-s | 9 |
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" |