summaryrefslogtreecommitdiffstats
path: root/openwrt
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt')
-rw-r--r--openwrt/target/Makefile62
-rw-r--r--openwrt/target/image.mk13
-rw-r--r--openwrt/target/linux/Makefile20
-rw-r--r--openwrt/target/linux/image/Makefile24
-rw-r--r--openwrt/target/linux/image/brcm/Makefile47
-rw-r--r--openwrt/target/linux/image/brcm/lzma-loader/Makefile (renamed from openwrt/target/lzma-loader/Makefile)0
-rw-r--r--openwrt/target/linux/image/brcm/lzma-loader/patches/toolchain.patch (renamed from openwrt/target/lzma-loader/patches/toolchain.patch)0
-rw-r--r--openwrt/target/linux/image/jffs2.mk30
-rw-r--r--openwrt/target/linux/image/jffs2/Makefile (renamed from openwrt/target/jffs2/Makefile)19
-rw-r--r--openwrt/target/linux/image/squashfs.mk19
-rw-r--r--openwrt/target/linux/image/squashfs/Makefile (renamed from openwrt/target/squashfs-lzma/Makefile)9
-rw-r--r--openwrt/target/linux/image/squashfs/patches/100-lzma.patch (renamed from openwrt/target/squashfs-lzma/patches/100-lzma.patch)0
-rw-r--r--openwrt/target/linux/linux-2.4/Makefile4
-rw-r--r--openwrt/target/lzma/Makefile1
14 files changed, 144 insertions, 104 deletions
diff --git a/openwrt/target/Makefile b/openwrt/target/Makefile
index 88476a799..4f9c54144 100644
--- a/openwrt/target/Makefile
+++ b/openwrt/target/Makefile
@@ -5,48 +5,6 @@ TARGET_SKEL_DIR=default/target_skeleton
all: install
-define BIN_template
-$(BIN_DIR)/openwrt-wrt54g-$(1).bin: $(BIN_DIR)/openwrt-brcm-2.4-$(patsubst jffs2,jffs2-4MB,$(1)).trx
- PATH=$(TARGET_PATH) addpattern -2 -i $$< -o $$@ -g
- $(SED) "1s,^W54S,W54G," $$@
-
-$(BIN_DIR)/openwrt-wrt54gs-$(1).bin: $(BIN_DIR)/openwrt-brcm-2.4-$(patsubst jffs2,jffs2-8MB,$(1)).trx
- PATH=$(TARGET_PATH) addpattern -2 -i $$< -o $$@ -g
-
-ifeq ($(BR2_TARGET_WRT54G),y)
-IMAGE_TARGETS += $(BIN_DIR)/openwrt-wrt54g-$(1).bin
-endif
-ifeq ($(BR2_TARGET_WRT54GS),y)
-IMAGE_TARGETS += $(BIN_DIR)/openwrt-wrt54gs-$(1).bin
-endif
-
-
-$(BIN_DIR)/openwrt-motorola-$(1).bin: $(BIN_DIR)/openwrt-brcm-2.4-$(patsubst jffs2,jffs2-8MB,$(1)).trx
- PATH=$(TARGET_PATH) motorola-bin $$< $$@
-
-ifeq ($(BR2_TARGET_MOTOROLA),y)
-IMAGE_TARGETS += $(BIN_DIR)/openwrt-motorola-$(1).bin
-endif
-endef
-
-TARGET_DIRS:=
-TARGET_FS:=
-IMAGE_TARGETS:=
-ifeq ($(strip $(BR2_TARGET_ROOTFS_JFFS2)),y)
-TARGET_DIRS += jffs2
-TARGET_FS += jffs2
-endif
-ifeq ($(strip $(BR2_TARGET_ROOTFS_SQUASHFS_LZMA)),y)
-TARGET_DIRS += squashfs-lzma
-TARGET_FS += squashfs
-endif
-$(foreach fs,$(TARGET_FS),$(eval $(call BIN_template,$(fs))))
-
-INSTALL_TARGET_DIRS:=$(patsubst %,%-install,$(TARGET_DIRS))
-$(INSTALL_TARGET_DIRS): image_clean $(TARGET_DIR)/etc/sysconf $(BIN_DIR)
-
-prepare: $(patsubst %,%-prepare,$(TARGET_DIRS)) $(TARGET_DIR)
-
$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
if [ -f "$(TARGET_SKELETON)" ] ; then \
@@ -71,19 +29,21 @@ $(TARGET_DIR):
$(BIN_DIR):
mkdir -p $(BIN_DIR)
-$(INSTALL_TARGET_DIRS): lzma-loader-compile linux-install
-$(IMAGE_TARGETS): $(patsubst %,%-install,$(TARGET_DIRS) linux)
-compile: $(patsubst %,%-compile,jffs2 lzma squashfs-lzma lzma-loader utils linux)
-install: utils-install lzma-install $(patsubst %,%-install,$(TARGET_DIRS) linux) $(IMAGE_TARGETS)
-clean: $(patsubst %,%-clean,$(TARGET_DIRS) linux) image_clean
-
-image_clean:
- rm -f $(BIN_DIR)/openwrt-*
-
$(TARGET_DIR)/etc/sysconf:
mkdir -p $(TARGET_DIR)/etc
-grep \^BR2_SYSCONF $(TOPDIR)/.config > $(TARGET_DIR)/etc/sysconf
+linux-compile: utils-install lzma-install
+linux-install: $(TARGET_DIR)/etc/sysconf $(BIN_DIR)
+
+prepare: $(TARGET_DIR)
+compile: linux-compile
+install: image_clean linux-install
+clean: linux-clean utils-clean lzma-clean image_clean
+
+image_clean:
+ rm -f $(BIN_DIR)/openwrt-*
+
%-clean:
$(MAKE) -C $(patsubst %-clean,%,$@) clean
%-prepare:
diff --git a/openwrt/target/image.mk b/openwrt/target/image.mk
deleted file mode 100644
index b18613f49..000000000
--- a/openwrt/target/image.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-
-define image_template
-
-$(BIN_DIR)/openwrt-$(3)-$(2)-$(1).trx:
- $$(call $(1)_template,$(BUILD_DIR)/linux-$(2)-$(3))
-
-ifeq ($(BR2_LINUX_$(4)),y)
-install: $(BIN_DIR)/openwrt-$(3)-$(2)-$(1).trx
-endif
-
-endef
-
-$(eval $(foreach fs,$(FILESYSTEMS),$(call image_template,$(fs),2.4,brcm,2_4_BRCM)))
diff --git a/openwrt/target/linux/Makefile b/openwrt/target/linux/Makefile
index d1b4d545a..604c739b5 100644
--- a/openwrt/target/linux/Makefile
+++ b/openwrt/target/linux/Makefile
@@ -3,36 +3,40 @@ include $(TOPDIR)/rules.mk
define kernel_template
$(1)/$(2)-clean:
- $(MAKE) -C $(1) BOARD="$(2)" clean
+ $(MAKE) -C linux-$(1) BOARD="$(2)" clean
$(1)/$(2)-prepare:
- $(MAKE) -C $(1) BOARD="$(2)" prepare
+ $(MAKE) -C linux-$(1) BOARD="$(2)" prepare
$(1)/$(2)-compile:
- $(MAKE) -C $(1) BOARD="$(2)" compile
+ $(MAKE) -C linux-$(1) BOARD="$(2)" compile
$(1)/$(2)-rebuild:
- $(MAKE) -C $(1) BOARD="$(2)" rebuild
+ $(MAKE) -C linux-$(1) BOARD="$(2)" rebuild
$(1)/$(2)-install:
- $(MAKE) -C $(1) BOARD="$(2)" install
+ $(MAKE) -C linux-$(1) BOARD="$(2)" install
+
+$(1)/$(2)-image: $(1)/$(2)-install
+ $(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" install
ifeq ($(BR2_LINUX_$(3)),y)
clean: $(1)/$(2)-clean
prepare: $(1)/$(2)-prepare
compile: $(1)/$(2)-compile
rebuild: $(1)/$(2)-rebuild
-install: $(1)/$(2)-install
+install: $(1)/$(2)-image
endif
.PHONY: $(1)/$(2)-clean $(1)/$(2)-prepare $(1)/$(2)-compile $(1)/$(2)-rebuild $(1)/$(2)-install
endef
prepare:
+ $(MAKE) -C image prepare
compile:
+ $(MAKE) -C image compile
install:
rebuild:
clean:
- rm -rf $(BUILD_DIR)/kernel
-$(eval $(call kernel_template,linux-2.4,brcm,2_4_BRCM))
+$(eval $(call kernel_template,2.4,brcm,2_4_BRCM))
diff --git a/openwrt/target/linux/image/Makefile b/openwrt/target/linux/image/Makefile
new file mode 100644
index 000000000..6b7c78774
--- /dev/null
+++ b/openwrt/target/linux/image/Makefile
@@ -0,0 +1,24 @@
+include $(TOPDIR)/rules.mk
+
+ifeq ($(BOARD),)
+BOARD:=brcm
+endif
+
+KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
+
+ifeq ($(BR2_TARGET_ROOTFS_JFFS2),y)
+include ./jffs2.mk
+endif
+
+ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS_LZMA),y)
+include ./squashfs.mk
+endif
+
+prepare:
+ $(MAKE) -C $(BOARD) prepare
+compile:
+ $(MAKE) -C $(BOARD) compile
+install:
+rebuild: clean prepare compile install
+clean:
+
diff --git a/openwrt/target/linux/image/brcm/Makefile b/openwrt/target/linux/image/brcm/Makefile
new file mode 100644
index 000000000..2cff6af87
--- /dev/null
+++ b/openwrt/target/linux/image/brcm/Makefile
@@ -0,0 +1,47 @@
+include $(TOPDIR)/rules.mk
+
+KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-brcm
+
+lzma-loader-clean:
+ $(MAKE) -C lzma-loader clean
+
+lzma-loader-prepare:
+ $(MAKE) -C lzma-loader prepare
+
+lzma-loader-compile: lzma-loader-prepare
+ $(MAKE) -C lzma-loader compile
+
+$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
+ cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
+
+$(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx: $(KDIR)/vmlinux.lzma
+ $(STAGING_DIR)/bin/trx -o $@ $(BUILD_DIR)/loader.gz $(KDIR)/vmlinux.lzma $(KDIR)/root.$(FS)
+
+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
+ $(STAGING_DIR)/bin/addpattern -2 -i $< -o $@ -g
+ $(SED) "1s,^W54S,W54G," $@
+
+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
+ $(STAGING_DIR)/bin/addpattern -2 -i $< -o $@ -g
+
+install: $(BIN_DIR)/openwrt-wrt54gs-$(FSNAME).bin
+endif
+
+$(BIN_DIR)/openwrt-motorola-$(FS).bin: $(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx
+ $(STAGING_DIR)/bin/motorola-bin $< $@
+install: $(BIN_DIR)/openwrt-motorola-$(FS).bin
+endif
+
+clean: lzma-loader-clean
+prepare: lzma-loader-prepare
+compile: lzma-loader-compile
+install: $(BIN_DIR)/openwrt-brcm-$(KERNEL)-$(FS).trx
+
diff --git a/openwrt/target/lzma-loader/Makefile b/openwrt/target/linux/image/brcm/lzma-loader/Makefile
index e46e6c4ef..e46e6c4ef 100644
--- a/openwrt/target/lzma-loader/Makefile
+++ b/openwrt/target/linux/image/brcm/lzma-loader/Makefile
diff --git a/openwrt/target/lzma-loader/patches/toolchain.patch b/openwrt/target/linux/image/brcm/lzma-loader/patches/toolchain.patch
index 81f92b26e..81f92b26e 100644
--- a/openwrt/target/lzma-loader/patches/toolchain.patch
+++ b/openwrt/target/linux/image/brcm/lzma-loader/patches/toolchain.patch
diff --git a/openwrt/target/linux/image/jffs2.mk b/openwrt/target/linux/image/jffs2.mk
new file mode 100644
index 000000000..02c56817b
--- /dev/null
+++ b/openwrt/target/linux/image/jffs2.mk
@@ -0,0 +1,30 @@
+JFFS2OPTS := --pad --little-endian --squash
+#JFFS2OPTS += -Xlzo -msize -Xlzari
+
+jffs2-prepare:
+ $(MAKE) -C jffs2 prepare
+
+jffs2-compile:
+ $(MAKE) -C jffs2 compile
+
+jffs2-clean:
+ $(MAKE) -C jffs2 clean
+ rm -f $(KDIR)/root.jffs2*
+
+$(KDIR)/root.jffs2-4MB:
+ @rm -rf $(KDIR)/root/jffs
+ $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $@ -d $(KDIR)/root
+
+$(KDIR)/root.jffs2-8MB:
+ @rm -rf $(KDIR)/root/jffs
+ $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $@ -d $(KDIR)/root
+
+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"
+
+prepare: jffs2-prepare
+compile: jffs2-compile
+install: jffs2-install
+clean: jffs2-clean
+
diff --git a/openwrt/target/jffs2/Makefile b/openwrt/target/linux/image/jffs2/Makefile
index 40acb1032..8734ee225 100644
--- a/openwrt/target/jffs2/Makefile
+++ b/openwrt/target/linux/image/jffs2/Makefile
@@ -5,8 +5,6 @@ MTD_SOURCE=mtd_20050122.orig.tar.gz
MTD_SITE=http://ftp.debian.org/debian/pool/main/m/mtd
MTD_MD5SUM:=1f42c2cae08eb9e7b52d0c188f8d6338
MKFS_JFFS2=$(MTD_DIR)/util/mkfs.jffs2
-JFFS2OPTS := --pad --little-endian --squash
-#JFFS2OPTS += -Xlzo -msize -Xlzari
$(DL_DIR)/$(MTD_SOURCE):
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(MTD_SOURCE) $(MTD_MD5SUM) $(MTD_SITE)
@@ -21,23 +19,6 @@ $(MTD_DIR)/util/mkfs.jffs2: $(MTD_DIR)/.unpacked
$(STAGING_DIR)/bin/mkfs.jffs2: $(MTD_DIR)/util/mkfs.jffs2
cp $< $@
-define jffs2-4MB_template
- @rm -rf $(1)/root/jffs
- $(MKFS_JFFS2) $(JFFS2OPTS) -e 0x10000 -o $(1)/root.jffs2-4MB -d $(1)/root
- PATH=$(TARGET_PATH) trx -o $@ $(BUILD_DIR)/loader.gz \
- $(1)/kernel-image -a 0x10000 $(1)/root.jffs2-4MB
-endef
-
-define jffs2-8MB_template
- @rm -rf $(1)/root/jffs
- $(MKFS_JFFS2) $(JFFS2OPTS) -e 0x20000 -o $(1)/root.jffs2-8MB -d $(1)/root
- PATH=$(TARGET_PATH) trx -o $@ $(BUILD_DIR)/loader.gz \
- $(1)/kernel-image -a 0x10000 $(1)/root.jffs2-8MB
-endef
-
-FILESYSTEMS:=jffs2-4MB jffs2-8MB
-include ../image.mk
-
source: $(DL_DIR)/$(MTD_SOURCE)
prepare: $(MTD_DIR)/.unpacked
compile: $(MTD_DIR)/util/mkfs.jffs2 $(STAGING_DIR)/bin/mkfs.jffs2
diff --git a/openwrt/target/linux/image/squashfs.mk b/openwrt/target/linux/image/squashfs.mk
new file mode 100644
index 000000000..e9a95de56
--- /dev/null
+++ b/openwrt/target/linux/image/squashfs.mk
@@ -0,0 +1,19 @@
+squashfs-prepare:
+ $(MAKE) -C squashfs prepare
+
+squashfs-compile:
+ $(MAKE) -C squashfs compile
+
+squashfs-clean:
+ $(MAKE) -C squashfs clean
+ rm -f $(KDIR)/root.squashfs
+
+$(KDIR)/root.squashfs:
+ @mkdir -p $(KDIR)/root/jffs
+ $(STAGING_DIR)/bin/mksquashfs-lzma $(KDIR)/root $@ -noappend -root-owned -le
+
+prepare: squashfs-prepare
+compile: squashfs-compile
+install: $(KDIR)/root.squashfs
+ $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="squashfs"
+
diff --git a/openwrt/target/squashfs-lzma/Makefile b/openwrt/target/linux/image/squashfs/Makefile
index 3a61d0623..354a39bbe 100644
--- a/openwrt/target/squashfs-lzma/Makefile
+++ b/openwrt/target/linux/image/squashfs/Makefile
@@ -25,12 +25,3 @@ compile: $(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR)/bin/m
install:
clean:
rm -rf $(SQUASHFSLZMA_DIR)
-
-FILESYSTEMS:=squashfs
-define squashfs_template
- @mkdir -p $(1)/root/jffs
- PATH=$(TARGET_PATH) mksquashfs-lzma $(1)/root $(1)/root.squashfs -noappend -root-owned -le
- PATH=$(TARGET_PATH) trx -o $@ $(BUILD_DIR)/loader.gz \
- $(1)/kernel-image $(1)/root.squashfs
-endef
-include ../image.mk
diff --git a/openwrt/target/squashfs-lzma/patches/100-lzma.patch b/openwrt/target/linux/image/squashfs/patches/100-lzma.patch
index 324f8d822..324f8d822 100644
--- a/openwrt/target/squashfs-lzma/patches/100-lzma.patch
+++ b/openwrt/target/linux/image/squashfs/patches/100-lzma.patch
diff --git a/openwrt/target/linux/linux-2.4/Makefile b/openwrt/target/linux/linux-2.4/Makefile
index e8ce928e8..acbd2e129 100644
--- a/openwrt/target/linux/linux-2.4/Makefile
+++ b/openwrt/target/linux/linux-2.4/Makefile
@@ -24,7 +24,6 @@ LINUX_KCONFIG:=./config/$(BOARD)
LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-2.4-$(BOARD)
LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
-LINUX_IMAGE:=$(LINUX_BUILD_DIR)/kernel-image
LINUX_FORMAT=zImage
LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
-e 's/mipsel/mips/' \
@@ -196,9 +195,6 @@ $(LINUX_KERNEL): $(LINUX_DIR)/$(LINUX_BINLOC)
cp -fa $< $@
touch -c $(LINUX_KERNEL)
-$(LINUX_IMAGE): $(LINUX_KERNEL)
- cat $^ | $(BUILD_DIR)/lzma/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
-
$(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
rm -rf $(LINUX_BUILD_DIR)/modules
$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules
diff --git a/openwrt/target/lzma/Makefile b/openwrt/target/lzma/Makefile
index ea63bfec8..b1c0313ed 100644
--- a/openwrt/target/lzma/Makefile
+++ b/openwrt/target/lzma/Makefile
@@ -48,4 +48,5 @@ lzma-dirclean:
prepare: $(LZMA_DIR)/.unpacked
compile: lzma
install: lzma
+ cp $(LZMA_DIR)/lzma $(STAGING_DIR)/bin/
clean: lzma-dirclean