[U-Boot] [PATCH 1/2] Allow board specific overwriting of library code

Michael Roth mroth at nessie.de
Wed Feb 4 15:29:58 CET 2009


Enables to overwrite any library code by defining EXTRABOARDOBJS
in the board specific config.mk.
Those listed object files get linked directly into the u-boot binary
right after the start objects and before any archives.

Signed-off-by: Michael Roth <mroth at nessie.de>
---
 Makefile |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 787c5f2..50c9975 100644
--- a/Makefile
+++ b/Makefile
@@ -273,6 +273,8 @@ LIBS := $(addprefix $(obj),$(LIBS))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+EXTRABOARDOBJS := $(addprefix $(obj)board/$(BOARDDIR)/,$(EXTRABOARDOBJS))
+
 # Add GCC lib
 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
 
@@ -294,7 +296,7 @@ ONENAND_IPL = onenand_ipl
 U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
 endif
 
-__OBJS := $(subst $(obj),,$(OBJS))
+__OBJS := $(subst $(obj),,$(OBJS)) $(subst $(obj),,$(EXTRABOARDOBJS))
 __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
 #########################################################################
@@ -338,7 +340,8 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
 $(obj)u-boot.dis:	$(obj)u-boot
 		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot:		depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
+$(obj)u-boot:		depend $(SUBDIRS) $(OBJS) $(EXTRABOARDOBJS) \
+			$(LIBBOARD) $(LIBS) $(LDSCRIPT)
 		UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
 		sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
 		cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
@@ -348,6 +351,11 @@ $(obj)u-boot:		depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
 $(OBJS):	depend $(obj)include/autoconf.mk
 		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
+$(EXTRABOARDOBJS):	depend $(obj)include/autoconf.mk
+		$(MAKE) -C $(dir $(subst $(obj),,$@)) \
+			$(if $(REMOTE_BUILD), \
+				$(EXTRABOARDOBJS),$(notdir $(EXTRABOARDOBJS)))
+
 $(LIBS):	depend $(obj)include/autoconf.mk $(SUBDIRS)
 		$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-- 
1.6.0.6



More information about the U-Boot mailing list