Fix sequoia separate object direcory building problems.
authorMarian Balakowicz <m8@semihalf.com>
Mon, 23 Oct 2006 20:17:05 +0000 (22:17 +0200)
committerMarian Balakowicz <m8@semihalf.com>
Mon, 23 Oct 2006 20:17:05 +0000 (22:17 +0200)
CHANGELOG
Makefile
board/amcc/sequoia/Makefile
board/amcc/sequoia/config.mk
nand_spl/board/amcc/sequoia/Makefile

index 727a7b691d59a8f07d990f5e200473fc4f7ba3c7..ed6396df8fe8e1f8bb5a464a4f05d0f06e6c7fe5 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,8 @@
 Changes for U-Boot 1.1.5:
 ======================================================================
 
+* Fix sequoia separate object direcory building problems.
+
 * Cleanup compile warnings. Prepare for release 1.1.5
 
 * Fix compile problem in include/configs/ep82xxm.h
index 92034947962ad328dbf1fdba3042f4868aaa5017..e6d044adc5291e6f28075d108bd77ea00ff10939 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -269,10 +269,10 @@ $(SUBDIRS):
                $(MAKE) -C $@ all
 
 $(NAND_SPL):   version
-               $(MAKE) -C nand_spl all
+               $(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
 $(U_BOOT_NAND):        $(NAND_SPL) $(obj)u-boot.bin
-               cat nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
+               cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
 
 version:
                @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
@@ -1146,19 +1146,22 @@ PPChameleonEVB_HI_33_config:    unconfig
        @$(MKCONFIG) -a $(call xtract_4xx,$@) ppc ppc4xx PPChameleonEVB dave
 
 rainier_config:        unconfig
-       @echo "#define CONFIG_RAINIER" > include/config.h
+       @mkdir -p $(obj)include
+       @echo "#define CONFIG_RAINIER" > $(obj)include/config.h
        @echo "Configuring for rainier board as subset of sequoia..."
        @$(MKCONFIG) -a sequoia ppc ppc4xx sequoia amcc
 
 rainier_nand_config:   unconfig
-       @echo "#define CONFIG_RAINIER" > include/config.h
+       @mkdir -p $(obj)include
+       @mkdir -p $(obj)nand_spl
+       @mkdir -p $(obj)board/amcc/sequoia
+       @echo "#define CONFIG_RAINIER" > $(obj)include/config.h
        @echo "Configuring for rainier board as subset of sequoia..."
-       @ln -s board/amcc/sequoia/Makefile nand_spl/Makefile
-       @echo "#define CONFIG_NAND_U_BOOT" >> include/config.h
+       @echo "#define CONFIG_NAND_U_BOOT" >> $(obj)include/config.h
        @echo "Compile NAND boot image for sequoia"
        @$(MKCONFIG) -a sequoia ppc ppc4xx sequoia amcc
-       @echo "TEXT_BASE = 0x01000000" >board/amcc/sequoia/config.tmp
-       @echo "CONFIG_NAND_U_BOOT = y" >> include/config.mk
+       @echo "TEXT_BASE = 0x01000000" > $(obj)board/amcc/sequoia/config.tmp
+       @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
 
 sbc405_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx sbc405
@@ -1167,12 +1170,14 @@ sequoia_config: unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx sequoia amcc
 
 sequoia_nand_config:   unconfig
-       @ln -s board/amcc/sequoia/Makefile nand_spl/Makefile
-       @echo "#define CONFIG_NAND_U_BOOT" >include/config.h
+       @mkdir -p $(obj)include
+       @mkdir -p $(obj)nand_spl
+       @mkdir -p $(obj)board/amcc/sequoia
+       @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
        @echo "Compile NAND boot image for sequoia"
        @$(MKCONFIG) -a sequoia ppc ppc4xx sequoia amcc
-       @echo "TEXT_BASE = 0x01000000" >board/amcc/sequoia/config.tmp
-       @echo "CONFIG_NAND_U_BOOT = y" >> include/config.mk
+       @echo "TEXT_BASE = 0x01000000" > $(obj)board/amcc/sequoia/config.tmp
+       @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
 
 sycamore_config:       unconfig
        @echo "Configuring for sycamore board as subset of walnut..."
@@ -2244,8 +2249,7 @@ clean:
        rm -f $(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom
        rm -f $(obj)board/integratorap/u-boot.lds $(obj)board/integratorcp/u-boot.lds
        rm -f $(obj)include/bmp_logo.h
-       find nand_spl -lname "*" -print | xargs rm -f
-       rm -f nand_spl/u-boot-spl nand_spl/u-boot-spl.map
+       rm -f $(obj)nand_spl/u-boot-spl $(obj)nand_spl/u-boot-spl.map
 
 clobber:       clean
        find $(OBJTREE) -type f \( -name .depend \
@@ -2258,6 +2262,7 @@ clobber:  clean
        rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
        rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
        rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
+       [ ! -d $(OBJTREE)/nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f
 
 ifeq ($(OBJTREE),$(SRCTREE))
 mrproper \
index 9c1be0e43757915c59a588f54616408a6ca7455f..06ef7f93317fe7c9d5192ee9b6f1f2cd8790e638 100644 (file)
@@ -22,7 +22,6 @@
 #
 
 include $(TOPDIR)/config.mk
-include $(TOPDIR)/include/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
index 7713a72be85dd483bbaf1392acd06445784824f8..e62b8d30e41e09d70481af20dc1c294b02e69c20 100644 (file)
@@ -24,7 +24,7 @@
 # AMCC 440EPx Reference Platform (Sequoia) board
 #
 
-sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
 
 ifndef TEXT_BASE
 TEXT_BASE = 0xFFFA0000
index 897aa8b6b70ca446a0d0f90c900d79131180a248..a71f583eddbeca5836339058c45204575ebc6646 100644 (file)
@@ -22,9 +22,9 @@
 #
 
 include $(TOPDIR)/config.mk
-include board/$(BOARDDIR)/config.mk
+include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
-LDSCRIPT= board/$(BOARDDIR)/u-boot.lds
+LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
 LDFLAGS        = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
 AFLAGS += -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_NAND_SPL
@@ -32,49 +32,65 @@ CFLAGS      += -DCONFIG_NAND_SPL
 SOBJS  = start.o init.o resetvec.o
 COBJS  = nand_boot.o ndfc.o sdram.o
 
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS := $(SOBJS) $(COBJS)
+LNDIR  := $(OBJTREE)/nand_spl/board/$(BOARDDIR)
 
-ALL    = u-boot-spl u-boot-spl.bin u-boot-spl-16k.bin
+nandobj        := $(OBJTREE)/nand_spl/
+
+ALL    = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
 
 all:   $(obj).depend $(ALL)
 
-u-boot-spl-16k.bin: u-boot-spl
+$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
        $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
 
-u-boot-spl.bin:        u-boot-spl
+$(nandobj)u-boot-spl.bin:      $(nandobj)u-boot-spl
        $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
 
-u-boot-spl:    $(OBJS)
-       $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
-               -Map u-boot-spl.map -o u-boot-spl
+$(nandobj)u-boot-spl:  $(OBJS)
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
+               -Map $(nandobj)u-boot-spl.map \
+               -o $(nandobj)u-boot-spl
 
 # create symbolic links for common files
 
 # from cpu directory
-ndfc.c:
-       @rm -f ndfc.c
-       ln -s ../cpu/ppc4xx/ndfc.c ndfc.c
+$(obj)ndfc.c:
+       @rm -f $(obj)ndfc.c
+       ln -s $(SRCTREE)/cpu/ppc4xx/ndfc.c $(obj)ndfc.c
 
-resetvec.S:
-       @rm -f resetvec.S
-       ln -s ../cpu/ppc4xx/resetvec.S resetvec.S
+$(obj)resetvec.S:
+       @rm -f $(obj)resetvec.S
+       ln -s $(SRCTREE)/cpu/ppc4xx/resetvec.S $(obj)resetvec.S
 
-start.S:
-       @rm -f start.S
-       ln -s ../cpu/ppc4xx/start.S start.S
+$(obj)start.S:
+       @rm -f $(obj)start.S
+       ln -s $(SRCTREE)/cpu/ppc4xx/start.S $(obj)start.S
 
 # from board directory
-init.S:
-       @rm -f init.S
-       ln -s ../board/amcc/sequoia/init.S init.S
+$(obj)init.S:
+       @rm -f $(obj)init.S
+       ln -s $(SRCTREE)/board/amcc/sequoia/init.S $(obj)init.S
+
+$(obj)sdram.c:
+       @rm -f $(obj)sdram.c
+       ln -s $(SRCTREE)/board/amcc/sequoia/sdram.c $(obj)sdram.c
 
-sdram.c:
-       @rm -f sdram.c
-       ln -s ../board/amcc/sequoia/sdram.c sdram.c
+# from nand_spl directory
+$(obj)nand_boot.c:
+       @rm -f $(obj)nand_boot.c
+       ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
 
 #########################################################################
 
+$(obj)%.o:     $(obj)%.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o:     $(obj)%.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
 # defines $(obj).depend target
 include $(SRCTREE)/rules.mk