[PATCH 2/3] sandbox: fix race with .old_version removal

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Nov 28 02:41:27 PST 2025


From: Ahmad Fatoum <a.fatoum at barebox.org>

On sandbox, .old_version is created and removed by the barebox.o recipe
and the barebox ELF itself is never built and instead it's a symlink
created by the barebox__ rule override.

Drop the rm -f .old_version in that case, so the file is not removed too soon.

A cleaner way would be to factor this logic out to a shell script like
Linux does as it's serialized anyway and there's no benefit of having
the steps as make targets, but that's left as future exercise.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 2534fb4b467b..f958114480f9 100644
--- a/Makefile
+++ b/Makefile
@@ -1083,7 +1083,9 @@ PHONY += check
 # ---------------------------------------------------------------------------
 barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE
 	$(call if_changed_rule,barebox__)
+ifeq ($(BAREBOX_PROPER),barebox)
 	$(Q)rm -f .old_version
+endif
 
 barebox.fit: images/barebox-$(CONFIG_ARCH_LINUX_NAME).fit
 	$(Q)ln -fsn $< $@
-- 
2.47.3




More information about the barebox mailing list