summaryrefslogtreecommitdiffstats
path: root/openwrt/target/linux/image/brcm
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/target/linux/image/brcm')
-rw-r--r--openwrt/target/linux/image/brcm/Makefile47
-rw-r--r--openwrt/target/linux/image/brcm/lzma-loader/Makefile39
-rw-r--r--openwrt/target/linux/image/brcm/lzma-loader/patches/toolchain.patch16
3 files changed, 102 insertions, 0 deletions
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/linux/image/brcm/lzma-loader/Makefile b/openwrt/target/linux/image/brcm/lzma-loader/Makefile
new file mode 100644
index 000000000..e46e6c4ef
--- /dev/null
+++ b/openwrt/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/openwrt/target/linux/image/brcm/lzma-loader/patches/toolchain.patch b/openwrt/target/linux/image/brcm/lzma-loader/patches/toolchain.patch
new file mode 100644
index 000000000..81f92b26e
--- /dev/null
+++ b/openwrt/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)