From 2d2b994a30bb100774dc747ae9865b7f95285a88 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 31 Mar 2008 10:51:37 +0200 Subject: [PATCH] POST: move CONFIG_POST to Makefiles Introduce the new logical option CONFIG_HAS_POST which is set when the platform has CONFIG_POST set. Use CONFIG_HAS_POST in the post/ Makefiles to determine should the POST libs be compiled for the selected target platform, or not. To avoid breaking u-boot linking process, the empty post/libpost.a file is created for platforms which do not have POSTs. Signed-off-by: Yuri Tikhonov Signed-off-by: Wolfgang Denk --- Makefile | 10 +------- include/common.h | 11 +++++++++ post/Makefile | 47 ++++++++++++++++++++++++++++++++++---- post/board/lwmon5/Makefile | 3 ++- post/cpu/ppc4xx/Makefile | 5 ++-- post/drivers/Makefile | 6 ++--- post/lib_ppc/Makefile | 11 ++++----- post/lib_ppc/fpu/Makefile | 6 ++--- post/rules.mk | 2 ++ 9 files changed, 72 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 4fde69967a..b2b59b2300 100644 --- a/Makefile +++ b/Makefile @@ -233,18 +233,10 @@ LIBS += drivers/rtc/librtc.a LIBS += drivers/serial/libserial.a LIBS += drivers/usb/libusb.a LIBS += drivers/video/libvideo.a -LIBS += post/libpost.a post/drivers/libpostdrivers.a -LIBS += $(shell if [ -d post/lib_$(ARCH) ]; then echo \ - "post/lib_$(ARCH)/libpost$(ARCH).a"; fi) -LIBS += $(shell if [ -d post/lib_$(ARCH)/fpu ]; then echo \ - "post/lib_$(ARCH)/fpu/libpost$(ARCH)fpu.a"; fi) -LIBS += $(shell if [ -d post/cpu/$(CPU) ]; then echo \ - "post/cpu/$(CPU)/libpost$(CPU).a"; fi) -LIBS += $(shell if [ -d post/board/$(BOARDDIR) ]; then echo \ - "post/board/$(BOARDDIR)/libpost$(BOARD).a"; fi) LIBS += common/libcommon.a LIBS += libfdt/libfdt.a LIBS += api/libapi.a +LIBS += post/libpost.a LIBS := $(addprefix $(obj),$(LIBS)) .PHONY : $(LIBS) $(VERSION_FILE) diff --git a/include/common.h b/include/common.h index 673afdd150..8d435b97f4 100644 --- a/include/common.h +++ b/include/common.h @@ -672,4 +672,15 @@ void inline show_boot_progress (int val); #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +/* Multicore arch functions */ +#ifdef CONFIG_MP +int cpu_status(int nr); +int cpu_reset(int nr); +int cpu_release(int nr, int argc, char *argv[]); +#endif + +#ifdef CONFIG_POST +#define CONFIG_HAS_POST +#endif + #endif /* __COMMON_H_ */ diff --git a/post/Makefile b/post/Makefile index f32af95162..02b51544c2 100644 --- a/post/Makefile +++ b/post/Makefile @@ -21,11 +21,50 @@ # MA 02111-1307 USA # +include $(TOPDIR)/include/autoconf.mk -SUBDIRS = drivers cpu lib_$(ARCH) board/$(BOARDDIR) +LIB = libpost.a +GPLIB-$(CONFIG_HAS_POST) += libgenpost.a +COBJS-$(CONFIG_HAS_POST) += post.o tests.o -LIB = libpost.a +SPLIB-$(CONFIG_HAS_POST) = drivers/libpostdrivers.a +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH) ]; then echo \ + "lib_$(ARCH)/libpost$(ARCH).a"; fi) +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH)/fpu ]; then echo \ + "lib_$(ARCH)/fpu/libpost$(ARCH)fpu.a"; fi) +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d cpu/$(CPU) ]; then echo \ + "cpu/$(CPU)/libpost$(CPU).a"; fi) +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d board/$(BOARD) ]; then echo \ + "board/$(BOARD)/libpost$(BOARD).a"; fi) -COBJS = post.o tests.o +GPLIB := $(GPLIB-y) +SPLIB := $(SPLIB-y) +COBJS := $(COBJS-y) +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +LIB := $(obj)$(LIB) -include $(TOPDIR)/post/rules.mk +all: $(LIB) + +# generic POST library +$(GPLIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +# specific POST libraries +$(SPLIB): $(obj).depend + $(MAKE) -C $(dir $(subst $(obj),,$@)) + +# the POST lib archive +$(LIB): $(GPLIB) $(SPLIB) + (echo create $(LIB); for lib in $(GPLIB) $(SPLIB) ; \ + do echo addlib $$lib; done; echo save) \ + | $(AR) -M + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile index 5a92d1ce73..3cb6426e4d 100644 --- a/post/board/lwmon5/Makefile +++ b/post/board/lwmon5/Makefile @@ -20,9 +20,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA +include $(TOPDIR)/include/autoconf.mk LIB = libpostlwmon5.a -COBJS = sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o +COBJS-$(CONFIG_HAS_POST) += sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o include $(TOPDIR)/post/rules.mk diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile index e3f44b7774..7b13413b9d 100644 --- a/post/cpu/ppc4xx/Makefile +++ b/post/cpu/ppc4xx/Makefile @@ -20,10 +20,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # +include $(TOPDIR)/include/autoconf.mk LIB = libpostppc4xx.a -AOBJS = cache_4xx.o -COBJS = cache.o denali_ecc.o ether.o fpu.o spr.o uart.o watchdog.o +AOBJS-$(CONFIG_HAS_POST) += cache_4xx.o +COBJS-$(CONFIG_HAS_POST) += cache.o denali_ecc.o ether.o fpu.o spr.o uart.o watchdog.o include $(TOPDIR)/post/rules.mk diff --git a/post/drivers/Makefile b/post/drivers/Makefile index cb2f1deacd..0b6cdf58c9 100644 --- a/post/drivers/Makefile +++ b/post/drivers/Makefile @@ -20,12 +20,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - - -SUBDIRS = +include $(TOPDIR)/config.mk LIB = libpostdrivers.a -COBJS = i2c.o memory.o rtc.o +COBJS-$(CONFIG_HAS_POST) += i2c.o memory.o rtc.o include $(TOPDIR)/post/rules.mk diff --git a/post/lib_ppc/Makefile b/post/lib_ppc/Makefile index 9f1b329d70..bd7a232992 100644 --- a/post/lib_ppc/Makefile +++ b/post/lib_ppc/Makefile @@ -20,14 +20,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - -SUBDIRS = fpu +include $(TOPDIR)/config.mk LIB = libpostppc.a -AOBJS = asm.o -COBJS = cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o -COBJS += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o -COBJS += store.o load.o cr.o b.o multi.o string.o complex.o +AOBJS-$(CONFIG_HAS_POST) += asm.o +COBJS-$(CONFIG_HAS_POST) += cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o +COBJS-$(CONFIG_HAS_POST) += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o +COBJS-$(CONFIG_HAS_POST) += store.o load.o cr.o b.o multi.o string.o complex.o include $(TOPDIR)/post/rules.mk diff --git a/post/lib_ppc/fpu/Makefile b/post/lib_ppc/fpu/Makefile index 82646c80d6..db435931d8 100644 --- a/post/lib_ppc/fpu/Makefile +++ b/post/lib_ppc/fpu/Makefile @@ -20,12 +20,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - +include $(TOPDIR)/config.mk LIB = libpostppcfpu.a -COBJS += fpu.o 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o -COBJS += acc1.o compare-fp-1.o mul-subnormal-single-1.o +COBJS-$(CONFIG_HAS_POST) += fpu.o 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o +COBJS-$(CONFIG_HAS_POST) += acc1.o compare-fp-1.o mul-subnormal-single-1.o include $(TOPDIR)/post/rules.mk diff --git a/post/rules.mk b/post/rules.mk index e2c73c6004..94e72bec62 100644 --- a/post/rules.mk +++ b/post/rules.mk @@ -23,6 +23,8 @@ include $(TOPDIR)/config.mk +COBJS := $(COBJS-y) +AOBJS := $(AOBJS-y) SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) LIB := $(obj)$(LIB) -- 2.39.2