diff options
Diffstat (limited to 'external')
-rwxr-xr-x | external/common/get_arch.sh (renamed from external/pflash/get_arch.sh) | 0 | ||||
-rw-r--r-- | external/common/rules.mk | 36 | ||||
-rw-r--r-- | external/pflash/Makefile | 26 | ||||
-rw-r--r-- | external/pflash/Makefile.dist | 2 | ||||
-rw-r--r-- | external/pflash/ast.h | 2 | ||||
-rw-r--r-- | external/pflash/rules.mk | 21 | ||||
-rw-r--r-- | external/pflash/sfc-ctrl.h | 9 |
7 files changed, 51 insertions, 45 deletions
diff --git a/external/pflash/get_arch.sh b/external/common/get_arch.sh index 18a5cef2..18a5cef2 100755 --- a/external/pflash/get_arch.sh +++ b/external/common/get_arch.sh diff --git a/external/common/rules.mk b/external/common/rules.mk new file mode 100644 index 00000000..bc565e8e --- /dev/null +++ b/external/common/rules.mk @@ -0,0 +1,36 @@ +ARCH = $(shell $(GET_ARCH) "$(CROSS_COMPILE)") + +ifeq ($(ARCH),ARCH_ARM) +arch = arm +ARCH_OBJS = common/arch_flash_common.o common/arch_flash_arm.o common/ast-sf-ctrl.o +else +ifeq ($(ARCH),ARCH_POWERPC) +arch = powerpc +ARCH_OBJS = common/arch_flash_common.o common/arch_flash_powerpc.o +else +ifeq ($(ARCH),ARCH_X86) +arch = x86 +ARCH_OBJS = common/arch_flash_common.o common/arch_flash_x86.o +else +$(error Unsupported architecture $(ARCH)) +endif +endif +endif + +.PHONY: arch_links +arch_links: + ln -sf ../../hw/ast-bmc/ast-sf-ctrl.c common/ast-sf-ctrl.c + ln -sf arch_flash_$(arch)_io.h common/io.h + +.PHONY: arch_clean +arch_clean: + rm -rf $(ARCH_OBJS) + +#If arch changes make won't realise it needs to rebuild... +.PHONY: .FORCE +common/arch_flash_common.o: common/arch_flash_common.c .FORCE + $(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@ + +common/arch_flash.o: $(ARCH_OBJS) + $(CROSS_COMPILE)ld -r $(ARCH_OBJS) -o $@ + diff --git a/external/pflash/Makefile b/external/pflash/Makefile index 53501e54..f0c3773c 100644 --- a/external/pflash/Makefile +++ b/external/pflash/Makefile @@ -1,9 +1,11 @@ include rules.mk +GET_ARCH = ../../external/common/get_arch.sh +include ../../external/common/rules.mk all: $(EXE) .PHONY: links -links: libflash ccan common sfc-ctrl.c ast-sf-ctrl.c make_version.sh +links: libflash ccan common make_version.sh libflash: ln -sf ../../libflash . @@ -11,20 +13,13 @@ libflash: ccan: ln -sf ../../ccan . -sfc-ctrl.c: - ln -sf ../../hw/sfc-ctrl.c . - -ast-sf-ctrl.c: - ln -sf ../../hw/ast-bmc/ast-sf-ctrl.c +common: + ln -sf ../common . make_version.sh: ln -sf ../../make_version.sh -common: - ln -sf ../../external/common . - ln -sf ../../external/common/arch_flash_$(arch)_io.h io.h - -$(OBJS) : links +$(OBJS): | links arch_links .PHONY: VERSION-always .version: VERSION-always @@ -39,12 +34,13 @@ $(OBJS) : links dist: links .version find -L ../pflash/ -iname '*.[ch]' -print0 | xargs -0 tar -rhf $(PFLASH_VERSION).tar tar --transform 's/Makefile.dist/Makefile/' -rhf $(PFLASH_VERSION).tar \ - ../pflash/get_arch.sh ../pflash/Makefile.dist ../pflash/rules.mk \ - ../pflash/.version ../pflash/make_version.sh + ../pflash/Makefile.dist ../pflash/rules.mk \ + ../pflash/.version ../pflash/make_version.sh \ + ../pflash/common/* -clean: +clean: arch_clean rm -f $(OBJS) $(EXE) *.o *.d libflash/test/test_flash libflash/test/*.o distclean: clean rm -f *.c~ *.h~ *.sh~ Makefile~ config.mk~ libflash/*.c~ libflash/*.h~ - rm -f libflash ccan sfc-ctrl.c ast-sf-ctrl.c .version .version.tmp + rm -f libflash ccan .version .version.tmp rm -f common io.h make_version.sh diff --git a/external/pflash/Makefile.dist b/external/pflash/Makefile.dist index 017fd906..46edcb13 100644 --- a/external/pflash/Makefile.dist +++ b/external/pflash/Makefile.dist @@ -1,4 +1,6 @@ include rules.mk +GET_ARCH = common/get_arch.sh +include common/rules.mk all: $(EXE) diff --git a/external/pflash/ast.h b/external/pflash/ast.h index fe8f7ce2..1910eb49 100644 --- a/external/pflash/ast.h +++ b/external/pflash/ast.h @@ -32,7 +32,7 @@ * AHB Accessors */ #ifndef __SKIBOOT__ -#include "io.h" +#include "common/io.h" #else /* diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk index f3af1242..849c2803 100644 --- a/external/pflash/rules.mk +++ b/external/pflash/rules.mk @@ -1,29 +1,10 @@ -ARCH=$(shell ./get_arch.sh "$(CROSS_COMPILE)") - -ifeq ($(ARCH),ARCH_ARM) -arch = arm -ARCH_OBJS = common/arch_flash_common.o common/arch_flash_arm.o ast-sf-ctrl.o -else -ifeq ($(ARCH),ARCH_POWERPC) -arch = powerpc -ARCH_OBJS = common/arch_flash_common.o common/arch_flash_powerpc.o -else -ifeq ($(ARCH),ARCH_X86) -arch = x86 -ARCH_OBJS = common/arch_flash_common.o common/arch_flash_x86.o -else -$(error Unsupported architecture $(ARCH)) -endif -endif -endif - .DEFAULT_GOAL := all CFLAGS = -O2 -Wall -I. LDFLAGS = -lrt OBJS = pflash.o progress.o version.o OBJS += libflash/libflash.o libflash/libffs.o libflash/ecc.o libflash/blocklevel.o libflash/file.o -OBJS += $(ARCH_OBJS) +OBJS += common/arch_flash.o EXE = pflash CC = $(CROSS_COMPILE)gcc diff --git a/external/pflash/sfc-ctrl.h b/external/pflash/sfc-ctrl.h deleted file mode 100644 index 6c307590..00000000 --- a/external/pflash/sfc-ctrl.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef SFC_CTRL_H -#define SFC_CTRL_H - -struct spi_flash_ctrl; - -extern int sfc_open(struct spi_flash_ctrl **ctrl); -extern void sfc_close(struct spi_flash_ctrl *ctrl); - -#endif /* SFC_CTRL_H */ |