diff options
Diffstat (limited to 'target')
-rw-r--r-- | target/Makefile | 3 | ||||
-rw-r--r-- | target/linux/Makefile | 36 | ||||
-rw-r--r-- | target/linux/image/Makefile | 6 | ||||
-rw-r--r-- | target/linux/image/ar7/Makefile | 34 | ||||
-rw-r--r-- | target/linux/image/brcm/Makefile | 30 | ||||
-rw-r--r-- | target/linux/image/jffs2.mk | 5 | ||||
-rw-r--r-- | target/linux/image/soekris/Makefile | 5 | ||||
-rw-r--r-- | target/linux/image/squashfs.mk | 6 | ||||
-rw-r--r-- | target/linux/imagebuilder/Makefile | 42 | ||||
-rw-r--r-- | target/linux/imagebuilder/lists/default.ar7-2.4 | 25 | ||||
-rw-r--r-- | target/linux/imagebuilder/lists/default.brcm-2.4 | 23 | ||||
-rw-r--r-- | target/linux/imagebuilder/lists/micro.ar7-2.4 | 18 | ||||
-rw-r--r-- | target/linux/imagebuilder/lists/micro.brcm-2.4 | 19 | ||||
-rw-r--r-- | target/linux/imagebuilder/lists/pptp.brcm-2.4 | 23 |
14 files changed, 255 insertions, 20 deletions
diff --git a/target/Makefile b/target/Makefile index 5e8c6f28c..e6156b48b 100644 --- a/target/Makefile +++ b/target/Makefile @@ -26,5 +26,6 @@ image_clean: $(MAKE) -C $(patsubst %-rebuild,%,$@) rebuild %-install: %-compile $(MAKE) -C $(patsubst %-install,%,$@) install - +linux-imagebuilder: + $(MAKE) -C linux imagebuilder diff --git a/target/linux/Makefile b/target/linux/Makefile index 3bbe3cdab..610bc7e1b 100644 --- a/target/linux/Makefile +++ b/target/linux/Makefile @@ -1,5 +1,11 @@ include $(TOPDIR)/rules.mk +PKG_OS:=$(shell uname -s) +PKG_CPU:=$(shell uname -m) + +IB_NAME:=OpenWrt-ImageBuilder-$(PKG_OS)-$(PKG_CPU) +IB_DIR:=$(BUILD_DIR)/$(IB_NAME) + define kernel_template $(1)/$(2)-clean: @@ -20,17 +26,45 @@ $(1)/$(2)-install: $(1)/$(2)-image: $(1)/$(2)-install $(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" install +$(1)/$(2)-install-ib: + $(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" IB_DIR="$(IB_DIR)" install-ib + echo '$$$$(eval $$$$(call image_template,$(2),$(1)))' >> $(IB_DIR)/kernel.mk + + ifeq ($(BR2_LINUX_$(3)),y) clean: $(1)/$(2)-clean prepare: $(1)/$(2)-prepare compile: $(1)/$(2)-compile rebuild: $(1)/$(2)-rebuild install: $(1)/$(2)-image +install-ib: $(1)/$(2)-install-ib endif -.PHONY: $(1)/$(2)-clean $(1)/$(2)-prepare $(1)/$(2)-compile $(1)/$(2)-rebuild $(1)/$(2)-install +.PHONY: $(1)/$(2)-clean $(1)/$(2)-prepare $(1)/$(2)-compile $(1)/$(2)-rebuild $(1)/$(2)-install $(1)/$(2)-install-ib endef +.PHONY: clean prepare compile rebuild install imagebuilder install-ib + +install-ib: + +$(BIN_DIR)/$(IB_NAME).tar.bz2: + rm -rf $(IB_DIR) + mkdir -p $(IB_DIR)/packages + mkdir -p $(IB_DIR)/scripts + cp -dpR ./imagebuilder/* $(IB_DIR)/ + cp -dpR $(TOPDIR)/bin/packages/*.ipk $(IB_DIR)/packages/ + cp $(TOPDIR)/scripts/ipkg $(IB_DIR)/scripts/ + $(MAKE) install-ib + cp $(TOPDIR)/rules.mk $(IB_DIR) + cp -dpR ./image $(IB_DIR)/ + cp $(TOPDIR)/.config $(IB_DIR)/ + find $(IB_DIR) -name CVS | xargs rm -rf + (cd $(BUILD_DIR); tar c $(IB_NAME) | bzip2 -c > $(BIN_DIR)/$(IB_NAME).tar.bz2) + +ifeq ($(BR2_PACKAGE_IMAGEBUILDER),y) +install: $(BIN_DIR)/$(IB_NAME).tar.bz2 +endif + prepare: $(MAKE) -C image prepare compile: diff --git a/target/linux/image/Makefile b/target/linux/image/Makefile index b6a6c5691..74c778a33 100644 --- a/target/linux/image/Makefile +++ b/target/linux/image/Makefile @@ -19,6 +19,12 @@ compile: install: $(MAKE) -C $(BOARD) prepare $(MAKE) -C $(BOARD) compile + +install-ib: + -$(MAKE) -C $(BOARD) IB_DIR="$(IB_DIR)" install-ib + mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) + cp $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/kernel[-_]*.ipk $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ + rebuild: clean prepare compile install clean: diff --git a/target/linux/image/ar7/Makefile b/target/linux/image/ar7/Makefile index 4436fa9ba..8a369edb6 100644 --- a/target/linux/image/ar7/Makefile +++ b/target/linux/image/ar7/Makefile @@ -1,6 +1,6 @@ include $(TOPDIR)/rules.mk -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-ar7 +KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) PKG_BUILD_DIR:=$(BUILD_DIR)/ar7loader @@ -47,9 +47,11 @@ $(KDIR)/vmlinux.bin: $(KDIR)/vmlinux.lzma -o $(KDIR)/loader $(TARGET_CROSS)objcopy -O srec $(KDIR)/loader $(KDIR)/ram_zimage.sre $(STAGING_DIR)/bin/srec2bin $(KDIR)/ram_zimage.sre $@ + +$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin: $(KDIR)/vmlinux.bin endif -$(BIN_DIR)/openwrt-ar7-2.4-kernel.bin: $(KDIR)/vmlinux.bin +$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin: cp $< $@ ifeq ($(FS),jffs2-8MB) @@ -59,16 +61,16 @@ ifeq ($(FS),jffs2-4MB) ALIGN:=bs=65536 conv=sync endif -$(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin: $(BIN_DIR)/openwrt-ar7-2.4-kernel.bin +$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin dd if=$< $(ALIGN) > $@ - cat $(BUILD_DIR)/linux-$(KERNEL)-ar7/root.$(FS) >> $@ + cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(FS) >> $@ define pattern_template -$(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS)-$(1).bin: $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin - (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin) | \ - $(STAGING_DIR)/bin/addpattern -p $(1) $(2) -o $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS)-$(1).bin +$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin + (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin) | \ + $(STAGING_DIR)/bin/addpattern -p $(1) $(2) -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin -install: $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS)-$(1).bin +install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin endef $(eval $(call pattern_template,WA22)) @@ -76,11 +78,23 @@ $(eval $(call pattern_template,WAG2)) $(eval $(call pattern_template,WA21)) $(eval $(call pattern_template,WA32,-b)) +ifeq ($(IB),) clean: rm -rf $(PKG_BUILD_DIR) - rm -f $(BIN_DIR)/openwrt-ar7* + rm -f $(BIN_DIR)/openwrt-$(BOARD)* prepare: $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/zimage.script $(PKG_BUILD_DIR)/ld.script compile: prepare $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin -install: $(BIN_DIR)/openwrt-ar7-2.4-kernel.bin $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin +else +clean: +prepare: +compile: +endif +install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin +install-ib: + mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) + cp -dpR $(KDIR)/vmlinux.bin $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ + mkdir -p $(IB_DIR)/staging_dir_$(ARCH) + cp -dpR $(STAGING_DIR)/bin/addpattern $(IB_DIR)/staging_dir_$(ARCH)/bin/ + diff --git a/target/linux/image/brcm/Makefile b/target/linux/image/brcm/Makefile index ec8f72cca..f551b84be 100644 --- a/target/linux/image/brcm/Makefile +++ b/target/linux/image/brcm/Makefile @@ -1,6 +1,6 @@ include $(TOPDIR)/rules.mk -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-brcm +KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) lzma-loader-clean: $(MAKE) -C lzma-loader clean @@ -11,16 +11,20 @@ lzma-loader-prepare: lzma-loader-compile: lzma-loader-prepare $(MAKE) -C lzma-loader compile +ifeq ($(IB),) $(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false) +$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/vmlinux.lzma +endif + ifeq ($(FS),jffs2-8MB) TRXALIGN:=-a 0x20000 endif ifeq ($(FS),jffs2-4MB) TRXALIGN:=-a 0x10000 endif -$(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx: $(KDIR)/vmlinux.lzma +$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(STAGING_DIR)/bin/trx -o $@ $(BUILD_DIR)/loader.gz $(KDIR)/vmlinux.lzma $(TRXALIGN) $(KDIR)/root.$(FS) @@ -28,26 +32,38 @@ ifeq ($(KERNEL),2.4) FSNAME:=$(patsubst jffs2-%,jffs2,$(FS)) ifneq ($(FS),jffs2-8MB) -$(BIN_DIR)/openwrt-wrt54g-$(FSNAME).bin: $(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx +$(BIN_DIR)/openwrt-wrt54g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx $(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g install: $(BIN_DIR)/openwrt-wrt54g-$(FSNAME).bin endif ifneq ($(FS),jffs2-4MB) -$(BIN_DIR)/openwrt-wrt54gs-$(FSNAME).bin: $(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx +$(BIN_DIR)/openwrt-wrt54gs-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx $(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g install: $(BIN_DIR)/openwrt-wrt54gs-$(FSNAME).bin endif -$(BIN_DIR)/openwrt-motorola-$(FS).bin: $(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx +$(BIN_DIR)/openwrt-motorola-$(FS).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx $(STAGING_DIR)/bin/motorola-bin $< $@ install: $(BIN_DIR)/openwrt-motorola-$(FS).bin endif +ifeq ($(IB),) clean: lzma-loader-clean prepare: lzma-loader-prepare compile: lzma-loader-compile -install: compile $(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx - +install: compile $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx +else +clean: +prepare: +compile: +install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx +endif +install-ib: + mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin + cp -dpR $(STAGING_DIR)/bin/addpattern $(STAGING_DIR)/bin/trx $(STAGING_DIR)/bin/motorola-bin $(IB_DIR)/staging_dir_$(ARCH)/bin + mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) + cp -dpR $(BUILD_DIR)/loader.gz $(IB_DIR)/build_$(ARCH)/ + cp -dpR $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ diff --git a/target/linux/image/jffs2.mk b/target/linux/image/jffs2.mk index 02c56817b..a2c47e4dc 100644 --- a/target/linux/image/jffs2.mk +++ b/target/linux/image/jffs2.mk @@ -23,8 +23,13 @@ jffs2-install: $(KDIR)/root.jffs2-4MB $(KDIR)/root.jffs2-8MB $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-4MB" $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-8MB" +jffs2-install-ib: + mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin + cp $(STAGING_DIR)/bin/mkfs.jffs2 $(IB_DIR)/staging_dir_$(ARCH)/bin + prepare: jffs2-prepare compile: jffs2-compile install: jffs2-install +install-ib: jffs2-install-ib clean: jffs2-clean diff --git a/target/linux/image/soekris/Makefile b/target/linux/image/soekris/Makefile index 0b4fba9d8..9ab3a7388 100644 --- a/target/linux/image/soekris/Makefile +++ b/target/linux/image/soekris/Makefile @@ -27,7 +27,10 @@ $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/bzImage cp $^ $@ +clean: prepare: compile: install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz - +install-ib: + mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) + cp -dpR $(KDIR)/bzImage $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ diff --git a/target/linux/image/squashfs.mk b/target/linux/image/squashfs.mk index 70a85b99e..42ff77db6 100644 --- a/target/linux/image/squashfs.mk +++ b/target/linux/image/squashfs.mk @@ -14,7 +14,13 @@ $(KDIR)/root.squashfs: squashfs-install: $(KDIR)/root.squashfs $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="squashfs" + +squashfs-install-ib: + mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin + cp $(STAGING_DIR)/bin/mksquashfs-lzma $(IB_DIR)/staging_dir_$(ARCH)/bin prepare: squashfs-prepare compile: squashfs-compile install: squashfs-install +install-ib: squashfs-install-ib +clean: squashfs-clean diff --git a/target/linux/imagebuilder/Makefile b/target/linux/imagebuilder/Makefile new file mode 100644 index 000000000..8da50bdd7 --- /dev/null +++ b/target/linux/imagebuilder/Makefile @@ -0,0 +1,42 @@ +default: clean all + +TOPDIR:=${shell pwd} +export TOPDIR +IB:=1 +export IB +include ./rules.mk + +LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) +IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_BUILD_DIR)/root IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends + +define image_template + +all: all-$(1)-$(2) + +all-$(1)-$(2): + @for listfile in ./lists/*.$(1)-$(2); do \ + $(MAKE) -s `echo $$$$listfile | sed 's,.*lists/\(.*\).$(1)-$(2),BOARD=$(1) KERNEL=$(2) LIST=\1,'` build; \ + done +endef + +include ./kernel.mk + +clean: + @rm -rf $(LINUX_BUILD_DIR)/root* + @rm -rf $(BIN_DIR) +all: + +build: + echo + echo '### BUILDING IMAGE FROM lists/$(LIST).$(BOARD)-$(KERNEL)' + echo + rm -rf $(LINUX_BUILD_DIR)/root* + mkdir -p $(BIN_DIR)/$(LIST) + mkdir -p $(LINUX_BUILD_DIR)/tmp + mkdir -p $(LINUX_BUILD_DIR)/root + echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf + $(IPKG_KERNEL) install $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/kernel[-_]*.ipk + for package in `cat lists/$(LIST).$(BOARD)-$(KERNEL)`; do \ + $(IPKG_KERNEL) install `ls packages/$${package}_*`; \ + done + $(MAKE) -S -C image KERNEL="$(KERNEL)" BOARD="$(BOARD)" BIN_DIR="$(BIN_DIR)/$(LIST)" install diff --git a/target/linux/imagebuilder/lists/default.ar7-2.4 b/target/linux/imagebuilder/lists/default.ar7-2.4 new file mode 100644 index 000000000..86c159c09 --- /dev/null +++ b/target/linux/imagebuilder/lists/default.ar7-2.4 @@ -0,0 +1,25 @@ +base-files +base-files-ar7 +bridge +busybox +dnsmasq +dropbear +ipkg +iptables +kmod-cpmac +kmod-atm +kmod-pppoatm +kmod-sangam-atm-annexb +kmod-ppp +kmod-pppoe +kmod-wlcompat +libgcc +linux-atm +mtd +nvram +ppp +ppp-mod-pppoe +uclibc +wireless-tools +wificonf +zlib diff --git a/target/linux/imagebuilder/lists/default.brcm-2.4 b/target/linux/imagebuilder/lists/default.brcm-2.4 new file mode 100644 index 000000000..91236cbaf --- /dev/null +++ b/target/linux/imagebuilder/lists/default.brcm-2.4 @@ -0,0 +1,23 @@ +base-files +base-files-brcm +bridge +busybox +dnsmasq +dropbear +ipkg +iptables +kmod-brcm-et +kmod-brcm-wl +kmod-diag +kmod-ppp +kmod-pppoe +kmod-wlcompat +libgcc +mtd +nvram +ppp +ppp-mod-pppoe +uclibc +wireless-tools +wificonf +zlib diff --git a/target/linux/imagebuilder/lists/micro.ar7-2.4 b/target/linux/imagebuilder/lists/micro.ar7-2.4 new file mode 100644 index 000000000..dfaaa6e8d --- /dev/null +++ b/target/linux/imagebuilder/lists/micro.ar7-2.4 @@ -0,0 +1,18 @@ +base-files +base-files-ar7 +bridge +busybox +dnsmasq +dropbear +ipkg +iptables +kmod-cpmac +kmod-wlcompat +libgcc +linux-atm +mtd +nvram +uclibc +wireless-tools +wificonf +zlib diff --git a/target/linux/imagebuilder/lists/micro.brcm-2.4 b/target/linux/imagebuilder/lists/micro.brcm-2.4 new file mode 100644 index 000000000..078884312 --- /dev/null +++ b/target/linux/imagebuilder/lists/micro.brcm-2.4 @@ -0,0 +1,19 @@ +base-files +base-files-brcm +bridge +busybox +dnsmasq +dropbear +ipkg +iptables +kmod-brcm-et +kmod-brcm-wl +kmod-diag +kmod-wlcompat +libgcc +mtd +nvram +uclibc +wireless-tools +wificonf +zlib diff --git a/target/linux/imagebuilder/lists/pptp.brcm-2.4 b/target/linux/imagebuilder/lists/pptp.brcm-2.4 new file mode 100644 index 000000000..280b21ece --- /dev/null +++ b/target/linux/imagebuilder/lists/pptp.brcm-2.4 @@ -0,0 +1,23 @@ +base-files +base-files-brcm +bridge +busybox +dnsmasq +dropbear +ipkg +iptables +kmod-brcm-et +kmod-brcm-wl +kmod-diag +kmod-ppp +kmod-gre +kmod-wlcompat +libgcc +mtd +nvram +ppp +pptp +uclibc +wireless-tools +wificonf +zlib |