diff options
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/Makefile | 20 | ||||
-rw-r--r-- | target/linux/image/Makefile | 24 | ||||
-rw-r--r-- | target/linux/image/brcm/Makefile | 47 | ||||
-rw-r--r-- | target/linux/image/brcm/lzma-loader/Makefile | 39 | ||||
-rw-r--r-- | target/linux/image/brcm/lzma-loader/patches/toolchain.patch | 16 | ||||
-rw-r--r-- | target/linux/image/jffs2.mk | 30 | ||||
-rw-r--r-- | target/linux/image/jffs2/Makefile | 28 | ||||
-rw-r--r-- | target/linux/image/squashfs.mk | 19 | ||||
-rw-r--r-- | target/linux/image/squashfs/Makefile | 27 | ||||
-rw-r--r-- | target/linux/image/squashfs/patches/100-lzma.patch | 22 | ||||
-rw-r--r-- | target/linux/linux-2.4/Makefile | 4 |
11 files changed, 264 insertions, 12 deletions
diff --git a/target/linux/Makefile b/target/linux/Makefile index d1b4d545a..604c739b5 100644 --- a/target/linux/Makefile +++ b/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/target/linux/image/Makefile b/target/linux/image/Makefile new file mode 100644 index 000000000..6b7c78774 --- /dev/null +++ b/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/target/linux/image/brcm/Makefile b/target/linux/image/brcm/Makefile new file mode 100644 index 000000000..2cff6af87 --- /dev/null +++ b/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/target/linux/image/brcm/lzma-loader/Makefile b/target/linux/image/brcm/lzma-loader/Makefile new file mode 100644 index 000000000..e46e6c4ef --- /dev/null +++ b/target/linux/image/brcm/lzma-loader/Makefile @@ -0,0 +1,39 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME := loader +PKG_VERSION := 0.04 +PKG_MD5SUM := c0b7c36232d3910c425d03e56d0f532b + +PKG_SOURCE_SITE := http://wl500g.dyndns.org/loader/ +PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_CAT := zcat +PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR) + +$(DL_DIR)/$(PKG_SOURCE_FILE): + mkdir -p $(DL_DIR) + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) $(PKG_MD5SUM) $(PKG_SOURCE_SITE) + +$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE) + mkdir -p $(TOOL_BUILD_DIR) + $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + $(PATCH) $(PKG_BUILD_DIR) ./patches + touch $(PKG_BUILD_DIR)/.patched + +$(PKG_BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/.patched + $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \ + LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS) + +$(BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/loader.gz + cp $< $@ + +source: $(DL_DIR)/$(PKG_SOURCE_FILE) +prepare: $(PKG_BUILD_DIR)/.patched +compile: $(BUILD_DIR)/loader.gz +install: + +clean: + rm -rf $(PKG_BUILD_DIR) + rm -f $(BUILD_DIR)/loader.gz diff --git a/target/linux/image/brcm/lzma-loader/patches/toolchain.patch b/target/linux/image/brcm/lzma-loader/patches/toolchain.patch new file mode 100644 index 000000000..81f92b26e --- /dev/null +++ b/target/linux/image/brcm/lzma-loader/patches/toolchain.patch @@ -0,0 +1,16 @@ +diff -Nur loader-0.04/Makefile loader-0.04-owrt/Makefile +--- loader-0.04/Makefile 2005-03-08 11:32:32.000000000 +0100 ++++ loader-0.04-owrt/Makefile 2005-04-30 13:44:39.000000000 +0200 +@@ -22,9 +22,10 @@ + + OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S + +-CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ ++CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ + -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \ +- -ffunction-sections -pipe -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern ++ -ffunction-sections -pipe -mlong-calls -fno-common \ ++ -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap + CFLAGS += -DLOADADDR=$(TEXT_START) -D_LZMA_IN_CB + + ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DBZ_TEXT_START=$(BZ_TEXT_START) diff --git a/target/linux/image/jffs2.mk b/target/linux/image/jffs2.mk new file mode 100644 index 000000000..02c56817b --- /dev/null +++ b/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/target/linux/image/jffs2/Makefile b/target/linux/image/jffs2/Makefile new file mode 100644 index 000000000..8734ee225 --- /dev/null +++ b/target/linux/image/jffs2/Makefile @@ -0,0 +1,28 @@ +include $(TOPDIR)/rules.mk + +MTD_DIR:=$(BUILD_DIR)/mtd-20050122.orig +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 + +$(DL_DIR)/$(MTD_SOURCE): + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(MTD_SOURCE) $(MTD_MD5SUM) $(MTD_SITE) + +$(MTD_DIR)/.unpacked: $(DL_DIR)/$(MTD_SOURCE) + zcat $(DL_DIR)/$(MTD_SOURCE) | tar -C $(BUILD_DIR) -xvf - + touch $(MTD_DIR)/.unpacked + +$(MTD_DIR)/util/mkfs.jffs2: $(MTD_DIR)/.unpacked + $(MAKE) LINUXDIR=$(LINUX_DIR) -C $(MTD_DIR)/util + +$(STAGING_DIR)/bin/mkfs.jffs2: $(MTD_DIR)/util/mkfs.jffs2 + cp $< $@ + +source: $(DL_DIR)/$(MTD_SOURCE) +prepare: $(MTD_DIR)/.unpacked +compile: $(MTD_DIR)/util/mkfs.jffs2 $(STAGING_DIR)/bin/mkfs.jffs2 +install: +clean: + rm -rf $(MTD_DIR) + diff --git a/target/linux/image/squashfs.mk b/target/linux/image/squashfs.mk new file mode 100644 index 000000000..e9a95de56 --- /dev/null +++ b/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/target/linux/image/squashfs/Makefile b/target/linux/image/squashfs/Makefile new file mode 100644 index 000000000..354a39bbe --- /dev/null +++ b/target/linux/image/squashfs/Makefile @@ -0,0 +1,27 @@ +include $(TOPDIR)/rules.mk + +SQUASHFSLZMA_DIR=$(BUILD_DIR)/squashfs2.1-r2 +SQUASHFSLZMA_SOURCE=squashfs2.1-r2.tar.gz +SQUASHFSLZMA_SITE=@SF/squashfs +SQUASHFSLZMA_MD5SUM=ffa24eff13b2ca51ed6990d15237e4c1 + +$(DL_DIR)/$(SQUASHFSLZMA_SOURCE): + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(SQUASHFSLZMA_SOURCE) $(SQUASHFSLZMA_MD5SUM) $(SQUASHFSLZMA_SITE) + +$(SQUASHFSLZMA_DIR)/.unpacked: $(DL_DIR)/$(SQUASHFSLZMA_SOURCE) + zcat $(DL_DIR)/$(SQUASHFSLZMA_SOURCE) | tar -C $(BUILD_DIR) -xvf - + $(PATCH) $(SQUASHFSLZMA_DIR) ./patches + touch $(SQUASHFSLZMA_DIR)/.unpacked + +$(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma: $(SQUASHFSLZMA_DIR)/.unpacked + $(MAKE) -C $(SQUASHFSLZMA_DIR)/squashfs-tools mksquashfs-lzma LZMAPATH=$(BUILD_DIR)/lzma + +$(STAGING_DIR)/bin/mksquashfs-lzma: $(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma + cp $< $@ + +source: $(DL_DIR)/$(SQUASHFSLZMA_SOURCE) +prepare: $(SQUASHFSLZMA_DIR)/.unpacked +compile: $(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR)/bin/mksquashfs-lzma +install: +clean: + rm -rf $(SQUASHFSLZMA_DIR) diff --git a/target/linux/image/squashfs/patches/100-lzma.patch b/target/linux/image/squashfs/patches/100-lzma.patch new file mode 100644 index 000000000..324f8d822 --- /dev/null +++ b/target/linux/image/squashfs/patches/100-lzma.patch @@ -0,0 +1,22 @@ +--- squashfs2.0/squashfs-tools/Makefile 2004-04-30 19:29:35.000000000 +0400 ++++ squashfs-tools/Makefile 2005-01-20 14:57:53.423668596 +0300 +@@ -1,12 +1,18 @@ + INCLUDEDIR = . ++#LZMAPATH = ../lzma/SRC/7zip/Compress/LZMA_Lib + + CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 + + mksquashfs: mksquashfs.o read_fs.o sort.o + $(CC) mksquashfs.o read_fs.o sort.o -lz -o $@ + ++mksquashfs-lzma: mksquashfs.o read_fs.o sort.o ++ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma -o $@ ++ + mksquashfs.o: mksquashfs.c mksquashfs.h + + read_fs.o: read_fs.c read_fs.h + + sort.o: sort.c ++ ++clean: ++ rm -f *.o mksquashfs mksquashfs-lzma diff --git a/target/linux/linux-2.4/Makefile b/target/linux/linux-2.4/Makefile index e8ce928e8..acbd2e129 100644 --- a/target/linux/linux-2.4/Makefile +++ b/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 |