[RFC PATCH 03/11] ARM: dls: Add ENTRY_HEADER macro to add .text section

Jules Maselbas jmaselbas at zdiv.net
Wed May 10 16:37:03 PDT 2023


On sunxi platforms the boot rom (BROM) looks for a specific header which
will also be loaded in memory, causing pbl, or barebox, image not loaded
at the expected BASE addresse. This also cause an issue with relocatable
pbl: instruction used for relocation expect the image to be aligned on a
4K page boundary.

The proposed solution here is to allow to specify custom sections to put
in the very begging of the .text section.
---
 arch/arm/lib/pbl.lds.S            | 1 +
 include/asm-generic/barebox.lds.h | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index 114ec7bc81..6fc97c6c34 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -27,6 +27,7 @@ SECTIONS
 	.text      :
 	{
 		_stext = .;
+		ENTRY_HEADER
 		*(.text_head_prologue*)
 		*(.text_head_entry*)
 		__bare_init_start = .;
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index d3736ebaed..9915ead8a7 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -12,6 +12,10 @@
 #define PRE_IMAGE
 #endif
 
+#ifndef ENTRY_HEADER
+#define ENTRY_HEADER
+#endif
+
 #define BAREBOX_INITCALLS			\
 	STRUCT_ALIGN();				\
 	__barebox_initcalls_start = .;		\
-- 
2.40.0




More information about the barebox mailing list