diff --git a/include/target.mk b/include/target.mk new file mode 100644 index 0000000000..afdf5d8ae6 --- /dev/null +++ b/include/target.mk @@ -0,0 +1,23 @@ +define kernel_template +ifeq ($(CONFIG_LINUX_$(3)),y) +KERNEL:=$(1) +BOARD:=$(2) +endif +endef + +$(eval $(call kernel_template,2.4,brcm,2_4_BRCM)) +$(eval $(call kernel_template,2.4,ar7,2_4_AR7)) +$(eval $(call kernel_template,2.4,x86,2_4_X86)) +$(eval $(call kernel_template,2.6,brcm,2_6_BRCM)) +$(eval $(call kernel_template,2.6,rb532,2_6_RB532)) +$(eval $(call kernel_template,2.6,x86,2_6_X86)) +$(eval $(call kernel_template,2.4,ar531x,2_4_AR531X)) +$(eval $(call kernel_template,2.6,aruba,2_6_ARUBA)) +$(eval $(call kernel_template,2.6,au1000,2_6_AU1000)) +$(eval $(call kernel_template,2.6,xscale,2_6_XSCALE)) +$(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE)) + +export BOARD +export KERNEL + + diff --git a/target/Makefile b/target/Makefile index 0a1434472a..836469d171 100644 --- a/target/Makefile +++ b/target/Makefile @@ -1,4 +1,5 @@ include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/target.mk all: install @@ -11,15 +12,23 @@ TARGETS-$(CONFIG_SDK) += sdk linux-compile: utils-install linux-install: $(BIN_DIR) sdk-compile: linux-install +image_install: linux-install download: $(patsubst %,%-source,$(TARGETS-y)) prepare: linux-prepare -compile: linux-compile -install: image_clean $(patsubst %,%-install,$(TARGETS-y)) +compile: linux-compile image_compile +install: image_clean $(patsubst %,%-install,$(TARGETS-y)) image_install clean: $(patsubst %,%-clean,$(TARGETS-y)) image_clean image_clean: FORCE + $(MAKE) -C image/$(BOARD) clean rm -f $(BIN_DIR)/openwrt-* + +image_compile: FORCE + $(MAKE) -C image/$(BOARD) compile + +image_install: image_compile + $(MAKE) -C image/$(BOARD) install %-clean: FORCE $(MAKE) -C $(patsubst %-clean,%,$@) clean diff --git a/target/linux/image/ar7/Makefile b/target/image/ar7/Makefile similarity index 100% rename from target/linux/image/ar7/Makefile rename to target/image/ar7/Makefile diff --git a/target/linux/image/ar7/sercomm/adam2.bin b/target/image/ar7/sercomm/adam2.bin similarity index 100% rename from target/linux/image/ar7/sercomm/adam2.bin rename to target/image/ar7/sercomm/adam2.bin diff --git a/target/linux/image/ar7/sercomm/dg834 b/target/image/ar7/sercomm/dg834 similarity index 100% rename from target/linux/image/ar7/sercomm/dg834 rename to target/image/ar7/sercomm/dg834 diff --git a/target/linux/image/ar7/sercomm/jdr454wb b/target/image/ar7/sercomm/jdr454wb similarity index 100% rename from target/linux/image/ar7/sercomm/jdr454wb rename to target/image/ar7/sercomm/jdr454wb diff --git a/target/linux/image/ar7/src/LzmaDecode.c b/target/image/ar7/src/LzmaDecode.c similarity index 100% rename from target/linux/image/ar7/src/LzmaDecode.c rename to target/image/ar7/src/LzmaDecode.c diff --git a/target/linux/image/ar7/src/LzmaDecode.h b/target/image/ar7/src/LzmaDecode.h similarity index 100% rename from target/linux/image/ar7/src/LzmaDecode.h rename to target/image/ar7/src/LzmaDecode.h diff --git a/target/linux/image/ar7/src/gzip.h b/target/image/ar7/src/gzip.h similarity index 100% rename from target/linux/image/ar7/src/gzip.h rename to target/image/ar7/src/gzip.h diff --git a/target/linux/image/ar7/src/ld.script.in b/target/image/ar7/src/ld.script.in similarity index 100% rename from target/linux/image/ar7/src/ld.script.in rename to target/image/ar7/src/ld.script.in diff --git a/target/linux/image/ar7/src/loader.c b/target/image/ar7/src/loader.c similarity index 100% rename from target/linux/image/ar7/src/loader.c rename to target/image/ar7/src/loader.c diff --git a/target/linux/image/ar7/src/srec2bin.c b/target/image/ar7/src/srec2bin.c similarity index 100% rename from target/linux/image/ar7/src/srec2bin.c rename to target/image/ar7/src/srec2bin.c diff --git a/target/linux/image/ar7/src/zimage.script.in b/target/image/ar7/src/zimage.script.in similarity index 100% rename from target/linux/image/ar7/src/zimage.script.in rename to target/image/ar7/src/zimage.script.in diff --git a/target/linux/image/aruba/Makefile b/target/image/aruba/Makefile similarity index 100% rename from target/linux/image/aruba/Makefile rename to target/image/aruba/Makefile diff --git a/target/linux/image/aruba/addVersion b/target/image/aruba/addVersion similarity index 100% rename from target/linux/image/aruba/addVersion rename to target/image/aruba/addVersion diff --git a/target/linux/image/aruba/version b/target/image/aruba/version similarity index 100% rename from target/linux/image/aruba/version rename to target/image/aruba/version diff --git a/target/linux/image/au1000/Makefile b/target/image/au1000/Makefile similarity index 100% rename from target/linux/image/au1000/Makefile rename to target/image/au1000/Makefile diff --git a/target/linux/image/brcm/Makefile b/target/image/brcm/Makefile similarity index 100% rename from target/linux/image/brcm/Makefile rename to target/image/brcm/Makefile diff --git a/target/linux/image/brcm/lzma-loader/Makefile b/target/image/brcm/lzma-loader/Makefile similarity index 100% rename from target/linux/image/brcm/lzma-loader/Makefile rename to target/image/brcm/lzma-loader/Makefile diff --git a/target/linux/image/brcm/lzma-loader/src/LzmaDecode.c b/target/image/brcm/lzma-loader/src/LzmaDecode.c similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/LzmaDecode.c rename to target/image/brcm/lzma-loader/src/LzmaDecode.c diff --git a/target/linux/image/brcm/lzma-loader/src/LzmaDecode.h b/target/image/brcm/lzma-loader/src/LzmaDecode.h similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/LzmaDecode.h rename to target/image/brcm/lzma-loader/src/LzmaDecode.h diff --git a/target/linux/image/brcm/lzma-loader/src/Makefile b/target/image/brcm/lzma-loader/src/Makefile similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/Makefile rename to target/image/brcm/lzma-loader/src/Makefile diff --git a/target/linux/image/brcm/lzma-loader/src/README b/target/image/brcm/lzma-loader/src/README similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/README rename to target/image/brcm/lzma-loader/src/README diff --git a/target/linux/image/brcm/lzma-loader/src/decompress.c b/target/image/brcm/lzma-loader/src/decompress.c similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/decompress.c rename to target/image/brcm/lzma-loader/src/decompress.c diff --git a/target/linux/image/brcm/lzma-loader/src/decompress.lds.in b/target/image/brcm/lzma-loader/src/decompress.lds.in similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/decompress.lds.in rename to target/image/brcm/lzma-loader/src/decompress.lds.in diff --git a/target/linux/image/brcm/lzma-loader/src/head.S b/target/image/brcm/lzma-loader/src/head.S similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/head.S rename to target/image/brcm/lzma-loader/src/head.S diff --git a/target/linux/image/brcm/lzma-loader/src/loader.lds.in b/target/image/brcm/lzma-loader/src/loader.lds.in similarity index 100% rename from target/linux/image/brcm/lzma-loader/src/loader.lds.in rename to target/image/brcm/lzma-loader/src/loader.lds.in diff --git a/target/linux/image/generic/Makefile b/target/image/generic/Makefile similarity index 100% rename from target/linux/image/generic/Makefile rename to target/image/generic/Makefile diff --git a/target/linux/image/generic/lzma-loader/Makefile b/target/image/generic/lzma-loader/Makefile similarity index 100% rename from target/linux/image/generic/lzma-loader/Makefile rename to target/image/generic/lzma-loader/Makefile diff --git a/target/linux/image/generic/lzma-loader/src/LzmaDecode.c b/target/image/generic/lzma-loader/src/LzmaDecode.c similarity index 100% rename from target/linux/image/generic/lzma-loader/src/LzmaDecode.c rename to target/image/generic/lzma-loader/src/LzmaDecode.c diff --git a/target/linux/image/generic/lzma-loader/src/LzmaDecode.h b/target/image/generic/lzma-loader/src/LzmaDecode.h similarity index 100% rename from target/linux/image/generic/lzma-loader/src/LzmaDecode.h rename to target/image/generic/lzma-loader/src/LzmaDecode.h diff --git a/target/linux/image/generic/lzma-loader/src/Makefile b/target/image/generic/lzma-loader/src/Makefile similarity index 100% rename from target/linux/image/generic/lzma-loader/src/Makefile rename to target/image/generic/lzma-loader/src/Makefile diff --git a/target/linux/image/generic/lzma-loader/src/decompress.c b/target/image/generic/lzma-loader/src/decompress.c similarity index 100% rename from target/linux/image/generic/lzma-loader/src/decompress.c rename to target/image/generic/lzma-loader/src/decompress.c diff --git a/target/linux/image/generic/lzma-loader/src/lzma-copy.lds.in b/target/image/generic/lzma-loader/src/lzma-copy.lds.in similarity index 100% rename from target/linux/image/generic/lzma-loader/src/lzma-copy.lds.in rename to target/image/generic/lzma-loader/src/lzma-copy.lds.in diff --git a/target/linux/image/generic/lzma-loader/src/lzma.lds.in b/target/image/generic/lzma-loader/src/lzma.lds.in similarity index 100% rename from target/linux/image/generic/lzma-loader/src/lzma.lds.in rename to target/image/generic/lzma-loader/src/lzma.lds.in diff --git a/target/linux/image/generic/lzma-loader/src/print.c b/target/image/generic/lzma-loader/src/print.c similarity index 100% rename from target/linux/image/generic/lzma-loader/src/print.c rename to target/image/generic/lzma-loader/src/print.c diff --git a/target/linux/image/generic/lzma-loader/src/print.h b/target/image/generic/lzma-loader/src/print.h similarity index 100% rename from target/linux/image/generic/lzma-loader/src/print.h rename to target/image/generic/lzma-loader/src/print.h diff --git a/target/linux/image/generic/lzma-loader/src/printf.c b/target/image/generic/lzma-loader/src/printf.c similarity index 100% rename from target/linux/image/generic/lzma-loader/src/printf.c rename to target/image/generic/lzma-loader/src/printf.c diff --git a/target/linux/image/generic/lzma-loader/src/printf.h b/target/image/generic/lzma-loader/src/printf.h similarity index 100% rename from target/linux/image/generic/lzma-loader/src/printf.h rename to target/image/generic/lzma-loader/src/printf.h diff --git a/target/linux/image/generic/lzma-loader/src/start.S b/target/image/generic/lzma-loader/src/start.S similarity index 100% rename from target/linux/image/generic/lzma-loader/src/start.S rename to target/image/generic/lzma-loader/src/start.S diff --git a/target/linux/image/generic/lzma-loader/src/uart16550.c b/target/image/generic/lzma-loader/src/uart16550.c similarity index 100% rename from target/linux/image/generic/lzma-loader/src/uart16550.c rename to target/image/generic/lzma-loader/src/uart16550.c diff --git a/target/linux/image/generic/lzma-loader/src/uart16550.h b/target/image/generic/lzma-loader/src/uart16550.h similarity index 100% rename from target/linux/image/generic/lzma-loader/src/uart16550.h rename to target/image/generic/lzma-loader/src/uart16550.h diff --git a/target/linux/image/rb532/Makefile b/target/image/rb532/Makefile similarity index 100% rename from target/linux/image/rb532/Makefile rename to target/image/rb532/Makefile diff --git a/target/linux/image/x86/Makefile b/target/image/x86/Makefile similarity index 100% rename from target/linux/image/x86/Makefile rename to target/image/x86/Makefile diff --git a/target/linux/image/xscale/Makefile b/target/image/xscale/Makefile similarity index 100% rename from target/linux/image/xscale/Makefile rename to target/image/xscale/Makefile diff --git a/target/linux/Makefile b/target/linux/Makefile index e1a314d1d8..bab26845a1 100644 --- a/target/linux/Makefile +++ b/target/linux/Makefile @@ -1,33 +1,8 @@ include $(TOPDIR)/rules.mk - -PKG_OS:=$(shell uname -s) -PKG_CPU:=$(shell uname -m) - -define kernel_template -ifeq ($(CONFIG_LINUX_$(3)),y) -KERNEL:=$(1) -BOARD:=$(2) -endif -endef - -$(eval $(call kernel_template,2.4,brcm,2_4_BRCM)) -$(eval $(call kernel_template,2.4,ar7,2_4_AR7)) -$(eval $(call kernel_template,2.4,x86,2_4_X86)) -$(eval $(call kernel_template,2.6,brcm,2_6_BRCM)) -$(eval $(call kernel_template,2.6,rb532,2_6_RB532)) -$(eval $(call kernel_template,2.6,x86,2_6_X86)) -$(eval $(call kernel_template,2.4,ar531x,2_4_AR531X)) -$(eval $(call kernel_template,2.6,aruba,2_6_ARUBA)) -$(eval $(call kernel_template,2.6,au1000,2_6_AU1000)) -$(eval $(call kernel_template,2.6,xscale,2_6_XSCALE)) -$(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE)) - -export BOARD -export KERNEL +include $(INCLUDE_DIR)/target.mk source: $(MAKE) -C $(BOARD)-$(KERNEL) source - $(MAKE) -C image/$(BOARD) source prepare: rm -f $(TOPDIR)/.kernel.mk @@ -38,10 +13,6 @@ compile: install: $(MAKE) -C $(BOARD)-$(KERNEL) install - $(MAKE) -C image/$(BOARD) install clean: $(MAKE) -C $(BOARD)-$(KERNEL) clean - -image/%: - $(MAKE) -C image $(patsubst image/%,%,$@)