[PATCH 01/21] pbl: add provision for architectures without piggy loader
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Jun 5 04:35:10 PDT 2025
In preparation for enabling PBL support on sandbox, allow sandbox to
link directly PBL with barebox proper without requiring PBL to use mmap
to change attributes.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
images/Makefile | 11 +++++++----
pbl/Kconfig | 8 ++++++++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/images/Makefile b/images/Makefile
index 6daaee8b7c7e..91123ada4744 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -56,21 +56,24 @@ extra-y += $(pbl-lds)
$(pbl-lds): $(obj)/../arch/$(SRCARCH)/lib/pbl.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
+ifeq ($(CONFIG_PBL_IMAGE_NO_PIGGY),)
+BAREBOX_PIGGY_OBJS = $(obj)/piggy.o $(obj)/sha_sum.o
+endif
+
quiet_cmd_elf__ ?= LD $@
cmd_elf__ ?= $(LD) $(LDFLAGS_$(patsubst .%,%,$(suffix $(@F)))) \
-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \
--gc-sections --defsym=__pbl_board_entry=$(2) \
-T $(pbl-lds) \
- --whole-archive $(BAREBOX_PBL_OBJS) $(obj)/piggy.o \
- $(obj)/sha_sum.o
+ --whole-archive $(BAREBOX_PBL_OBJS) $(BAREBOX_PIGGY_OBJS) \
PBL_CPPFLAGS += -fdata-sections -ffunction-sections
-$(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
+$(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(BAREBOX_PIGGY_OBJS) FORCE
$(call if_changed,elf__,$(*F))
$(call if_changed,prelink__)
-$(obj)/%.elf: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
+$(obj)/%.elf: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(BAREBOX_PIGGY_OBJS) FORCE
$(call if_changed,elf__,$(*F))
$(call if_changed,prelink__)
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 6e3581829d58..e9fa35e29b19 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -13,6 +13,14 @@ config PBL_IMAGE
bool "Pre-Bootloader image"
depends on HAVE_PBL_IMAGE
+config PBL_IMAGE_NO_PIGGY
+ bool
+ depends on PBL_IMAGE
+ help
+ This is a special case for architectures that don't
+ want to use the piggy mechanism to load barebox proper.
+ It's so far only intended for sandbox.
+
config PBL_MULTI_IMAGES
bool
select PBL_IMAGE
--
2.39.5
More information about the barebox
mailing list