summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/pbl.lds.S
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 20:00:11 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:06 +0100
commit742e78976dd4799b029dbbab596376f42fb1ee91 (patch)
treea431d8e833bffb5dd87ba8cd22104c685c2e67e7 /arch/arm/lib/pbl.lds.S
parent3919cc4b29960aca0c0ec559d4f91cb33a5631c4 (diff)
downloadbarebox-742e78976dd4799b029dbbab596376f42fb1ee91.tar.gz
barebox-742e78976dd4799b029dbbab596376f42fb1ee91.tar.xz
ARM64: add optional EFI stub
While very recent binutils releases have dedicated efi-*-aarch targets, we may want to support older toolchains. For this reason, we import the kernel's EFI stub PE fakery, so the same barebox-dt-2nd.img may be loaded as if it were a "normal" or an EFI-stubbed kernel. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-87-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/pbl.lds.S')
-rw-r--r--arch/arm/lib/pbl.lds.S31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index cafb27b2d5..ec7296f0fb 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -3,8 +3,27 @@
#include <linux/sizes.h>
#include <asm/barebox.lds.h>
+#include <asm/memory.h>
#include <asm-generic/memory_layout.h>
#include <asm-generic/pointer.h>
+#include <asm/memory.h>
+
+/*
+ * The size of the PE/COFF section that covers the barebox image, which
+ * runs from _stext to _edata, must be a round multiple of the PE/COFF
+ * FileAlignment, which we set to its minimum value of 0x200. '_stext'
+ * itself must be 4 KB aligned, because that's what the adrp instructions
+ * expects, so padding out _edata to a 0x200 aligned boundary should be
+ * sufficient.
+ */
+PECOFF_FILE_ALIGNMENT = 0x200;
+
+#ifdef CONFIG_EFI_STUB
+#define PECOFF_EDATA_PADDING \
+ .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
+#else
+#define PECOFF_EDATA_PADDING
+#endif
#ifdef CONFIG_PBL_RELOCATABLE
#define BASE 0x0
@@ -62,7 +81,9 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
+ . = ALIGN(PBL_SEGMENT_ALIGN);
_etext = .; /* End of text and rodata section */
+ _sdata = .;
. = ALIGN(4);
.data : { *(.data*) }
@@ -109,6 +130,16 @@ SECTIONS
}
__pblext_end = .;
+ PECOFF_EDATA_PADDING
+
+ __pecoff_data_rawsize = ABSOLUTE(. - _etext);
+
+ /* .bss is dwarfed by piggydata size, so we just handle .bss
+ * as normal PE data
+ */
+
+ __pecoff_data_size = ABSOLUTE(. - _etext);
+
.image_end : { KEEP(*(.__image_end)) }
pbl_image_size = . - BASE;