move target/linux/image to target/image
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 21 Jun 2006 14:02:29 +0000 (14:02 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 21 Jun 2006 14:02:29 +0000 (14:02 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4040 3c298f89-4303-0410-b956-a3cf2f4a3e73

89 files changed:
include/target.mk [new file with mode: 0644]
target/Makefile
target/image/ar7/Makefile [new file with mode: 0644]
target/image/ar7/sercomm/adam2.bin [new file with mode: 0644]
target/image/ar7/sercomm/dg834 [new file with mode: 0644]
target/image/ar7/sercomm/jdr454wb [new file with mode: 0644]
target/image/ar7/src/LzmaDecode.c [new file with mode: 0644]
target/image/ar7/src/LzmaDecode.h [new file with mode: 0644]
target/image/ar7/src/gzip.h [new file with mode: 0644]
target/image/ar7/src/ld.script.in [new file with mode: 0644]
target/image/ar7/src/loader.c [new file with mode: 0644]
target/image/ar7/src/srec2bin.c [new file with mode: 0644]
target/image/ar7/src/zimage.script.in [new file with mode: 0644]
target/image/aruba/Makefile [new file with mode: 0644]
target/image/aruba/addVersion [new file with mode: 0755]
target/image/aruba/version [new file with mode: 0644]
target/image/au1000/Makefile [new file with mode: 0644]
target/image/brcm/Makefile [new file with mode: 0644]
target/image/brcm/lzma-loader/Makefile [new file with mode: 0644]
target/image/brcm/lzma-loader/src/LzmaDecode.c [new file with mode: 0644]
target/image/brcm/lzma-loader/src/LzmaDecode.h [new file with mode: 0644]
target/image/brcm/lzma-loader/src/Makefile [new file with mode: 0644]
target/image/brcm/lzma-loader/src/README [new file with mode: 0644]
target/image/brcm/lzma-loader/src/decompress.c [new file with mode: 0644]
target/image/brcm/lzma-loader/src/decompress.lds.in [new file with mode: 0644]
target/image/brcm/lzma-loader/src/head.S [new file with mode: 0644]
target/image/brcm/lzma-loader/src/loader.lds.in [new file with mode: 0644]
target/image/generic/Makefile [new file with mode: 0644]
target/image/generic/lzma-loader/Makefile [new file with mode: 0644]
target/image/generic/lzma-loader/src/LzmaDecode.c [new file with mode: 0644]
target/image/generic/lzma-loader/src/LzmaDecode.h [new file with mode: 0644]
target/image/generic/lzma-loader/src/Makefile [new file with mode: 0644]
target/image/generic/lzma-loader/src/decompress.c [new file with mode: 0644]
target/image/generic/lzma-loader/src/lzma-copy.lds.in [new file with mode: 0644]
target/image/generic/lzma-loader/src/lzma.lds.in [new file with mode: 0644]
target/image/generic/lzma-loader/src/print.c [new file with mode: 0644]
target/image/generic/lzma-loader/src/print.h [new file with mode: 0644]
target/image/generic/lzma-loader/src/printf.c [new file with mode: 0644]
target/image/generic/lzma-loader/src/printf.h [new file with mode: 0644]
target/image/generic/lzma-loader/src/start.S [new file with mode: 0644]
target/image/generic/lzma-loader/src/uart16550.c [new file with mode: 0644]
target/image/generic/lzma-loader/src/uart16550.h [new file with mode: 0644]
target/image/rb532/Makefile [new file with mode: 0644]
target/image/x86/Makefile [new file with mode: 0644]
target/image/xscale/Makefile [new file with mode: 0644]
target/linux/Makefile
target/linux/image/ar7/Makefile [deleted file]
target/linux/image/ar7/sercomm/adam2.bin [deleted file]
target/linux/image/ar7/sercomm/dg834 [deleted file]
target/linux/image/ar7/sercomm/jdr454wb [deleted file]
target/linux/image/ar7/src/LzmaDecode.c [deleted file]
target/linux/image/ar7/src/LzmaDecode.h [deleted file]
target/linux/image/ar7/src/gzip.h [deleted file]
target/linux/image/ar7/src/ld.script.in [deleted file]
target/linux/image/ar7/src/loader.c [deleted file]
target/linux/image/ar7/src/srec2bin.c [deleted file]
target/linux/image/ar7/src/zimage.script.in [deleted file]
target/linux/image/aruba/Makefile [deleted file]
target/linux/image/aruba/addVersion [deleted file]
target/linux/image/aruba/version [deleted file]
target/linux/image/au1000/Makefile [deleted file]
target/linux/image/brcm/Makefile [deleted file]
target/linux/image/brcm/lzma-loader/Makefile [deleted file]
target/linux/image/brcm/lzma-loader/src/LzmaDecode.c [deleted file]
target/linux/image/brcm/lzma-loader/src/LzmaDecode.h [deleted file]
target/linux/image/brcm/lzma-loader/src/Makefile [deleted file]
target/linux/image/brcm/lzma-loader/src/README [deleted file]
target/linux/image/brcm/lzma-loader/src/decompress.c [deleted file]
target/linux/image/brcm/lzma-loader/src/decompress.lds.in [deleted file]
target/linux/image/brcm/lzma-loader/src/head.S [deleted file]
target/linux/image/brcm/lzma-loader/src/loader.lds.in [deleted file]
target/linux/image/generic/Makefile [deleted file]
target/linux/image/generic/lzma-loader/Makefile [deleted file]
target/linux/image/generic/lzma-loader/src/LzmaDecode.c [deleted file]
target/linux/image/generic/lzma-loader/src/LzmaDecode.h [deleted file]
target/linux/image/generic/lzma-loader/src/Makefile [deleted file]
target/linux/image/generic/lzma-loader/src/decompress.c [deleted file]
target/linux/image/generic/lzma-loader/src/lzma-copy.lds.in [deleted file]
target/linux/image/generic/lzma-loader/src/lzma.lds.in [deleted file]
target/linux/image/generic/lzma-loader/src/print.c [deleted file]
target/linux/image/generic/lzma-loader/src/print.h [deleted file]
target/linux/image/generic/lzma-loader/src/printf.c [deleted file]
target/linux/image/generic/lzma-loader/src/printf.h [deleted file]
target/linux/image/generic/lzma-loader/src/start.S [deleted file]
target/linux/image/generic/lzma-loader/src/uart16550.c [deleted file]
target/linux/image/generic/lzma-loader/src/uart16550.h [deleted file]
target/linux/image/rb532/Makefile [deleted file]
target/linux/image/x86/Makefile [deleted file]
target/linux/image/xscale/Makefile [deleted file]

diff --git a/include/target.mk b/include/target.mk
new file mode 100644 (file)
index 0000000..afdf5d8
--- /dev/null
@@ -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
+
+
index 0a14344..836469d 100644 (file)
@@ -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/image/ar7/Makefile b/target/image/ar7/Makefile
new file mode 100644 (file)
index 0000000..5ee6b0d
--- /dev/null
@@ -0,0 +1,95 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/ar7loader
+
+LOADADDR := 0x94020000
+OUTPUT_FORMAT := elf32-tradlittlemips
+
+CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
+       -pipe -mlong-calls -fno-common \
+       -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \
+       -DLOADADDR=$(LOADADDR)
+
+$(PKG_BUILD_DIR)/cksum.o: $(PKG_BUILD_DIR)/cksum.c
+       $(HOSTCC) -o $@ $<
+
+$(PKG_BUILD_DIR)/ckmain.o: $(PKG_BUILD_DIR)/ckmain.c
+       $(HOSTCC) -o $@ $<
+
+$(PKG_BUILD_DIR)/tichksum: $(PKG_BUILD_DIR)/ckmain.o $(PKG_BUILD_DIR)/cksum.o
+       $(HOSTCC) -o $@ $<
+
+$(PKG_BUILD_DIR)/LzmaDecode.o: src/LzmaDecode.c
+       $(TARGET_CC) $(CFLAGS) -c -o $@ $<
+
+$(PKG_BUILD_DIR)/loader.o: src/loader.c
+       $(TARGET_CC) $(CFLAGS) -c -o $@ $<
+
+$(STAGING_DIR)/bin/srec2bin: src/srec2bin.c
+       $(HOSTCC) -o $@ $<
+
+
+define Build/Compile
+       mkdir -p $(PKG_BUILD_DIR)
+       sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
+           -e 's/@@LOADADDR@@/$(LOADADDR)/' \
+                       < src/zimage.script.in \
+                       > $(PKG_BUILD_DIR)/zimage.script
+       sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
+           -e 's/@@LOADADDR@@/$(LOADADDR)/' \
+                       < src/ld.script.in \
+                       > $(PKG_BUILD_DIR)/ld.script
+       $(MAKE) $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin
+endef
+
+define Build/Clean
+       rm -rf $(PKG_BUILD_DIR)
+endef
+
+define Image/Prepare
+       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+       $(TARGET_CROSS)ld -T $(PKG_BUILD_DIR)/zimage.script -r -b binary $(KDIR)/vmlinux.lzma -o $(KDIR)/zimage.o
+       $(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=0x$${shell nm $(KDIR)/linux-*/vmlinux | grep kernel_entry | cut -d' ' -f1} -T $(PKG_BUILD_DIR)/ld.script \
+               $(PKG_BUILD_DIR)/loader.o \
+               $(PKG_BUILD_DIR)/LzmaDecode.o \
+               $(KDIR)/zimage.o \
+               -o $(KDIR)/loader
+       $(TARGET_CROSS)objcopy -O srec $(KDIR)/loader $(KDIR)/ram_zimage.sre
+       $(STAGING_DIR)/bin/srec2bin $(KDIR)/ram_zimage.sre $(KDIR)/vmlinux.bin
+endef
+
+ifeq ($(FS),jffs2-8MB)
+ALIGN:=bs=131072 conv=sync
+endif
+ifeq ($(FS),jffs2-4MB)
+ALIGN:=bs=65536 conv=sync
+endif
+
+define Image/Build/CyberTAN
+       (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin) | \
+               $(STAGING_DIR)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
+endef
+
+define Image/Build/sErCoMm
+       cat sercomm/adam2.bin "$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin" > "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img"
+       dd if=sercomm/$(2) of="$(KDIR)/dgfw.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc
+       $(STAGING_DIR)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img" "$(KDIR)/dgfw.tmp"
+       rm -f "$(KDIR)/dgfw.tmp"
+endef
+
+define Image/Build
+       dd if=$(KDIR)/vmlinux.bin $(ALIGN) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
+       cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
+       $(call Image/Build/CyberTAN,$(1),AG1B,AG1B,$(1))
+       $(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
+       $(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
+       $(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
+       $(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
+       $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
+       $(call Image/Build/sErCoMm,$(1),dg834,$(1))
+       $(call Image/Build/sErCoMm,$(1),jdr454wb,$(1))
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/image/ar7/sercomm/adam2.bin b/target/image/ar7/sercomm/adam2.bin
new file mode 100644 (file)
index 0000000..d4aa0cd
Binary files /dev/null and b/target/image/ar7/sercomm/adam2.bin differ
diff --git a/target/image/ar7/sercomm/dg834 b/target/image/ar7/sercomm/dg834
new file mode 100644 (file)
index 0000000..61fe336
Binary files /dev/null and b/target/image/ar7/sercomm/dg834 differ
diff --git a/target/image/ar7/sercomm/jdr454wb b/target/image/ar7/sercomm/jdr454wb
new file mode 100644 (file)
index 0000000..821ff1c
Binary files /dev/null and b/target/image/ar7/sercomm/jdr454wb differ
diff --git a/target/image/ar7/src/LzmaDecode.c b/target/image/ar7/src/LzmaDecode.c
new file mode 100644 (file)
index 0000000..951700b
--- /dev/null
@@ -0,0 +1,663 @@
+/*
+  LzmaDecode.c
+  LZMA Decoder
+  
+  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
+  http://www.7-zip.org/
+
+  LZMA SDK is licensed under two licenses:
+  1) GNU Lesser General Public License (GNU LGPL)
+  2) Common Public License (CPL)
+  It means that you can select one of these two licenses and 
+  follow rules of that license.
+
+  SPECIAL EXCEPTION:
+  Igor Pavlov, as the author of this code, expressly permits you to 
+  statically or dynamically link your code (or bind by name) to the 
+  interfaces of this file without subjecting your linked code to the 
+  terms of the CPL or GNU LGPL. Any modifications or additions 
+  to this file, however, are subject to the LGPL or CPL terms.
+*/
+
+#include "LzmaDecode.h"
+
+#ifndef Byte
+#define Byte unsigned char
+#endif
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+typedef struct _CRangeDecoder
+{
+  Byte *Buffer;
+  Byte *BufferLim;
+  UInt32 Range;
+  UInt32 Code;
+  #ifdef _LZMA_IN_CB
+  ILzmaInCallback *InCallback;
+  int Result;
+  #endif
+  int ExtraBytes;
+} CRangeDecoder;
+
+Byte RangeDecoderReadByte(CRangeDecoder *rd)
+{
+  if (rd->Buffer == rd->BufferLim)
+  {
+    #ifdef _LZMA_IN_CB
+    UInt32 size;
+    rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
+    rd->BufferLim = rd->Buffer + size;
+    if (size == 0)
+    #endif
+    {
+      rd->ExtraBytes = 1;
+      return 0xFF;
+    }
+  }
+  return (*rd->Buffer++);
+}
+
+/* #define ReadByte (*rd->Buffer++) */
+#define ReadByte (RangeDecoderReadByte(rd))
+
+void RangeDecoderInit(CRangeDecoder *rd,
+  #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback
+  #else
+    Byte *stream, UInt32 bufferSize
+  #endif
+    )
+{
+  int i;
+  #ifdef _LZMA_IN_CB
+  rd->InCallback = inCallback;
+  rd->Buffer = rd->BufferLim = 0;
+  #else
+  rd->Buffer = stream;
+  rd->BufferLim = stream + bufferSize;
+  #endif
+  rd->ExtraBytes = 0;
+  rd->Code = 0;
+  rd->Range = (0xFFFFFFFF);
+  for(i = 0; i < 5; i++)
+    rd->Code = (rd->Code << 8) | ReadByte;
+}
+
+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;        
+#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
+#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
+
+UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
+{
+  RC_INIT_VAR
+  UInt32 result = 0;
+  int i;
+  for (i = numTotalBits; i > 0; i--)
+  {
+    /* UInt32 t; */
+    range >>= 1;
+
+    result <<= 1;
+    if (code >= range)
+    {
+      code -= range;
+      result |= 1;
+    }
+    /*
+    t = (code - range) >> 31;
+    t &= 1;
+    code -= range & (t - 1);
+    result = (result + result) | (1 - t);
+    */
+    RC_NORMALIZE
+  }
+  RC_FLUSH_VAR
+  return result;
+}
+
+int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
+{
+  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
+  if (rd->Code < bound)
+  {
+    rd->Range = bound;
+    *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
+    if (rd->Range < kTopValue)
+    {
+      rd->Code = (rd->Code << 8) | ReadByte;
+      rd->Range <<= 8;
+    }
+    return 0;
+  }
+  else
+  {
+    rd->Range -= bound;
+    rd->Code -= bound;
+    *prob -= (*prob) >> kNumMoveBits;
+    if (rd->Range < kTopValue)
+    {
+      rd->Code = (rd->Code << 8) | ReadByte;
+      rd->Range <<= 8;
+    }
+    return 1;
+  }
+}
+
+#define RC_GET_BIT2(prob, mi, A0, A1) \
+  UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
+  if (code < bound) \
+    { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
+  else \
+    { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
+  RC_NORMALIZE
+
+#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)               
+
+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
+{
+  int mi = 1;
+  int i;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  for(i = numLevels; i > 0; i--)
+  {
+    #ifdef _LZMA_LOC_OPT
+    CProb *prob = probs + mi;
+    RC_GET_BIT(prob, mi)
+    #else
+    mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
+    #endif
+  }
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return mi - (1 << numLevels);
+}
+
+int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
+{
+  int mi = 1;
+  int i;
+  int symbol = 0;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  for(i = 0; i < numLevels; i++)
+  {
+    #ifdef _LZMA_LOC_OPT
+    CProb *prob = probs + mi;
+    RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
+    #else
+    int bit = RangeDecoderBitDecode(probs + mi, rd);
+    mi = mi + mi + bit;
+    symbol |= (bit << i);
+    #endif
+  }
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return symbol;
+}
+
+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
+{ 
+  int symbol = 1;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  do
+  {
+    #ifdef _LZMA_LOC_OPT
+    CProb *prob = probs + symbol;
+    RC_GET_BIT(prob, symbol)
+    #else
+    symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
+    #endif
+  }
+  while (symbol < 0x100);
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return symbol;
+}
+
+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
+{ 
+  int symbol = 1;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  do
+  {
+    int bit;
+    int matchBit = (matchByte >> 7) & 1;
+    matchByte <<= 1;
+    #ifdef _LZMA_LOC_OPT
+    {
+      CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
+      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
+    }
+    #else
+    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
+    symbol = (symbol << 1) | bit;
+    #endif
+    if (matchBit != bit)
+    {
+      while (symbol < 0x100)
+      {
+        #ifdef _LZMA_LOC_OPT
+        CProb *prob = probs + symbol;
+        RC_GET_BIT(prob, symbol)
+        #else
+        symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
+        #endif
+      }
+      break;
+    }
+  }
+  while (symbol < 0x100);
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return symbol;
+}
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenChoice 0
+#define LenChoice2 (LenChoice + 1)
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
+
+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
+{
+  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
+    return RangeDecoderBitTreeDecode(p + LenLow +
+        (posState << kLenNumLowBits), kLenNumLowBits, rd);
+  if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
+    return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
+        (posState << kLenNumMidBits), kLenNumMidBits, rd);
+  return kLenNumLowSymbols + kLenNumMidSymbols + 
+      RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
+}
+
+#define kNumStates 12
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+
+#define IsMatch 0
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define IsRep0Long (IsRepG2 + kNumStates)
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
+#define LenCoder (Align + kAlignTableSize)
+#define RepLenCoder (LenCoder + kNumLenProbs)
+#define Literal (RepLenCoder + kNumLenProbs)
+
+#if Literal != LZMA_BASE_SIZE
+StopCompilingDueBUG
+#endif
+
+#ifdef _LZMA_OUT_READ
+
+typedef struct _LzmaVarState
+{
+  CRangeDecoder RangeDecoder;
+  Byte *Dictionary;
+  UInt32 DictionarySize;
+  UInt32 DictionaryPos;
+  UInt32 GlobalPos;
+  UInt32 Reps[4];
+  int lc;
+  int lp;
+  int pb;
+  int State;
+  int PreviousIsMatch;
+  int RemainLen;
+} LzmaVarState;
+
+int LzmaDecoderInit(
+    unsigned char *buffer, UInt32 bufferSize,
+    int lc, int lp, int pb,
+    unsigned char *dictionary, UInt32 dictionarySize,
+    #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback
+    #else
+    unsigned char *inStream, UInt32 inSize
+    #endif
+    )
+{
+  LzmaVarState *vs = (LzmaVarState *)buffer;
+  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
+  UInt32 i;
+  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
+    return LZMA_RESULT_NOT_ENOUGH_MEM;
+  vs->Dictionary = dictionary;
+  vs->DictionarySize = dictionarySize;
+  vs->DictionaryPos = 0;
+  vs->GlobalPos = 0;
+  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
+  vs->lc = lc;
+  vs->lp = lp;
+  vs->pb = pb;
+  vs->State = 0;
+  vs->PreviousIsMatch = 0;
+  vs->RemainLen = 0;
+  dictionary[dictionarySize - 1] = 0;
+  for (i = 0; i < numProbs; i++)
+    p[i] = kBitModelTotal >> 1; 
+  RangeDecoderInit(&vs->RangeDecoder, 
+      #ifdef _LZMA_IN_CB
+      inCallback
+      #else
+      inStream, inSize
+      #endif
+  );
+  return LZMA_RESULT_OK;
+}
+
+int LzmaDecode(unsigned char *buffer, 
+    unsigned char *outStream, UInt32 outSize,
+    UInt32 *outSizeProcessed)
+{
+  LzmaVarState *vs = (LzmaVarState *)buffer;
+  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
+  CRangeDecoder rd = vs->RangeDecoder;
+  int state = vs->State;
+  int previousIsMatch = vs->PreviousIsMatch;
+  Byte previousByte;
+  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
+  UInt32 nowPos = 0;
+  UInt32 posStateMask = (1 << (vs->pb)) - 1;
+  UInt32 literalPosMask = (1 << (vs->lp)) - 1;
+  int lc = vs->lc;
+  int len = vs->RemainLen;
+  UInt32 globalPos = vs->GlobalPos;
+
+  Byte *dictionary = vs->Dictionary;
+  UInt32 dictionarySize = vs->DictionarySize;
+  UInt32 dictionaryPos = vs->DictionaryPos;
+
+  if (len == -1)
+  {
+    *outSizeProcessed = 0;
+    return LZMA_RESULT_OK;
+  }
+
+  while(len > 0 && nowPos < outSize)
+  {
+    UInt32 pos = dictionaryPos - rep0;
+    if (pos >= dictionarySize)
+      pos += dictionarySize;
+    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
+    if (++dictionaryPos == dictionarySize)
+      dictionaryPos = 0;
+    len--;
+  }
+  if (dictionaryPos == 0)
+    previousByte = dictionary[dictionarySize - 1];
+  else
+    previousByte = dictionary[dictionaryPos - 1];
+#else
+
+int LzmaDecode(
+    Byte *buffer, UInt32 bufferSize,
+    int lc, int lp, int pb,
+    #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback,
+    #else
+    unsigned char *inStream, UInt32 inSize,
+    #endif
+    unsigned char *outStream, UInt32 outSize,
+    UInt32 *outSizeProcessed)
+{
+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
+  CProb *p = (CProb *)buffer;
+  CRangeDecoder rd;
+  UInt32 i;
+  int state = 0;
+  int previousIsMatch = 0;
+  Byte previousByte = 0;
+  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
+  UInt32 nowPos = 0;
+  UInt32 posStateMask = (1 << pb) - 1;
+  UInt32 literalPosMask = (1 << lp) - 1;
+  int len = 0;
+  if (bufferSize < numProbs * sizeof(CProb))
+    return LZMA_RESULT_NOT_ENOUGH_MEM;
+  for (i = 0; i < numProbs; i++)
+    p[i] = kBitModelTotal >> 1; 
+  RangeDecoderInit(&rd, 
+      #ifdef _LZMA_IN_CB
+      inCallback
+      #else
+      inStream, inSize
+      #endif
+      );
+#endif
+
+  *outSizeProcessed = 0;
+  while(nowPos < outSize)
+  {
+    int posState = (int)(
+        (nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+        & posStateMask);
+    #ifdef _LZMA_IN_CB
+    if (rd.Result != LZMA_RESULT_OK)
+      return rd.Result;
+    #endif
+    if (rd.ExtraBytes != 0)
+      return LZMA_RESULT_DATA_ERROR;
+    if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
+    {
+      CProb *probs = p + Literal + (LZMA_LIT_SIZE * 
+        (((
+        (nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
+
+      if (state < 4) state = 0;
+      else if (state < 10) state -= 3;
+      else state -= 6;
+      if (previousIsMatch)
+      {
+        Byte matchByte;
+        #ifdef _LZMA_OUT_READ
+        UInt32 pos = dictionaryPos - rep0;
+        if (pos >= dictionarySize)
+          pos += dictionarySize;
+        matchByte = dictionary[pos];
+        #else
+        matchByte = outStream[nowPos - rep0];
+        #endif
+        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
+        previousIsMatch = 0;
+      }
+      else
+        previousByte = LzmaLiteralDecode(probs, &rd);
+      outStream[nowPos++] = previousByte;
+      #ifdef _LZMA_OUT_READ
+      dictionary[dictionaryPos] = previousByte;
+      if (++dictionaryPos == dictionarySize)
+        dictionaryPos = 0;
+      #endif
+    }
+    else             
+    {
+      previousIsMatch = 1;
+      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
+      {
+        if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
+        {
+          if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
+          {
+            #ifdef _LZMA_OUT_READ
+            UInt32 pos;
+            #endif
+            if (
+               (nowPos 
+                #ifdef _LZMA_OUT_READ
+                + globalPos
+                #endif
+               )
+               == 0)
+              return LZMA_RESULT_DATA_ERROR;
+            state = state < 7 ? 9 : 11;
+            #ifdef _LZMA_OUT_READ
+            pos = dictionaryPos - rep0;
+            if (pos >= dictionarySize)
+              pos += dictionarySize;
+            previousByte = dictionary[pos];
+            dictionary[dictionaryPos] = previousByte;
+            if (++dictionaryPos == dictionarySize)
+              dictionaryPos = 0;
+            #else
+            previousByte = outStream[nowPos - rep0];
+            #endif
+            outStream[nowPos++] = previousByte;
+            continue;
+          }
+        }
+        else
+        {
+          UInt32 distance;
+          if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
+            distance = rep1;
+          else 
+          {
+            if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
+              distance = rep2;
+            else
+            {
+              distance = rep3;
+              rep3 = rep2;
+            }
+            rep2 = rep1;
+          }
+          rep1 = rep0;
+          rep0 = distance;
+        }
+        len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
+        state = state < 7 ? 8 : 11;
+      }
+      else
+      {
+        int posSlot;
+        rep3 = rep2;
+        rep2 = rep1;
+        rep1 = rep0;
+        state = state < 7 ? 7 : 10;
+        len = LzmaLenDecode(p + LenCoder, &rd, posState);
+        posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
+            kNumPosSlotBits), kNumPosSlotBits, &rd);
+        if (posSlot >= kStartPosModelIndex)
+        {
+          int numDirectBits = ((posSlot >> 1) - 1);
+          rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
+          if (posSlot < kEndPosModelIndex)
+          {
+            rep0 += RangeDecoderReverseBitTreeDecode(
+                p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
+          }
+          else
+          {
+            rep0 += RangeDecoderDecodeDirectBits(&rd, 
+                numDirectBits - kNumAlignBits) << kNumAlignBits;
+            rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
+          }
+        }
+        else
+          rep0 = posSlot;
+        rep0++;
+      }
+      if (rep0 == (UInt32)(0))
+      {
+        /* it's for stream version */
+        len = -1;
+        break;
+      }
+      if (rep0 > nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+      {
+        return LZMA_RESULT_DATA_ERROR;
+      }
+      len += kMatchMinLen;
+      do
+      {
+        #ifdef _LZMA_OUT_READ
+        UInt32 pos = dictionaryPos - rep0;
+        if (pos >= dictionarySize)
+          pos += dictionarySize;
+        previousByte = dictionary[pos];
+        dictionary[dictionaryPos] = previousByte;
+        if (++dictionaryPos == dictionarySize)
+          dictionaryPos = 0;
+        #else
+        previousByte = outStream[nowPos - rep0];
+        #endif
+        outStream[nowPos++] = previousByte;
+        len--;
+      }
+      while(len > 0 && nowPos < outSize);
+    }
+  }
+
+  #ifdef _LZMA_OUT_READ
+  vs->RangeDecoder = rd;
+  vs->DictionaryPos = dictionaryPos;
+  vs->GlobalPos = globalPos + nowPos;
+  vs->Reps[0] = rep0;
+  vs->Reps[1] = rep1;
+  vs->Reps[2] = rep2;
+  vs->Reps[3] = rep3;
+  vs->State = state;
+  vs->PreviousIsMatch = previousIsMatch;
+  vs->RemainLen = len;
+  #endif
+
+  *outSizeProcessed = nowPos;
+  return LZMA_RESULT_OK;
+}
diff --git a/target/image/ar7/src/LzmaDecode.h b/target/image/ar7/src/LzmaDecode.h
new file mode 100644 (file)
index 0000000..f58944e
--- /dev/null
@@ -0,0 +1,100 @@
+/* 
+  LzmaDecode.h
+  LZMA Decoder interface
+
+  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
+  http://www.7-zip.org/
+
+  LZMA SDK is licensed under two licenses:
+  1) GNU Lesser General Public License (GNU LGPL)
+  2) Common Public License (CPL)
+  It means that you can select one of these two licenses and 
+  follow rules of that license.
+
+  SPECIAL EXCEPTION:
+  Igor Pavlov, as the author of this code, expressly permits you to 
+  statically or dynamically link your code (or bind by name) to the 
+  interfaces of this file without subjecting your linked code to the 
+  terms of the CPL or GNU LGPL. Any modifications or additions 
+  to this file, however, are subject to the LGPL or CPL terms.
+*/
+
+#ifndef __LZMADECODE_H
+#define __LZMADECODE_H
+
+/* #define _LZMA_IN_CB */
+/* Use callback for input data */
+
+/* #define _LZMA_OUT_READ */
+/* Use read function for output data */
+
+/* #define _LZMA_PROB32 */
+/* It can increase speed on some 32-bit CPUs, 
+   but memory usage will be doubled in that case */
+
+/* #define _LZMA_LOC_OPT */
+/* Enable local speed optimizations inside code */
+
+#ifndef UInt32
+#ifdef _LZMA_UINT32_IS_ULONG
+#define UInt32 unsigned long
+#else
+#define UInt32 unsigned int
+#endif
+#endif
+
+#ifdef _LZMA_PROB32
+#define CProb UInt32
+#else
+#define CProb unsigned short
+#endif
+
+#define LZMA_RESULT_OK 0
+#define LZMA_RESULT_DATA_ERROR 1
+#define LZMA_RESULT_NOT_ENOUGH_MEM 2
+
+#ifdef _LZMA_IN_CB
+typedef struct _ILzmaInCallback
+{
+  int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
+} ILzmaInCallback;
+#endif
+
+#define LZMA_BASE_SIZE 1846
+#define LZMA_LIT_SIZE 768
+
+/* 
+bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
+bufferSize += 100 in case of _LZMA_OUT_READ
+by default CProb is unsigned short, 
+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
+*/
+
+#ifdef _LZMA_OUT_READ
+int LzmaDecoderInit(
+    unsigned char *buffer, UInt32 bufferSize,
+    int lc, int lp, int pb,
+    unsigned char *dictionary, UInt32 dictionarySize,
+  #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback
+  #else
+    unsigned char *inStream, UInt32 inSize
+  #endif
+);
+#endif
+
+int LzmaDecode(
+    unsigned char *buffer, 
+  #ifndef _LZMA_OUT_READ
+    UInt32 bufferSize,
+    int lc, int lp, int pb,
+  #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback,
+  #else
+    unsigned char *inStream, UInt32 inSize,
+  #endif
+  #endif
+    unsigned char *outStream, UInt32 outSize,
+    UInt32 *outSizeProcessed);
+
+#endif
diff --git a/target/image/ar7/src/gzip.h b/target/image/ar7/src/gzip.h
new file mode 100644 (file)
index 0000000..917e666
--- /dev/null
@@ -0,0 +1,51 @@
+//bvb#include "timemmap.h"
+
+#define OF(args)  args
+#define STATIC static
+
+#define WSIZE 0x8000           /* Slideing window size (defined as var
+                                * "window" below) must be at least 32k, 
+                                * and a power of two.  This is the
+                                * data work window used for input buffer
+                                * by the input routine */
+
+typedef unsigned char  uch;
+typedef unsigned short ush;
+typedef unsigned long  ulg;
+
+
+static char *output_data;
+static ulg output_ptr;
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#define NOMEMCPY                /* Does routine memcpy exist? */
+
+//bvb static uch *inbuf;               /* input buffer */
+static uch *window;
+
+//bvb static uch outwin[WSIZE];
+
+//bvb static unsigned insize;          /* valid bytes in inbuf */
+static unsigned inptr;         /* index of next byte to process in inbuf */
+
+static unsigned outcnt;                /* bytes in output buffer */
+
+/* gzip flag byte */
+#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
+#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
+#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
+#define COMMENT      0x10 /* bit 4 set: file comment present */
+#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
+#define RESERVED     0xC0 /* bit 6,7:   reserved */
+
+/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
+#define BMAX 16         /* maximum bit length of any code (16 for explode) */
+#define N_MAX 288       /* maximum number of codes in any set */
+
+static char *input_data;
+
+static void *freememstart;
diff --git a/target/image/ar7/src/ld.script.in b/target/image/ar7/src/ld.script.in
new file mode 100644 (file)
index 0000000..40389e6
--- /dev/null
@@ -0,0 +1,34 @@
+       OUTPUT_FORMAT("@@OUTPUT_FORMAT@@")
+       OUTPUT_ARCH(mips)
+ENTRY(tikernelunzip)
+       SECTIONS
+{
+
+       /* Allocate memory space on top of kernel bss space */
+       . = 0x94200000;
+       .text :
+       {
+               *(.text)
+               *(.rodata)
+               *(.rodata1)
+               *(.gnu.warning)
+               *(.text.init)
+               *(.data.init)
+       }                    
+
+       .data :
+       {
+               *(*)
+       }
+
+       .bss :
+       {
+               *(.dynbss)
+               *(COMMON)
+               *(.bss)
+               *(.sbss)
+               *(.scommon)
+               . = ALIGN (0x8000);
+               workspace = .;
+       }
+}
diff --git a/target/image/ar7/src/loader.c b/target/image/ar7/src/loader.c
new file mode 100644 (file)
index 0000000..22b909d
--- /dev/null
@@ -0,0 +1,140 @@
+/* inflate.c -- Not copyrighted 1992 by Mark Adler
+   version c10p1, 10 January 1993 */
+
+/*
+ * Adapted for booting Linux by Hannu Savolainen 1993
+ * based on gzip-1.0.3
+ *
+ * Nicolas Pitre <nico@visuaide.com>, 1999/04/14 :
+ *   Little mods for all variable to reside either into rodata or bss segments
+ *   by marking constant variables with 'const' and initializing all the others
+ *   at run-time only.  This allows for the kernel uncompressor to run
+ *   directly from Flash or ROM memory on embeded systems.
+ */
+
+#include <linux/config.h>
+#include "gzip.h"
+#include "LzmaDecode.h"
+
+/* Function prototypes */
+unsigned char get_byte(void);
+int tikernelunzip(int,char *[], char *[]);
+static int tidecompress(uch *, uch *);
+
+void kernel_entry(int, char *[], char *[]);
+void (*ke)(int, char *[], char *[]); /* Gen reference to kernel function */
+void (*prnt)(unsigned int, char *);            /* Gen reference to Yamon print function */
+void printf(char *ptr);                        /* Generate our own printf */
+
+int tikernelunzip(int argc, char *argv[], char *arge[])
+{
+       extern unsigned int _ftext;
+       extern uch kernelimage[];
+       uch *in, *out;
+       int status;
+
+       printf("Launching kernel decompressor.\n");
+
+       out = (unsigned char *) LOADADDR;
+       in = &(kernelimage[0]);
+
+       status = tidecompress(in, out);
+
+       if (status == 0) {
+               printf("Kernel decompressor was successful ... launching kernel.\n");
+
+               ke = ( void(*)(int, char *[],char*[]))kernel_entry;
+               (*ke)(argc,argv,arge);
+
+               return (0);
+       } else {
+               printf("Error in decompression.\n");
+               return(1);
+       }
+}
+
+#if 0
+char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+void print_i(int i)
+{
+       int j;
+       char buf[11];
+
+       buf[0] = '0';
+       buf[1] = 'x';
+       buf[10] = 0;
+       
+       for (j = 0; j < 8; j++)
+       {
+               buf[2 + 7 - j] = hex[i & 0xf];
+               i = i >> 4;
+       }
+
+       printf(buf);
+}
+#endif
+
+int tidecompress(uch *indata, uch *outdata)
+{
+       extern unsigned int workspace;
+       extern unsigned char kernelimage[], kernelimage_end[];
+       unsigned int i;  /* temp value */
+       unsigned int lc; /* literal context bits */
+       unsigned int lp; /* literal pos state bits */
+       unsigned int pb; /* pos state bits */
+       unsigned int osize; /* uncompressed size */
+       unsigned int wsize; /* window size */
+       unsigned int insize = kernelimage_end - kernelimage;
+       int status;
+       
+       output_ptr = 0;
+       output_data = outdata;
+       input_data = indata;
+
+       /* lzma args */
+       i = get_byte();
+       lc = i % 9, i = i / 9;
+       lp = i % 5, pb = i / 5;
+
+       /* skip rest of the LZMA coder property */
+       for (i = 0; i < 4; i++)
+               get_byte();
+       
+       /* read the lower half of uncompressed size in the header */
+       osize = ((unsigned int)get_byte()) +
+               ((unsigned int)get_byte() << 8) +
+               ((unsigned int)get_byte() << 16) +
+               ((unsigned int)get_byte() << 24);
+
+       /* skip rest of the header (upper half of uncompressed size) */
+       for (i = 0; i < 4; i++)
+               get_byte();
+       
+       i = 0;
+       wsize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp))) * sizeof(CProb);
+
+       if ((status = LzmaDecode((unsigned char *) &workspace, wsize, lc, lp, pb,
+               indata + 13, insize - 13, (unsigned char *) output_data, osize, &i)) == LZMA_RESULT_OK)
+                       return 0;
+
+       return status;
+}
+
+
+void printf(char *ptr)
+{
+       unsigned int *tempptr = (unsigned int  *)0x90000534;
+       prnt = ( void (*)(unsigned int, char *)) *tempptr;
+       (*prnt)(0,ptr);
+}
+
+unsigned char get_byte()
+{
+       unsigned char c;
+       
+       c = *input_data;
+       input_data++;
+
+       return c;
+}
+
diff --git a/target/image/ar7/src/srec2bin.c b/target/image/ar7/src/srec2bin.c
new file mode 100644 (file)
index 0000000..0eb8b20
--- /dev/null
@@ -0,0 +1,523 @@
+#include <stdio.h>
+#include <ctype.h>
+
+//Rev 0.1 Original
+// 8 Jan 2001  MJH  Added code to write data to Binary file
+//                  note: outputfile is name.bin, where name is first part
+//                  of input file.  ie tmp.rec -> tmp.bin
+//
+//   srec2bin <input SREC file> <Output Binary File> <If Present, Big Endian>
+//
+//   TAG   
+//        bit32u TAG_BIG     = 0xDEADBE42;
+//        bit32u TAG_LITTLE  = 0xFEEDFA42;
+//
+//  File Structure
+//
+//  TAG    :   32 Bits
+//  [DATA RECORDS]
+//
+//  Data Records Structure
+//
+//  LENGTH  :  32 Bits    <- Length of DATA, excludes ADDRESS and CHECKSUM
+//  ADDRESS :  32 Bits
+//  DATA    :  8 Bits * LENGTH
+//  CHECKSUM:  32 Bits    <-  0 - (Sum of Length --> End of Data)
+//
+//  Note : If Length == 0, Address will be Program Start
+//
+//
+//  
+//
+//
+
+#define MajRevNum 0
+#define MinRevNum 2
+
+
+#define EndianSwitch(x) ((x >> 24) | (x << 24) | ((x << 8) & (0x00FF0000)) | ((x >> 8) & (0x0000FF00)) )
+
+typedef unsigned char bit8u;
+typedef unsigned int bit32u;
+typedef int bit32;
+
+#define FALSE 0
+#define TRUE (!FALSE)
+
+
+bit32u CheckSum;
+int RecStart;
+int debug;
+int verbose;
+
+FILE *OpenOutputFile( char *Name );
+FILE *fOut;
+bit32u RecLength=0;
+
+bit32u AddressCurrent;
+
+bit32u gh(char *cp,int nibs);
+
+int BigEndian;
+
+int inputline;
+
+// char buf[16*1024];
+
+char buffer[2048];
+char *cur_ptr;
+int cur_line=0;
+int cur_len=0;
+
+int s1s2s3_total=0;
+
+bit32u PBVal;
+int    PBValid;
+bit32u PBAdr;
+
+
+void dumpfTell(char *s, bit32u Value)
+{
+    int Length;
+    Length = (int) RecLength;
+    if (debug)
+          printf("[%s  ] ftell()[0x%08lX] Length[0x%4X] Length[%4d] Value[0x%08x]\n",
+                s, ftell(fOut), Length, Length, Value);
+}
+
+void DispHex(bit32u Hex)
+{
+//    printf("%X", Hex);
+}
+
+void WaitDisplay(void)
+{
+   static int Count=0;
+   static int Index=0;
+   char iline[]={"-\\|/"};
+
+   Count++;
+   if ((Count % 32)==0)
+   {
+     if (verbose)
+        printf("%c%c",iline[Index++],8);
+     Index &= 3;
+   }
+}
+
+
+void binOut32 ( bit32u Data )
+{
+// On UNIX machine all 32bit writes need ENDIAN switched
+//    Data = EndianSwitch(Data);
+//    fwrite( &Data, sizeof(bit32u), 1, fOut);
+
+   char sdat[4];
+   int i;
+
+   for(i=0;i<4;i++)
+    sdat[i]=(char)(Data>>(i*8));
+   fwrite( sdat, 1, 4, fOut);
+   dumpfTell("Out32" , Data);
+}
+
+// Only update RecLength on Byte Writes
+// All 32 bit writes will be for Length etc
+
+void binOut8 ( bit8u Data )
+{
+    int n;
+    dumpfTell("B4Data" , (bit32u) (Data & 0xFF) );
+    n = fwrite( &Data, sizeof(bit8u), 1, fOut);
+    if (n != 1)
+        printf("Error in writing %X for Address 0x%8X\n", Data, AddressCurrent);
+    RecLength += 1;
+}
+
+//  Currently ONLY used for outputting Program Start
+
+void binRecStart(bit32u Address)
+{
+    RecLength      = 0;
+    CheckSum       = Address;
+    RecStart       = TRUE;
+
+    if (debug)
+          printf("[RecStart] CheckSum[0x%08X] Length[%4d] Address[0x%08X]\n",
+                CheckSum, RecLength, Address);
+
+
+    dumpfTell("RecLength", RecLength);
+    binOut32( RecLength );
+    dumpfTell("Address", Address);
+    binOut32( Address );
+}
+
+void binRecEnd(void)
+{
+    long RecEnd;
+
+    if (!RecStart)   //  if no record started, do not end it
+    {
+        return;
+    }
+
+    RecStart = FALSE;
+
+
+    RecEnd = ftell(fOut);         // Save Current position
+
+    if (debug)
+          printf("[RecEnd  ] CheckSum[0x%08X] Length[%4d] Length[0x%X] RecEnd[0x%08lX]\n",
+                CheckSum, RecLength, RecLength, RecEnd);
+
+    fseek( fOut, -((long) RecLength), SEEK_CUR);  // move back Start Of Data
+
+    dumpfTell("Data   ", -1);
+
+    fseek( fOut, -4, SEEK_CUR);  // move back Start Of Address
+
+    dumpfTell("Address   ", -1);
+
+    fseek( fOut, -4, SEEK_CUR);  // move back Start Of Length
+
+    dumpfTell("Length   ", -1);
+
+    binOut32( RecLength );
+
+    fseek( fOut, RecEnd, SEEK_SET);  // move to end of Record
+
+    CheckSum += RecLength;
+
+    CheckSum =  ~CheckSum + 1;  // Two's complement
+
+    binOut32( CheckSum );
+
+    if (verbose)
+        printf("[Created Record of %d Bytes with CheckSum [0x%8X]\n", RecLength, CheckSum);
+}
+
+void binRecOutProgramStart(bit32u Address)
+{
+    if (Address != (AddressCurrent+1))
+    {
+        binRecEnd();
+        binRecStart(Address);
+    }
+    AddressCurrent = Address;
+}
+void binRecOutByte(bit32u Address, bit8u Data)
+{
+    //  If Address is one after Current Address, output Byte
+    //  If not, close out last record, update Length, write checksum
+    //  Then Start New Record, updating Current Address
+
+    if (Address != (AddressCurrent+1))
+    {
+        binRecEnd();
+        binRecStart(Address);
+    }
+    AddressCurrent = Address;
+    CheckSum += Data;
+    binOut8( Data );
+}
+
+//=============================================================================
+//       SUPPORT FUNCTIONS
+//=============================================================================
+int readline(FILE *fil,char *buf,int len)
+{
+    int rlen;
+    
+    rlen=0;
+    if (len==0)  return(0);
+    while(1)
+    {
+      if (cur_len==0)
+      {
+        cur_len=fread(buffer, 1, sizeof(buffer), fil);
+        if (cur_len==0)
+        {
+          if (rlen)
+          {
+            *buf=0;
+            return(rlen);
+          }
+          return(-1);
+        }
+        cur_ptr=buffer;
+      }
+      if (cur_len)
+      {
+        if (*cur_ptr=='\n')
+        {
+          *buf=0;
+          cur_ptr++;
+          cur_len--;
+          return(rlen);
+        }
+         else
+         {
+           if ((len>1)&&(*cur_ptr!='\r'))
+           {
+             *buf++=*cur_ptr++;
+             len--;
+           }
+           else
+             cur_ptr++;
+
+           rlen++;
+           cur_len--;
+         }
+      }
+      else
+      {
+        *buf=0;
+        cur_ptr++;
+        cur_len--;
+        return(rlen);
+      }
+    }
+}
+
+
+int SRLerrorout(char *c1,char *c2)
+{
+  printf("\nERROR: %s - '%s'.",c1,c2);
+  return(FALSE);
+}
+
+
+int checksum(char *cp,int count)
+{
+  char *scp;
+  int cksum;
+  int dum;
+
+  scp=cp;
+  while(*scp)
+  {
+    if (!isxdigit(*scp++))
+      return(SRLerrorout("Invalid hex digits",cp));
+  }
+  scp=cp;
+
+  cksum=count;
+
+  while(count)
+  {
+    cksum += gh(scp,2);
+    if (count == 2)
+        dum = ~cksum;
+    scp += 2;
+    count--;
+  }
+  cksum&=0x0ff; 
+  //  printf("\nCk:%02x",cksum);
+  return(cksum==0x0ff);
+}
+
+bit32u gh(char *cp,int nibs)
+{
+  int i;
+  bit32u j;
+
+  j=0;
+
+  for(i=0;i<nibs;i++)
+  {
+    j<<=4;
+    if ((*cp>='a')&&(*cp<='z')) *cp &= 0x5f;
+    if ((*cp>='0')&&(*cp<='9')) 
+      j += (*cp-0x30);
+     else
+      if ((*cp>='A')&&(*cp<='F'))
+        j += (*cp-0x37);
+       else
+        SRLerrorout("Bad Hex char", cp);
+    cp++;
+  }
+  return(j);
+}
+
+
+//=============================================================================
+//       PROCESS SREC LINE
+//=============================================================================
+
+int srecLine(char *pSrecLine)
+{
+    char *scp,ch;
+    int  itmp,count,dat;
+    bit32u adr;
+    static bit32u RecordCounter=0;
+
+    cur_line++;
+    scp=pSrecLine;
+  
+    if (*pSrecLine!='S')
+      return(SRLerrorout("Not an Srecord file",scp));
+    pSrecLine++;
+    if (strlen(pSrecLine)<4)
+      return(SRLerrorout("Srecord too short",scp));
+  
+    ch=*pSrecLine++;
+  
+    count=gh(pSrecLine,2);
+  
+    pSrecLine += 2;
+  
+  //  if(debug)
+  //        printf("count %d, strlen(pSrecLine) = %d, pSrecLine =[%s]\n", count, strlen(pSrecLine), pSrecLine);
+     RecordCounter++;
+     DispHex(RecordCounter);
+  
+    if ((count*2) != strlen(pSrecLine)) return(SRLerrorout("Count field larger than record",scp));
+  
+    if (!checksum(pSrecLine, count)) return(SRLerrorout("Bad Checksum",scp));
+  
+    switch(ch)
+    {
+        case '0': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
+                  itmp=gh(pSrecLine,4); pSrecLine+=4; count-=2;
+                  if (itmp) return(SRLerrorout("Srecord 1 address not zero",scp));
+        break;
+        case '1': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
+                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
+        break;
+        case '2': if (count<4) return(SRLerrorout("Invalid Srecord count field",scp));
+                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
+        break;
+        case '3': if (count<5) return(SRLerrorout("Invalid Srecord count field",scp));
+                  adr=gh(pSrecLine,8); pSrecLine+=8; count-=4;
+                  count--;
+                  while(count)
+                  {
+                    dat=gh(pSrecLine,2); pSrecLine+=2; count--;
+                    binRecOutByte(adr, (char) (dat & 0xFF));
+                    adr++;
+                  }
+                  s1s2s3_total++;
+        break;
+        case '4': return(SRLerrorout("Invalid Srecord type",scp));
+        break;
+        case '5': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
+                  itmp=gh(pSrecLine,4); pSrecLine+=4; count-=2;
+                  if (itmp|=s1s2s3_total) return(SRLerrorout("Incorrect number of S3 Record processed",scp));
+        break;
+        case '6': return(SRLerrorout("Invalid Srecord type",scp));
+        break;
+        case '7': // PROGRAM START
+                  if (count<5) return(SRLerrorout("Invalid Srecord count field",scp));
+                  adr=gh(pSrecLine,8); pSrecLine+=8; count-=4;
+                  if (count!=1) return(SRLerrorout("Invalid Srecord count field",scp));
+                  binRecOutProgramStart(adr);
+        break;
+        case '8': if (count<4) return(SRLerrorout("Invalid Srecord count field",scp));
+                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
+        break;
+        case '9': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
+                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
+        break;
+        default:
+        break;
+    }
+    return(TRUE);
+}
+
+//=============================================================================
+//       MAIN LOGIC, READS IN LINE AND OUTPUTS BINARY
+//=============================================================================
+
+int srec2bin(int argc,char *argv[],int verbose)
+{
+    int i,rlen,sts;
+    FILE *fp;
+    char ac;
+    char buff[256];
+    bit32u TAG_BIG     = 0xDEADBE42;
+    bit32u TAG_LITTLE  = 0xFEEDFA42;
+
+    bit32u Tag;
+
+  
+    if(argc < 3)
+    {
+      printf("\nError: <srec2bin <srec input file> <bin output file>\n\n");
+      return(0);
+    }
+  
+    if (argc > 3) BigEndian=TRUE; else BigEndian=FALSE;
+
+    if (BigEndian)
+        Tag = TAG_BIG;
+    else
+        Tag = TAG_LITTLE;
+
+    if (verbose)
+       printf("\nEndian: %s, Tag is 0x%8X\n",(BigEndian)?"BIG":"LITTLE", Tag);
+
+    fp = fopen(argv[1],"rt");
+
+    if (fp==NULL)
+    {
+      printf("\nError: Opening input file, %s.", argv[1]);
+      return(0);
+    }
+  
+    fOut = fopen( argv[2], "wb");
+    
+    if (fOut==NULL)
+    {
+      printf("\nError: Opening Output file, %s.", argv[2]);
+      if(fp) fclose(fp);
+      return(0);
+    }
+    RecStart = FALSE;
+
+    AddressCurrent = 0xFFFFFFFFL;
+
+    // Setup Tag 
+  
+    dumpfTell("Tag", Tag);
+
+    binOut32(Tag);
+
+  
+    inputline=0;
+    sts=TRUE;
+
+    rlen = readline(fp,buff,sizeof buff);
+
+    while( (sts) && (rlen != -1))
+    {
+        if (strlen(buff))
+        {
+            sts &= srecLine(buff);
+            WaitDisplay();
+        }
+       rlen = readline(fp,buff,sizeof buff);
+    }
+
+  
+  //  printf("PC: 0x%08X, Length 0x%08X, Tag 0x%08X\n", ProgramStart, RecLength, TAG_LITTLE);
+  
+    binRecEnd();
+
+    if(fp) fclose(fp);
+    if(fOut) fclose(fOut);
+
+    return(1);
+}
+
+main(int argc, char *argv[])
+{
+    debug = TRUE;
+    debug = FALSE;
+    verbose = FALSE;
+    srec2bin(argc,argv,verbose);
+    return 0;
+}
+
diff --git a/target/image/ar7/src/zimage.script.in b/target/image/ar7/src/zimage.script.in
new file mode 100644 (file)
index 0000000..1a0865b
--- /dev/null
@@ -0,0 +1,11 @@
+       OUTPUT_FORMAT("@@OUTPUT_FORMAT@@")
+OUTPUT_ARCH(mips)
+       SECTIONS
+{
+       .data :
+       {
+               kernelimage = .;
+               *(.data)
+               kernelimage_end = .;
+       }
+}
diff --git a/target/image/aruba/Makefile b/target/image/aruba/Makefile
new file mode 100644 (file)
index 0000000..ad13ffd
--- /dev/null
@@ -0,0 +1,38 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+LOADADDR = 0x81000000          # RAM start + 16M 
+KERNEL_ENTRY = 0x80100000
+RAMSIZE = 0x00100000           # 1MB
+
+LOADER_MAKEOPTS= \
+               KDIR=$(KDIR) \
+               LOADADDR=$(LOADADDR) \
+               KERNEL_ENTRY=$(KERNEL_ENTRY) \
+               RAMSIZE=$(RAMSIZE)
+
+define Build/Clean
+       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
+endef
+
+define Image/Prepare
+       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
+endef
+
+define Image/BuildKernel
+       ./addVersion -n ArubaOS $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari version
+endef
+
+define Image/Build/jffs2-64k
+       @dd if=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari of=$(KDIR)/image.tmp bs=655360 conv=sync
+       @cat $(KDIR)/root.$(1) >> $(KDIR)/image.tmp
+       @dd if=$(KDIR)/image.tmp of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(patsubst jffs2-%,jffs2,$(1)).bin bs=3604480 conv=sync
+       @rm -f $(KDIR)/image.tmp
+endef
+
+define Image/Build
+       $(call Image/Build/$(1),$(1))
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/image/aruba/addVersion b/target/image/aruba/addVersion
new file mode 100755 (executable)
index 0000000..796f73a
Binary files /dev/null and b/target/image/aruba/addVersion differ
diff --git a/target/image/aruba/version b/target/image/aruba/version
new file mode 100644 (file)
index 0000000..fff5589
--- /dev/null
@@ -0,0 +1 @@
+3.0.0.0
diff --git a/target/image/au1000/Makefile b/target/image/au1000/Makefile
new file mode 100644 (file)
index 0000000..3aaf665
--- /dev/null
@@ -0,0 +1,29 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+LOADADDR = 0x8108c8f4          # RAM start + 16M 
+KERNEL_ENTRY = 0x80100000      # Default kernel entry in arch/mips/Makefile
+RAMSIZE = 0x04000000           # 64MB
+
+LOADER_MAKEOPTS= \
+               KDIR=$(KDIR) \
+               LOADADDR=$(LOADADDR) \
+               KERNEL_ENTRY=$(KERNEL_ENTRY) \
+               RAMSIZE=$(RAMSIZE)
+
+define Build/Clean
+       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
+endef
+
+define Image/Prepare
+       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile
+endef
+
+define Image/Build
+       $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(1) $(KDIR)/root.srec
+       grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
+       grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/image/brcm/Makefile b/target/image/brcm/Makefile
new file mode 100644 (file)
index 0000000..30bad50
--- /dev/null
@@ -0,0 +1,61 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+define Build/Compile
+       rm -f $(KDIR)/loader.gz
+       $(MAKE) -C lzma-loader \
+               BUILD_DIR="$(KDIR)" \
+               TARGET="$(KDIR)" \
+               install
+       echo -ne "\\x00" >> $(KDIR)/loader.gz
+endef
+
+define Build/Clean
+       $(MAKE) -C lzma-loader clean
+endef
+
+define Image/Prepare
+       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+endef
+
+define Image/Build/wgt634u
+       dd if=$(KDIR)/loader.elf of=$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(2).bin bs=131072 conv=sync
+       cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx >> $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(2).bin
+endef
+
+define Image/Build/CyberTAN
+       $(STAGING_DIR)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(5).bin
+endef
+
+define Image/Build/Motorola
+       $(STAGING_DIR)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
+endef
+
+define trxalign/jffs2-128k
+-a 0x20000
+endef
+define trxalign/jffs2-64k
+-a 0x10000
+endef
+define trxalign/squashfs
+-a 1024
+endef
+
+define Image/Build
+       $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(KDIR)/loader.gz $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) $(KDIR)/root.$(1)
+ifneq ($(1),jffs2-128k)
+       $(call Image/Build/CyberTAN,$(1),wrt54g3g,W54F,1.99.5,$(patsubst jffs2-%,jffs2,$(1)))
+       $(call Image/Build/CyberTAN,$(1),wrt54g,W54G,4.40.1,$(patsubst jffs2-%,jffs2,$(1)))
+       $(call Image/Build/CyberTAN,$(1),wrt54gs_v4,W54s,1.09.1,$(patsubst jffs2-%,jffs2,$(1)))
+       $(call Image/Build/Motorola,$(1),wa840g,2,$(patsubst jffs2-%,jffs2,$(1)))
+       $(call Image/Build/Motorola,$(1),we800g,3,$(patsubst jffs2-%,jffs2,$(1)))
+endif
+ifneq ($(1),jffs2-64k)
+       $(call Image/Build/CyberTAN,$(1),wrt54gs,W54S,4.80.1,$(patsubst jffs2-%,jffs2,$(1)))
+       $(call Image/Build/CyberTAN,$(1),wrtsl54gs,W54U,2.00.5,$(patsubst jffs2-%,jffs2,$(1)))
+       $(call Image/Build/wgt634u,$(1),$(patsubst jffs2-%,jffs2,$(1)))
+endif
+       $(call Image/Build/Motorola,$(1),wr850g,1,$(1))
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/image/brcm/lzma-loader/Makefile b/target/image/brcm/lzma-loader/Makefile
new file mode 100644 (file)
index 0000000..3fa00fa
--- /dev/null
@@ -0,0 +1,28 @@
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME := lzma-loader
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+$(PKG_BUILD_DIR)/.prepared:
+       mkdir $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+       touch $@
+
+$(PKG_BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/.prepared
+       $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \
+               LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS)
+
+source: 
+prepare: $(PKG_BUILD_DIR)/.prepared
+compile: $(PKG_BUILD_DIR)/loader.gz
+install:
+
+ifneq ($(TARGET),)
+install: compile
+       $(CP) $(PKG_BUILD_DIR)/loader.gz $(PKG_BUILD_DIR)/loader.elf $(TARGET)/
+endif
+
+clean:
+       rm -rf $(PKG_BUILD_DIR)
diff --git a/target/image/brcm/lzma-loader/src/LzmaDecode.c b/target/image/brcm/lzma-loader/src/LzmaDecode.c
new file mode 100644 (file)
index 0000000..951700b
--- /dev/null
@@ -0,0 +1,663 @@
+/*
+  LzmaDecode.c
+  LZMA Decoder
+  
+  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
+  http://www.7-zip.org/
+
+  LZMA SDK is licensed under two licenses:
+  1) GNU Lesser General Public License (GNU LGPL)
+  2) Common Public License (CPL)
+  It means that you can select one of these two licenses and 
+  follow rules of that license.
+
+  SPECIAL EXCEPTION:
+  Igor Pavlov, as the author of this code, expressly permits you to 
+  statically or dynamically link your code (or bind by name) to the 
+  interfaces of this file without subjecting your linked code to the 
+  terms of the CPL or GNU LGPL. Any modifications or additions 
+  to this file, however, are subject to the LGPL or CPL terms.
+*/
+
+#include "LzmaDecode.h"
+
+#ifndef Byte
+#define Byte unsigned char
+#endif
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+typedef struct _CRangeDecoder
+{
+  Byte *Buffer;
+  Byte *BufferLim;
+  UInt32 Range;
+  UInt32 Code;
+  #ifdef _LZMA_IN_CB
+  ILzmaInCallback *InCallback;
+  int Result;
+  #endif
+  int ExtraBytes;
+} CRangeDecoder;
+
+Byte RangeDecoderReadByte(CRangeDecoder *rd)
+{
+  if (rd->Buffer == rd->BufferLim)
+  {
+    #ifdef _LZMA_IN_CB
+    UInt32 size;
+    rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
+    rd->BufferLim = rd->Buffer + size;
+    if (size == 0)
+    #endif
+    {
+      rd->ExtraBytes = 1;
+      return 0xFF;
+    }
+  }
+  return (*rd->Buffer++);
+}
+
+/* #define ReadByte (*rd->Buffer++) */
+#define ReadByte (RangeDecoderReadByte(rd))
+
+void RangeDecoderInit(CRangeDecoder *rd,
+  #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback
+  #else
+    Byte *stream, UInt32 bufferSize
+  #endif
+    )
+{
+  int i;
+  #ifdef _LZMA_IN_CB
+  rd->InCallback = inCallback;
+  rd->Buffer = rd->BufferLim = 0;
+  #else
+  rd->Buffer = stream;
+  rd->BufferLim = stream + bufferSize;
+  #endif
+  rd->ExtraBytes = 0;
+  rd->Code = 0;
+  rd->Range = (0xFFFFFFFF);
+  for(i = 0; i < 5; i++)
+    rd->Code = (rd->Code << 8) | ReadByte;
+}
+
+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;        
+#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
+#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
+
+UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
+{
+  RC_INIT_VAR
+  UInt32 result = 0;
+  int i;
+  for (i = numTotalBits; i > 0; i--)
+  {
+    /* UInt32 t; */
+    range >>= 1;
+
+    result <<= 1;
+    if (code >= range)
+    {
+      code -= range;
+      result |= 1;
+    }
+    /*
+    t = (code - range) >> 31;
+    t &= 1;
+    code -= range & (t - 1);
+    result = (result + result) | (1 - t);
+    */
+    RC_NORMALIZE
+  }
+  RC_FLUSH_VAR
+  return result;
+}
+
+int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
+{
+  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
+  if (rd->Code < bound)
+  {
+    rd->Range = bound;
+    *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
+    if (rd->Range < kTopValue)
+    {
+      rd->Code = (rd->Code << 8) | ReadByte;
+      rd->Range <<= 8;
+    }
+    return 0;
+  }
+  else
+  {
+    rd->Range -= bound;
+    rd->Code -= bound;
+    *prob -= (*prob) >> kNumMoveBits;
+    if (rd->Range < kTopValue)
+    {
+      rd->Code = (rd->Code << 8) | ReadByte;
+      rd->Range <<= 8;
+    }
+    return 1;
+  }
+}
+
+#define RC_GET_BIT2(prob, mi, A0, A1) \
+  UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
+  if (code < bound) \
+    { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
+  else \
+    { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
+  RC_NORMALIZE
+
+#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)               
+
+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
+{
+  int mi = 1;
+  int i;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  for(i = numLevels; i > 0; i--)
+  {
+    #ifdef _LZMA_LOC_OPT
+    CProb *prob = probs + mi;
+    RC_GET_BIT(prob, mi)
+    #else
+    mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
+    #endif
+  }
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return mi - (1 << numLevels);
+}
+
+int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
+{
+  int mi = 1;
+  int i;
+  int symbol = 0;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  for(i = 0; i < numLevels; i++)
+  {
+    #ifdef _LZMA_LOC_OPT
+    CProb *prob = probs + mi;
+    RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
+    #else
+    int bit = RangeDecoderBitDecode(probs + mi, rd);
+    mi = mi + mi + bit;
+    symbol |= (bit << i);
+    #endif
+  }
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return symbol;
+}
+
+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
+{ 
+  int symbol = 1;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  do
+  {
+    #ifdef _LZMA_LOC_OPT
+    CProb *prob = probs + symbol;
+    RC_GET_BIT(prob, symbol)
+    #else
+    symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
+    #endif
+  }
+  while (symbol < 0x100);
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return symbol;
+}
+
+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
+{ 
+  int symbol = 1;
+  #ifdef _LZMA_LOC_OPT
+  RC_INIT_VAR
+  #endif
+  do
+  {
+    int bit;
+    int matchBit = (matchByte >> 7) & 1;
+    matchByte <<= 1;
+    #ifdef _LZMA_LOC_OPT
+    {
+      CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
+      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
+    }
+    #else
+    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
+    symbol = (symbol << 1) | bit;
+    #endif
+    if (matchBit != bit)
+    {
+      while (symbol < 0x100)
+      {
+        #ifdef _LZMA_LOC_OPT
+        CProb *prob = probs + symbol;
+        RC_GET_BIT(prob, symbol)
+        #else
+        symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
+        #endif
+      }
+      break;
+    }
+  }
+  while (symbol < 0x100);
+  #ifdef _LZMA_LOC_OPT
+  RC_FLUSH_VAR
+  #endif
+  return symbol;
+}
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenChoice 0
+#define LenChoice2 (LenChoice + 1)
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
+
+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
+{
+  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
+    return RangeDecoderBitTreeDecode(p + LenLow +
+        (posState << kLenNumLowBits), kLenNumLowBits, rd);
+  if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
+    return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
+        (posState << kLenNumMidBits), kLenNumMidBits, rd);
+  return kLenNumLowSymbols + kLenNumMidSymbols + 
+      RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
+}
+
+#define kNumStates 12
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+
+#define IsMatch 0
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define IsRep0Long (IsRepG2 + kNumStates)
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
+#define LenCoder (Align + kAlignTableSize)
+#define RepLenCoder (LenCoder + kNumLenProbs)
+#define Literal (RepLenCoder + kNumLenProbs)
+
+#if Literal != LZMA_BASE_SIZE
+StopCompilingDueBUG
+#endif
+
+#ifdef _LZMA_OUT_READ
+
+typedef struct _LzmaVarState
+{
+  CRangeDecoder RangeDecoder;
+  Byte *Dictionary;
+  UInt32 DictionarySize;
+  UInt32 DictionaryPos;
+  UInt32 GlobalPos;
+  UInt32 Reps[4];
+  int lc;
+  int lp;
+  int pb;
+  int State;
+  int PreviousIsMatch;
+  int RemainLen;
+} LzmaVarState;
+
+int LzmaDecoderInit(
+    unsigned char *buffer, UInt32 bufferSize,
+    int lc, int lp, int pb,
+    unsigned char *dictionary, UInt32 dictionarySize,
+    #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback
+    #else
+    unsigned char *inStream, UInt32 inSize
+    #endif
+    )
+{
+  LzmaVarState *vs = (LzmaVarState *)buffer;
+  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
+  UInt32 i;
+  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
+    return LZMA_RESULT_NOT_ENOUGH_MEM;
+  vs->Dictionary = dictionary;
+  vs->DictionarySize = dictionarySize;
+  vs->DictionaryPos = 0;
+  vs->GlobalPos = 0;
+  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
+  vs->lc = lc;
+  vs->lp = lp;
+  vs->pb = pb;
+  vs->State = 0;
+  vs->PreviousIsMatch = 0;
+  vs->RemainLen = 0;
+  dictionary[dictionarySize - 1] = 0;
+  for (i = 0; i < numProbs; i++)
+    p[i] = kBitModelTotal >> 1; 
+  RangeDecoderInit(&vs->RangeDecoder, 
+      #ifdef _LZMA_IN_CB
+      inCallback
+      #else
+      inStream, inSize
+      #endif
+  );
+  return LZMA_RESULT_OK;
+}
+
+int LzmaDecode(unsigned char *buffer, 
+    unsigned char *outStream, UInt32 outSize,
+    UInt32 *outSizeProcessed)
+{
+  LzmaVarState *vs = (LzmaVarState *)buffer;
+  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
+  CRangeDecoder rd = vs->RangeDecoder;
+  int state = vs->State;
+  int previousIsMatch = vs->PreviousIsMatch;
+  Byte previousByte;
+  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
+  UInt32 nowPos = 0;
+  UInt32 posStateMask = (1 << (vs->pb)) - 1;
+  UInt32 literalPosMask = (1 << (vs->lp)) - 1;
+  int lc = vs->lc;
+  int len = vs->RemainLen;
+  UInt32 globalPos = vs->GlobalPos;
+
+  Byte *dictionary = vs->Dictionary;
+  UInt32 dictionarySize = vs->DictionarySize;
+  UInt32 dictionaryPos = vs->DictionaryPos;
+
+  if (len == -1)
+  {
+    *outSizeProcessed = 0;
+    return LZMA_RESULT_OK;
+  }
+
+  while(len > 0 && nowPos < outSize)
+  {
+    UInt32 pos = dictionaryPos - rep0;
+    if (pos >= dictionarySize)
+      pos += dictionarySize;
+    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
+    if (++dictionaryPos == dictionarySize)
+      dictionaryPos = 0;
+    len--;
+  }
+  if (dictionaryPos == 0)
+    previousByte = dictionary[dictionarySize - 1];
+  else
+    previousByte = dictionary[dictionaryPos - 1];
+#else
+
+int LzmaDecode(
+    Byte *buffer, UInt32 bufferSize,
+    int lc, int lp, int pb,
+    #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback,
+    #else
+    unsigned char *inStream, UInt32 inSize,
+    #endif
+    unsigned char *outStream, UInt32 outSize,
+    UInt32 *outSizeProcessed)
+{
+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
+  CProb *p = (CProb *)buffer;
+  CRangeDecoder rd;
+  UInt32 i;
+  int state = 0;
+  int previousIsMatch = 0;
+  Byte previousByte = 0;
+  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
+  UInt32 nowPos = 0;
+  UInt32 posStateMask = (1 << pb) - 1;
+  UInt32 literalPosMask = (1 << lp) - 1;
+  int len = 0;
+  if (bufferSize < numProbs * sizeof(CProb))
+    return LZMA_RESULT_NOT_ENOUGH_MEM;
+  for (i = 0; i < numProbs; i++)
+    p[i] = kBitModelTotal >> 1; 
+  RangeDecoderInit(&rd, 
+      #ifdef _LZMA_IN_CB
+      inCallback
+      #else
+      inStream, inSize
+      #endif
+      );
+#endif
+
+  *outSizeProcessed = 0;
+  while(nowPos < outSize)
+  {
+    int posState = (int)(
+        (nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+        & posStateMask);
+    #ifdef _LZMA_IN_CB
+    if (rd.Result != LZMA_RESULT_OK)
+      return rd.Result;
+    #endif
+    if (rd.ExtraBytes != 0)
+      return LZMA_RESULT_DATA_ERROR;
+    if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
+    {
+      CProb *probs = p + Literal + (LZMA_LIT_SIZE * 
+        (((
+        (nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
+
+      if (state < 4) state = 0;
+      else if (state < 10) state -= 3;
+      else state -= 6;
+      if (previousIsMatch)
+      {
+        Byte matchByte;
+        #ifdef _LZMA_OUT_READ
+        UInt32 pos = dictionaryPos - rep0;
+        if (pos >= dictionarySize)
+          pos += dictionarySize;
+        matchByte = dictionary[pos];
+        #else
+        matchByte = outStream[nowPos - rep0];
+        #endif
+        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
+        previousIsMatch = 0;
+      }
+      else
+        previousByte = LzmaLiteralDecode(probs, &rd);
+      outStream[nowPos++] = previousByte;
+      #ifdef _LZMA_OUT_READ
+      dictionary[dictionaryPos] = previousByte;
+      if (++dictionaryPos == dictionarySize)
+        dictionaryPos = 0;
+      #endif
+    }
+    else             
+    {
+      previousIsMatch = 1;
+      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
+      {
+        if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
+        {
+          if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
+          {
+            #ifdef _LZMA_OUT_READ
+            UInt32 pos;
+            #endif
+            if (
+               (nowPos 
+                #ifdef _LZMA_OUT_READ
+                + globalPos
+                #endif
+               )
+               == 0)
+              return LZMA_RESULT_DATA_ERROR;
+            state = state < 7 ? 9 : 11;
+            #ifdef _LZMA_OUT_READ
+            pos = dictionaryPos - rep0;
+            if (pos >= dictionarySize)
+              pos += dictionarySize;
+            previousByte = dictionary[pos];
+            dictionary[dictionaryPos] = previousByte;
+            if (++dictionaryPos == dictionarySize)
+              dictionaryPos = 0;
+            #else
+            previousByte = outStream[nowPos - rep0];
+            #endif
+            outStream[nowPos++] = previousByte;
+            continue;
+          }
+        }
+        else
+        {
+          UInt32 distance;
+          if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
+            distance = rep1;
+          else 
+          {
+            if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
+              distance = rep2;
+            else
+            {
+              distance = rep3;
+              rep3 = rep2;
+            }
+            rep2 = rep1;
+          }
+          rep1 = rep0;
+          rep0 = distance;
+        }
+        len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
+        state = state < 7 ? 8 : 11;
+      }
+      else
+      {
+        int posSlot;
+        rep3 = rep2;
+        rep2 = rep1;
+        rep1 = rep0;
+        state = state < 7 ? 7 : 10;
+        len = LzmaLenDecode(p + LenCoder, &rd, posState);
+        posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
+            kNumPosSlotBits), kNumPosSlotBits, &rd);
+        if (posSlot >= kStartPosModelIndex)
+        {
+          int numDirectBits = ((posSlot >> 1) - 1);
+          rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
+          if (posSlot < kEndPosModelIndex)
+          {
+            rep0 += RangeDecoderReverseBitTreeDecode(
+                p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
+          }
+          else
+          {
+            rep0 += RangeDecoderDecodeDirectBits(&rd, 
+                numDirectBits - kNumAlignBits) << kNumAlignBits;
+            rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
+          }
+        }
+        else
+          rep0 = posSlot;
+        rep0++;
+      }
+      if (rep0 == (UInt32)(0))
+      {
+        /* it's for stream version */
+        len = -1;
+        break;
+      }
+      if (rep0 > nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+      {
+        return LZMA_RESULT_DATA_ERROR;
+      }
+      len += kMatchMinLen;
+      do
+      {
+        #ifdef _LZMA_OUT_READ
+        UInt32 pos = dictionaryPos - rep0;
+        if (pos >= dictionarySize)
+          pos += dictionarySize;
+        previousByte = dictionary[pos];
+        dictionary[dictionaryPos] = previousByte;
+        if (++dictionaryPos == dictionarySize)
+          dictionaryPos = 0;
+        #else
+        previousByte = outStream[nowPos - rep0];
+        #endif
+        outStream[nowPos++] = previousByte;
+        len--;
+      }
+      while(len > 0 && nowPos < outSize);
+    }
+  }
+
+  #ifdef _LZMA_OUT_READ
+  vs->RangeDecoder = rd;
+  vs->DictionaryPos = dictionaryPos;
+  vs->GlobalPos = globalPos + nowPos;
+  vs->Reps[0] = rep0;
+  vs->Reps[1] = rep1;
+  vs->Reps[2] = rep2;
+  vs->Reps[3] = rep3;
+  vs->State = state;
+  vs->PreviousIsMatch = previousIsMatch;
+  vs->RemainLen = len;
+  #endif
+
+  *outSizeProcessed = nowPos;
+  return LZMA_RESULT_OK;
+}
diff --git a/target/image/brcm/lzma-loader/src/LzmaDecode.h b/target/image/brcm/lzma-loader/src/LzmaDecode.h
new file mode 100644 (file)
index 0000000..f58944e
--- /dev/null
@@ -0,0 +1,100 @@
+/* 
+  LzmaDecode.h
+  LZMA Decoder interface
+
+  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
+  http://www.7-zip.org/
+
+  LZMA SDK is licensed under two licenses:
+  1) GNU Lesser General Public License (GNU LGPL)
+  2) Common Public License (CPL)
+  It means that you can select one of these two licenses and 
+  follow rules of that license.
+
+  SPECIAL EXCEPTION:
+  Igor Pavlov, as the author of this code, expressly permits you to 
+  statically or dynamically link your code (or bind by name) to the 
+  interfaces of this file without subjecting your linked code to the 
+  terms of the CPL or GNU LGPL. Any modifications or additions 
+  to this file, however, are subject to the LGPL or CPL terms.
+*/
+
+#ifndef __LZMADECODE_H
+#define __LZMADECODE_H
+
+/* #define _LZMA_IN_CB */
+/* Use callback for input data */
+
+/* #define _LZMA_OUT_READ */
+/* Use read function for output data */
+
+/* #define _LZMA_PROB32 */
+/* It can increase speed on some 32-bit CPUs, 
+   but memory usage will be doubled in that case */
+
+/* #define _LZMA_LOC_OPT */
+/* Enable local speed optimizations inside code */
+
+#ifndef UInt32
+#ifdef _LZMA_UINT32_IS_ULONG
+#define UInt32 unsigned long
+#else
+#define UInt32 unsigned int
+#endif
+#endif
+
+#ifdef _LZMA_PROB32
+#define CProb UInt32
+#else
+#define CProb unsigned short
+#endif
+
+#define LZMA_RESULT_OK 0
+#define LZMA_RESULT_DATA_ERROR 1
+#define LZMA_RESULT_NOT_ENOUGH_MEM 2
+
+#ifdef _LZMA_IN_CB
+typedef struct _ILzmaInCallback
+{
+  int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
+} ILzmaInCallback;
+#endif
+
+#define LZMA_BASE_SIZE 1846
+#define LZMA_LIT_SIZE 768
+
+/* 
+bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
+bufferSize += 100 in case of _LZMA_OUT_READ
+by default CProb is unsigned short, 
+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
+*/
+
+#ifdef _LZMA_OUT_READ
+int LzmaDecoderInit(
+    unsigned char *buffer, UInt32 bufferSize,
+    int lc, int lp, int pb,
+    unsigned char *dictionary, UInt32 dictionarySize,
+  #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback
+  #else
+    unsigned char *inStream, UInt32 inSize
+  #endif
+);
+#endif
+
+int LzmaDecode(
+    unsigned char *buffer, 
+  #ifndef _LZMA_OUT_READ
+    UInt32 bufferSize,
+    int lc, int lp, int pb,
+  #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback,
+  #else
+    unsigned char *inStream, UInt32 inSize,
+  #endif
+  #endif
+    unsigned char *outStream, UInt32 outSize,
+    UInt32 *outSizeProcessed);
+
+#endif
diff --git a/target/image/brcm/lzma-loader/src/Makefile b/target/image/brcm/lzma-loader/src/Makefile
new file mode 100644 (file)
index 0000000..85a8646
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Makefile for Broadcom BCM947XX boards
+#
+# Copyright 2001-2003, Broadcom Corporation
+# All Rights Reserved.
+# 
+# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
+# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
+# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
+#
+# Copyright 2004  Manuel Novoa III <mjn3@codepoet.org>
+#   Modified to support bzip'd kernels.
+#   Of course, it would be better to integrate bunzip capability into CFE.
+#
+# Copyright 2005  Oleg I. Vdovikin <oleg@cs.msu.su>
+#   Cleaned up, modified for lzma support, removed from kernel
+#
+
+TEXT_START     := 0x80001000
+BZ_TEXT_START  := 0x80300000
+
+OBJCOPY                := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
+
+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 -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)
+
+SEDFLAGS       := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
+
+OBJECTS                := head.o data.o
+
+all: loader.gz loader.elf
+
+# Don't build dependencies, this may die if $(CC) isn't gcc
+dep:
+
+install:
+
+loader.gz: loader
+       gzip -nc9 $< > $@
+
+loader.elf: loader.o
+       cp $< $@
+
+loader: loader.o
+       $(OBJCOPY) $< $@
+
+loader.o: loader.lds $(OBJECTS)
+       $(LD) -static --gc-sections -no-warn-mismatch -T loader.lds -o $@ $(OBJECTS)
+
+loader.lds: loader.lds.in Makefile
+       @sed "$(SEDFLAGS)" < $< > $@
+
+data.o: data.lds decompress.image
+       $(LD) -no-warn-mismatch -T data.lds -r -o $@ -b binary decompress.image -b elf32-tradlittlemips
+
+data.lds:
+       @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > $@
+
+decompress.image: decompress
+       $(OBJCOPY) $< $@
+
+decompress: decompress.lds decompress.o LzmaDecode.o
+       $(LD) -static --gc-sections -no-warn-mismatch -T decompress.lds -o $@ decompress.o LzmaDecode.o
+
+decompress.lds: decompress.lds.in Makefile
+       @sed "$(SEDFLAGS)" < $< > $@
+
+mrproper: clean
+
+clean:
+       rm -f loader.gz loader decompress *.lds *.o *.image
diff --git a/target/image/brcm/lzma-loader/src/README b/target/image/brcm/lzma-loader/src/README
new file mode 100644 (file)
index 0000000..16649e9
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * LZMA compressed kernel decompressor for bcm947xx boards
+ *
+ * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+The code is intended to decompress kernel, being compressed using lzma utility
+build using 7zip LZMA SDK. This utility is located in the LZMA_Alone directory
+
+decompressor code expects that your .trx file consist of three partitions: 
+
+1) decompressor itself (this is gziped code which pmon/cfe will extract and run
+on boot-up instead of real kernel)
+2) LZMA compressed kernel (both streamed and regular modes are supported now)
+3) Root filesystem
+
+Please be sure to apply the following patch for use this new trx layout (it will
+allow using both new and old trx files for root filesystem lookup code)
+
+--- linuz/arch/mips/brcm-boards/bcm947xx/setup.c        2005-01-23 19:24:27.503322896 +0300
++++ linux/arch/mips/brcm-boards/bcm947xx/setup.c        2005-01-23 19:29:05.237100944 +0300
+@@ -221,7 +221,9 @@
+                /* Try looking at TRX header for rootfs offset */
+                if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
+                        bcm947xx_parts[1].offset = off;
+-                       if (le32_to_cpu(trx->offsets[1]) > off)
++                       if (le32_to_cpu(trx->offsets[2]) > off)
++                               off = le32_to_cpu(trx->offsets[2]);
++                       else if (le32_to_cpu(trx->offsets[1]) > off)
+                                off = le32_to_cpu(trx->offsets[1]);
+                        continue;
+                }
+
+
+Revision history:
+       0.02    Initial release
+       0.03    Added Mineharu Takahara <mtakahar@yahoo.com> patch to pass actual
+               output size to decoder (stream mode compressed input is not 
+               a requirement anymore)
+       0.04    Reordered functions using lds script
diff --git a/target/image/brcm/lzma-loader/src/decompress.c b/target/image/brcm/lzma-loader/src/decompress.c
new file mode 100644 (file)
index 0000000..ec510e2
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * LZMA compressed kernel decompressor for bcm947xx boards
+ *
+ * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Please note, this was code based on the bunzip2 decompressor code
+ * by Manuel Novoa III  (mjn3@codepoet.org), although the only thing left
+ * is an idea and part of original vendor code
+ *
+ *
+ * 12-Mar-2005  Mineharu Takahara <mtakahar@yahoo.com>
+ *   pass actual output size to decoder (stream mode
+ *   compressed input is not a requirement anymore)
+ *
+ * 24-Apr-2005 Oleg I. Vdovikin
+ *   reordered functions using lds script, removed forward decl
+ *
+ */
+
+#include "LzmaDecode.h"
+
+#define BCM4710_FLASH          0x1fc00000      /* Flash */
+
+#define KSEG0                  0x80000000
+#define KSEG1                  0xa0000000
+
+#define KSEG1ADDR(a)           ((((unsigned)(a)) & 0x1fffffffU) | KSEG1)
+
+#define Index_Invalidate_I     0x00
+#define Index_Writeback_Inv_D   0x01
+
+#define cache_unroll(base,op)  \
+       __asm__ __volatile__(           \
+               ".set noreorder;\n"             \
+               ".set mips3;\n"                 \
+               "cache %1, (%0);\n"             \
+               ".set mips0;\n"                 \
+               ".set reorder\n"                \
+               :                                               \
+               : "r" (base),                   \
+                 "i" (op));
+
+static __inline__ void blast_icache(unsigned long size, unsigned long lsize)
+{
+       unsigned long start = KSEG0;
+       unsigned long end = (start + size);
+
+       while(start < end) {
+               cache_unroll(start,Index_Invalidate_I);
+               start += lsize;
+       }
+}
+
+static __inline__ void blast_dcache(unsigned long size, unsigned long lsize)
+{
+       unsigned long start = KSEG0;
+       unsigned long end = (start + size);
+
+       while(start < end) {
+               cache_unroll(start,Index_Writeback_Inv_D);
+               start += lsize;
+       }
+}
+
+#define TRX_MAGIC       0x30524448      /* "HDR0" */
+
+struct trx_header {
+       unsigned int magic;             /* "HDR0" */
+       unsigned int len;               /* Length of file including header */
+       unsigned int crc32;             /* 32-bit CRC from flag_version to end of file */
+       unsigned int flag_version;      /* 0:15 flags, 16:31 version */
+       unsigned int offsets[3];        /* Offsets of partitions from start of header */
+};
+
+/* beyound the image end, size not known in advance */
+extern unsigned char workspace[];
+
+unsigned int offset;
+unsigned char *data;
+
+/* flash access should be aligned, so wrapper is used */
+/* read byte from the flash, all accesses are 32-bit aligned */
+static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
+{
+       static unsigned int val;
+
+       if (((unsigned int)offset % 4) == 0) {
+               val = *(unsigned int *)data;
+               data += 4;
+       }
+       
+       *bufferSize = 1;
+       *buffer = ((unsigned char *)&val) + (offset++ & 3);
+       
+       return LZMA_RESULT_OK;
+}
+
+static __inline__ unsigned char get_byte(void)
+{
+       unsigned char *buffer;
+       UInt32 fake;
+       
+       return read_byte(0, &buffer, &fake), *buffer;
+}
+
+/* should be the first function */
+void entry(unsigned long icache_size, unsigned long icache_lsize, 
+       unsigned long dcache_size, unsigned long dcache_lsize)
+{
+       unsigned int i;  /* temp value */
+       unsigned int lc; /* literal context bits */
+       unsigned int lp; /* literal pos state bits */
+       unsigned int pb; /* pos state bits */
+       unsigned int osize; /* uncompressed size */
+
+       ILzmaInCallback callback;
+       callback.Read = read_byte;
+
+       /* look for trx header, 32-bit data access */
+       for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
+               ((struct trx_header *)data)->magic != TRX_MAGIC; data += 65536);
+
+       /* compressed kernel is in the partition 0 or 1 */
+       if (((struct trx_header *)data)->offsets[1] > 65536) 
+               data += ((struct trx_header *)data)->offsets[0];
+       else
+               data += ((struct trx_header *)data)->offsets[1];
+
+       offset = 0;
+
+       /* lzma args */
+       i = get_byte();
+       lc = i % 9, i = i / 9;
+       lp = i % 5, pb = i / 5;
+
+       /* skip rest of the LZMA coder property */
+       for (i = 0; i < 4; i++)
+               get_byte();
+
+       /* read the lower half of uncompressed size in the header */
+       osize = ((unsigned int)get_byte()) +
+               ((unsigned int)get_byte() << 8) +
+               ((unsigned int)get_byte() << 16) +
+               ((unsigned int)get_byte() << 24);
+
+       /* skip rest of the header (upper half of uncompressed size) */
+       for (i = 0; i < 4; i++) 
+               get_byte();
+
+       /* decompress kernel */
+       if (LzmaDecode(workspace, ~0, lc, lp, pb, &callback,
+               (unsigned char*)LOADADDR, osize, &i) == LZMA_RESULT_OK)
+       {
+               blast_dcache(dcache_size, dcache_lsize);
+               blast_icache(icache_size, icache_lsize);
+
+               /* Jump to load address */
+               ((void (*)(void)) LOADADDR)();
+       }
+}
diff --git a/target/image/brcm/lzma-loader/src/decompress.lds.in b/target/image/brcm/lzma-loader/src/decompress.lds.in
new file mode 100644 (file)
index 0000000..33f56f8
--- /dev/null
@@ -0,0 +1,20 @@
+OUTPUT_ARCH(mips)
+ENTRY(entry)
+SECTIONS {
+       . = BZ_TEXT_START;
+       .text : {
+               *(.text.entry)
+               *(.text)
+               *(.rodata)
+       }
+
+       .data : {
+               *(.data)
+       }
+
+       .bss : {
+               *(.bss)
+       }
+
+       workspace = .;
+}
diff --git a/target/image/brcm/lzma-loader/src/head.S b/target/image/brcm/lzma-loader/src/head.S
new file mode 100644 (file)
index 0000000..9bfbd53
--- /dev/null
@@ -0,0 +1,155 @@
+/* Copyright 2005 Oleg I. Vdovikin (oleg@cs.msu.su)    */
+/* cache manipulation adapted from Broadcom code       */
+/* idea taken from original bunzip2 decompressor code  */
+/* Copyright 2004 Manuel Novoa III (mjn3@codepoet.org) */
+/* Licensed under the linux kernel's version of the GPL.*/
+
+#include <asm/asm.h>
+#include <asm/regdef.h>
+
+#define KSEG0          0x80000000
+
+#define C0_CONFIG      $16
+#define C0_TAGLO       $28
+#define C0_TAGHI       $29
+
+#define        CONF1_DA_SHIFT  7                       /* D$ associativity */
+#define CONF1_DA_MASK  0x00000380
+#define CONF1_DA_BASE  1
+#define CONF1_DL_SHIFT 10                      /* D$ line size */
+#define CONF1_DL_MASK  0x00001c00
+#define CONF1_DL_BASE  2
+#define CONF1_DS_SHIFT 13                      /* D$ sets/way */
+#define CONF1_DS_MASK  0x0000e000
+#define CONF1_DS_BASE  64
+#define CONF1_IA_SHIFT 16                      /* I$ associativity */
+#define CONF1_IA_MASK  0x00070000
+#define CONF1_IA_BASE  1
+#define CONF1_IL_SHIFT 19                      /* I$ line size */
+#define CONF1_IL_MASK  0x00380000
+#define CONF1_IL_BASE  2
+#define CONF1_IS_SHIFT 22                      /* Instruction cache sets/way */
+#define CONF1_IS_MASK  0x01c00000
+#define CONF1_IS_BASE  64
+
+#define Index_Invalidate_I     0x00
+#define Index_Writeback_Inv_D   0x01
+
+       .text
+       LEAF(startup)
+       .set noreorder
+       
+       /* Copy decompressor code to the right place */
+       li      t2, BZ_TEXT_START
+       add     a0, t2, 0
+       la      a1, code_start
+       la      a2, code_stop
+$L1:
+       lw      t0, 0(a1)
+       sw      t0, 0(a0)
+       add     a1, 4
+       add     a0, 4
+       blt     a1, a2, $L1
+       nop
+       
+       /* At this point we need to invalidate dcache and */
+       /* icache before jumping to new code */
+
+1:     /* Get cache sizes */
+       .set    mips32
+       mfc0    s0,C0_CONFIG,1
+       .set    mips0
+
+       li      s1,CONF1_DL_MASK
+       and     s1,s0
+       beq     s1,zero,nodc
+       nop
+
+       srl     s1,CONF1_DL_SHIFT
+       li      t0,CONF1_DL_BASE
+       sll     s1,t0,s1                /* s1 has D$ cache line size */
+
+       li      s2,CONF1_DA_MASK
+       and     s2,s0
+       srl     s2,CONF1_DA_SHIFT
+       addiu   s2,CONF1_DA_BASE        /* s2 now has D$ associativity */
+
+       li      t0,CONF1_DS_MASK
+       and     t0,s0
+       srl     t0,CONF1_DS_SHIFT
+       li      s3,CONF1_DS_BASE
+       sll     s3,s3,t0                /* s3 has D$ sets per way */
+
+       multu   s2,s3                   /* sets/way * associativity */
+       mflo    t0                      /* total cache lines */
+
+       multu   s1,t0                   /* D$ linesize * lines */
+       mflo    s2                      /* s2 is now D$ size in bytes */
+
+       /* Initilize the D$: */
+       mtc0    zero,C0_TAGLO
+       mtc0    zero,C0_TAGHI
+
+       li      t0,KSEG0                /* Just an address for the first $ line */
+       addu    t1,t0,s2                /*  + size of cache == end */
+
+       .set    mips3
+1:     cache   Index_Writeback_Inv_D,0(t0)
+       .set    mips0
+       bne     t0,t1,1b
+       addu    t0,s1
+       
+nodc:
+       /* Now we get to do it all again for the I$ */
+       
+       move    s3,zero                 /* just in case there is no icache */
+       move    s4,zero
+
+       li      t0,CONF1_IL_MASK
+       and     t0,s0
+       beq     t0,zero,noic
+       nop
+
+       srl     t0,CONF1_IL_SHIFT
+       li      s3,CONF1_IL_BASE
+       sll     s3,t0                   /* s3 has I$ cache line size */
+
+       li      t0,CONF1_IA_MASK
+       and     t0,s0
+       srl     t0,CONF1_IA_SHIFT
+       addiu   s4,t0,CONF1_IA_BASE     /* s4 now has I$ associativity */
+
+       li      t0,CONF1_IS_MASK
+       and     t0,s0
+       srl     t0,CONF1_IS_SHIFT
+       li      s5,CONF1_IS_BASE
+       sll     s5,t0                   /* s5 has I$ sets per way */
+
+       multu   s4,s5                   /* sets/way * associativity */
+       mflo    t0                      /* s4 is now total cache lines */
+
+       multu   s3,t0                   /* I$ linesize * lines */
+       mflo    s4                      /* s4 is cache size in bytes */
+
+       /* Initilize the I$: */
+       mtc0    zero,C0_TAGLO
+       mtc0    zero,C0_TAGHI
+
+       li      t0,KSEG0                /* Just an address for the first $ line */
+       addu    t1,t0,s4                /*  + size of cache == end */
+
+       .set    mips3
+1:     cache   Index_Invalidate_I,0(t0)
+       .set    mips0
+       bne     t0,t1,1b
+       addu    t0,s3
+
+noic:
+       move    a0,s3                   /* icache line size */
+       move    a1,s4                   /* icache size */
+       move    a2,s1                   /* dcache line size */
+       jal     t2
+       move    a3,s2                   /* dcache size */
+       
+       .set reorder
+       END(startup)
diff --git a/target/image/brcm/lzma-loader/src/loader.lds.in b/target/image/brcm/lzma-loader/src/loader.lds.in
new file mode 100644 (file)
index 0000000..20f2ea9
--- /dev/null
@@ -0,0 +1,17 @@
+OUTPUT_ARCH(mips)
+ENTRY(startup)
+SECTIONS {
+       . = TEXT_START;
+       .text : {
+               *(.text)
+               *(.rodata)
+       }
+
+       .data : {
+               *(.data)
+       }
+
+       .bss : {
+               *(.bss)
+       }
+}
diff --git a/target/image/generic/Makefile b/target/image/generic/Makefile
new file mode 100644 (file)
index 0000000..3cb3b2e
--- /dev/null
@@ -0,0 +1,6 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+# use default targets for everything
+
+$(eval $(call BuildImage))
diff --git a/target/image/generic/lzma-loader/Makefile b/target/image/generic/lzma-loader/Makefile
new file mode 100644 (file)
index 0000000..3de04a8
--- /dev/null
@@ -0,0 +1,37 @@
+# $Id: Makefile 1823 2005-09-01 20:07:42Z nbd $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME := loader
+PKG_VERSION := 0.05
+
+PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+$(PKG_BUILD_DIR)/.prepared:
+       mkdir $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+       touch $@
+
+$(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma
+       $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \
+               LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS) \
+               RAMSIZE=$(RAMSIZE) \
+               LOADADDR=$(LOADADDR) \
+               KERNEL_ENTRY=$(KERNEL_ENTRY) \
+               IMAGE_COPY=$(IMAGE_COPY)
+
+
+$(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma
+       $(CP) $< $@
+
+$(KDIR)/loader.elf: $(PKG_BUILD_DIR)/lzma.elf
+       $(CP) $< $@
+
+source: 
+prepare: $(PKG_BUILD_DIR)/.prepared
+compile: $(KDIR)/loader.elf
+install:
+
+clean:
+       rm -rf $(PKG_BUILD_DIR)
+       rm -f $(KDIR)/loader.elf
diff --git a/target/image/generic/lzma-loader/src/LzmaDecode.c b/target/image/generic/lzma-loader/src/LzmaDecode.c
new file mode 100644 (file)
index 0000000..c90a0d3
--- /dev/null
@@ -0,0 +1,590 @@
+/*
+  LzmaDecode.c
+  LZMA Decoder (optimized for Speed version)
+  
+  LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10)
+  http://www.7-zip.org/
+
+  LZMA SDK is licensed under two licenses:
+  1) GNU Lesser General Public License (GNU LGPL)
+  2) Common Public License (CPL)
+  It means that you can select one of these two licenses and 
+  follow rules of that license.
+
+  SPECIAL EXCEPTION:
+  Igor Pavlov, as the author of this Code, expressly permits you to 
+  statically or dynamically link your Code (or bind by name) to the 
+  interfaces of this file without subjecting your linked Code to the 
+  terms of the CPL or GNU LGPL. Any modifications or additions 
+  to this file, however, are subject to the LGPL or CPL terms.
+*/
+
+#include "LzmaDecode.h"
+
+#ifndef Byte
+#define Byte unsigned char
+#endif
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+#define RC_READ_BYTE (*Buffer++)
+
+#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
+  { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
+
+#ifdef _LZMA_IN_CB
+
+#define RC_TEST { if (Buffer == BufferLim) \
+  { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \
+  BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }}
+
+#define RC_INIT Buffer = BufferLim = 0; RC_INIT2
+
+#else
+
+#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
+
+#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
+#endif
+
+#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
+
+#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
+#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
+#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
+
+#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
+  { UpdateBit0(p); mi <<= 1; A0; } else \
+  { UpdateBit1(p); mi = (mi + mi) + 1; A1; } 
+  
+#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)               
+
+#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
+  { int i = numLevels; res = 1; \
+  do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
+  res -= (1 << numLevels); }
+
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenChoice 0
+#define LenChoice2 (LenChoice + 1)
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
+
+
+#define kNumStates 12
+#define kNumLitStates 7
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+
+#define IsMatch 0
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define IsRep0Long (IsRepG2 + kNumStates)
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
+#define LenCoder (Align + kAlignTableSize)
+#define RepLenCoder (LenCoder + kNumLenProbs)
+#define Literal (RepLenCoder + kNumLenProbs)
+
+#if Literal != LZMA_BASE_SIZE
+StopCompilingDueBUG
+#endif
+
+#if 0
+int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
+{
+  unsigned char prop0;
+  if (size < LZMA_PROPERTIES_SIZE)
+    return LZMA_RESULT_DATA_ERROR;
+  prop0 = propsData[0];
+  if (prop0 >= (9 * 5 * 5))
+    return LZMA_RESULT_DATA_ERROR;
+  {
+    for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
+    for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
+    propsRes->lc = prop0;
+    /*
+    unsigned char remainder = (unsigned char)(prop0 / 9);
+    propsRes->lc = prop0 % 9;
+    propsRes->pb = remainder / 5;
+    propsRes->lp = remainder % 5;
+    */
+  }
+
+  #ifdef _LZMA_OUT_READ
+  {
+    int i;
+    propsRes->DictionarySize = 0;
+    for (i = 0; i < 4; i++)
+      propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
+    if (propsRes->DictionarySize == 0)
+      propsRes->DictionarySize = 1;
+  }
+  #endif
+  return LZMA_RESULT_OK;
+}
+#endif
+
+#define kLzmaStreamWasFinishedId (-1)
+
+int LzmaDecode(CLzmaDecoderState *vs,
+    #ifdef _LZMA_IN_CB
+    ILzmaInCallback *InCallback,
+    #else
+    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
+    #endif
+    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
+{
+  CProb *p = vs->Probs;
+  SizeT nowPos = 0;
+  Byte previousByte = 0;
+  UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
+  UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
+  int lc = vs->Properties.lc;
+
+  #ifdef _LZMA_OUT_READ
+  
+  UInt32 Range = vs->Range;
+  UInt32 Code = vs->Code;
+  #ifdef _LZMA_IN_CB
+  const Byte *Buffer = vs->Buffer;
+  const Byte *BufferLim = vs->BufferLim;
+  #else
+  const Byte *Buffer = inStream;
+  const Byte *BufferLim = inStream + inSize;
+  #endif
+  int state = vs->State;
+  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
+  int len = vs->RemainLen;
+  UInt32 globalPos = vs->GlobalPos;
+  UInt32 distanceLimit = vs->DistanceLimit;
+
+  Byte *dictionary = vs->Dictionary;
+  UInt32 dictionarySize = vs->Properties.DictionarySize;
+  UInt32 dictionaryPos = vs->DictionaryPos;
+
+  Byte tempDictionary[4];
+
+  #ifndef _LZMA_IN_CB
+  *inSizeProcessed = 0;
+  #endif
+  *outSizeProcessed = 0;
+  if (len == kLzmaStreamWasFinishedId)
+    return LZMA_RESULT_OK;
+
+  if (dictionarySize == 0)
+  {
+    dictionary = tempDictionary;
+    dictionarySize = 1;
+    tempDictionary[0] = vs->TempDictionary[0];
+  }
+
+  if (len == kLzmaNeedInitId)
+  {
+    {
+      UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
+      UInt32 i;
+      for (i = 0; i < numProbs; i++)
+        p[i] = kBitModelTotal >> 1; 
+      rep0 = rep1 = rep2 = rep3 = 1;
+      state = 0;
+      globalPos = 0;
+      distanceLimit = 0;
+      dictionaryPos = 0;
+      dictionary[dictionarySize - 1] = 0;
+      #ifdef _LZMA_IN_CB
+      RC_INIT;
+      #else
+      RC_INIT(inStream, inSize);
+      #endif
+    }
+    len = 0;
+  }
+  while(len != 0 && nowPos < outSize)
+  {
+    UInt32 pos = dictionaryPos - rep0;
+    if (pos >= dictionarySize)
+      pos += dictionarySize;
+    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
+    if (++dictionaryPos == dictionarySize)
+      dictionaryPos = 0;
+    len--;
+  }
+  if (dictionaryPos == 0)
+    previousByte = dictionary[dictionarySize - 1];
+  else
+    previousByte = dictionary[dictionaryPos - 1];
+
+  #else /* if !_LZMA_OUT_READ */
+
+  int state = 0;
+  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
+  int len = 0;
+  const Byte *Buffer;
+  const Byte *BufferLim;
+  UInt32 Range;
+  UInt32 Code;
+
+  #ifndef _LZMA_IN_CB
+  *inSizeProcessed = 0;
+  #endif
+  *outSizeProcessed = 0;
+
+  {
+    UInt32 i;
+    UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
+    for (i = 0; i < numProbs; i++)
+      p[i] = kBitModelTotal >> 1;
+  }
+  
+  #ifdef _LZMA_IN_CB
+  RC_INIT;
+  #else
+  RC_INIT(inStream, inSize);
+  #endif
+
+  #endif /* _LZMA_OUT_READ */
+
+  while(nowPos < outSize)
+  {
+    CProb *prob;
+    UInt32 bound;
+    int posState = (int)(
+        (nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+        & posStateMask);
+
+    prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
+    IfBit0(prob)
+    {
+      int symbol = 1;
+      UpdateBit0(prob)
+      prob = p + Literal + (LZMA_LIT_SIZE * 
+        (((
+        (nowPos 
+        #ifdef _LZMA_OUT_READ
+        + globalPos
+        #endif
+        )
+        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
+
+      if (state >= kNumLitStates)
+      {
+        int matchByte;
+        #ifdef _LZMA_OUT_READ
+        UInt32 pos = dictionaryPos - rep0;
+        if (pos >= dictionarySize)
+          pos += dictionarySize;
+        matchByte = dictionary[pos];
+        #else
+        matchByte = outStream[nowPos - rep0];
+        #endif
+        do
+        {
+          int bit;
+          CProb *probLit;
+          matchByte <<= 1;
+          bit = (matchByte & 0x100);
+          probLit = prob + 0x100 + bit + symbol;
+          RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
+        }
+        while (symbol < 0x100);
+      }
+      while (symbol < 0x100)
+      {
+        CProb *probLit = prob + symbol;
+        RC_GET_BIT(probLit, symbol)
+      }
+      previousByte = (Byte)symbol;
+
+      outStream[nowPos++] = previousByte;
+      #ifdef _LZMA_OUT_READ
+      if (distanceLimit < dictionarySize)
+        distanceLimit++;
+
+      dictionary[dictionaryPos] = previousByte;
+      if (++dictionaryPos == dictionarySize)
+        dictionaryPos = 0;
+      #endif
+      if (state < 4) state = 0;
+      else if (state < 10) state -= 3;
+      else state -= 6;
+    }
+    else             
+    {
+      UpdateBit1(prob);
+      prob = p + IsRep + state;
+      IfBit0(prob)
+      {
+        UpdateBit0(prob);
+        rep3 = rep2;
+        rep2 = rep1;
+        rep1 = rep0;
+        state = state < kNumLitStates ? 0 : 3;
+        prob = p + LenCoder;
+      }
+      else
+      {
+        UpdateBit1(prob);
+        prob = p + IsRepG0 + state;
+        IfBit0(prob)
+        {
+          UpdateBit0(prob);
+          prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
+          IfBit0(prob)
+          {
+            #ifdef _LZMA_OUT_READ
+            UInt32 pos;
+            #endif
+            UpdateBit0(prob);
+            
+            #ifdef _LZMA_OUT_READ
+            if (distanceLimit == 0)
+            #else
+            if (nowPos == 0)
+            #endif
+              return LZMA_RESULT_DATA_ERROR;
+            
+            state = state < kNumLitStates ? 9 : 11;
+            #ifdef _LZMA_OUT_READ
+            pos = dictionaryPos - rep0;
+            if (pos >= dictionarySize)
+              pos += dictionarySize;
+            previousByte = dictionary[pos];
+            dictionary[dictionaryPos] = previousByte;
+            if (++dictionaryPos == dictionarySize)
+              dictionaryPos = 0;
+            #else
+            previousByte = outStream[nowPos - rep0];
+            #endif
+            outStream[nowPos++] = previousByte;
+            #ifdef _LZMA_OUT_READ
+            if (distanceLimit < dictionarySize)
+              distanceLimit++;
+            #endif
+
+            continue;
+          }
+          else
+          {
+            UpdateBit1(prob);
+          }
+        }
+        else
+        {
+          UInt32 distance;
+          UpdateBit1(prob);
+          prob = p + IsRepG1 + state;
+          IfBit0(prob)
+          {
+            UpdateBit0(prob);
+            distance = rep1;
+          }
+          else 
+          {
+            UpdateBit1(prob);
+            prob = p + IsRepG2 + state;
+            IfBit0(prob)
+            {
+              UpdateBit0(prob);
+              distance = rep2;
+            }
+            else
+            {
+              UpdateBit1(prob);
+              distance = rep3;
+              rep3 = rep2;
+            }
+            rep2 = rep1;
+          }
+          rep1 = rep0;
+          rep0 = distance;
+        }
+        state = state < kNumLitStates ? 8 : 11;
+        prob = p + RepLenCoder;
+      }
+      {
+        int numBits, offset;
+        CProb *probLen = prob + LenChoice;
+        IfBit0(probLen)
+        {
+          UpdateBit0(probLen);
+          probLen = prob + LenLow + (posState << kLenNumLowBits);
+          offset = 0;
+          numBits = kLenNumLowBits;
+        }
+        else
+        {
+          UpdateBit1(probLen);
+          probLen = prob + LenChoice2;
+          IfBit0(probLen)
+          {
+            UpdateBit0(probLen);
+            probLen = prob + LenMid + (posState << kLenNumMidBits);
+            offset = kLenNumLowSymbols;
+            numBits = kLenNumMidBits;
+          }
+          else
+          {
+            UpdateBit1(probLen);
+            probLen = prob + LenHigh;
+            offset = kLenNumLowSymbols + kLenNumMidSymbols;
+            numBits = kLenNumHighBits;
+          }
+        }
+        RangeDecoderBitTreeDecode(probLen, numBits, len);
+        len += offset;
+      }
+
+      if (state < 4)
+      {
+        int posSlot;
+        state += kNumLitStates;
+        prob = p + PosSlot +
+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
+            kNumPosSlotBits);
+        RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
+        if (posSlot >= kStartPosModelIndex)
+        {
+          int numDirectBits = ((posSlot >> 1) - 1);
+          rep0 = (2 | ((UInt32)posSlot & 1));
+          if (posSlot < kEndPosModelIndex)
+          {
+            rep0 <<= numDirectBits;
+            prob = p + SpecPos + rep0 - posSlot - 1;
+          }
+          else
+          {
+            numDirectBits -= kNumAlignBits;
+            do
+            {
+              RC_NORMALIZE
+              Range >>= 1;
+              rep0 <<= 1;
+              if (Code >= Range)
+              {
+                Code -= Range;
+                rep0 |= 1;
+              }
+            }
+            while (--numDirectBits != 0);
+            prob = p + Align;
+            rep0 <<= kNumAlignBits;
+            numDirectBits = kNumAlignBits;
+          }
+          {
+            int i = 1;
+            int mi = 1;
+            do
+            {
+              CProb *prob3 = prob + mi;
+              RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
+              i <<= 1;
+            }
+            while(--numDirectBits != 0);
+          }
+        }
+        else
+          rep0 = posSlot;
+        if (++rep0 == (UInt32)(0))
+        {
+          /* it's for stream version */
+          len = kLzmaStreamWasFinishedId;
+          break;
+        }
+      }
+
+      len += kMatchMinLen;
+      #ifdef _LZMA_OUT_READ
+      if (rep0 > distanceLimit) 
+      #else
+      if (rep0 > nowPos)
+      #endif
+        return LZMA_RESULT_DATA_ERROR;
+
+      #ifdef _LZMA_OUT_READ
+      if (dictionarySize - distanceLimit > (UInt32)len)
+        distanceLimit += len;
+      else
+        distanceLimit = dictionarySize;
+      #endif
+
+      do
+      {
+        #ifdef _LZMA_OUT_READ
+        UInt32 pos = dictionaryPos - rep0;
+        if (pos >= dictionarySize)
+          pos += dictionarySize;
+        previousByte = dictionary[pos];
+        dictionary[dictionaryPos] = previousByte;
+        if (++dictionaryPos == dictionarySize)
+          dictionaryPos = 0;
+        #else
+        previousByte = outStream[nowPos - rep0];
+        #endif
+        len--;
+        outStream[nowPos++] = previousByte;
+      }
+      while(len != 0 && nowPos < outSize);
+    }
+  }
+  RC_NORMALIZE;
+
+  #ifdef _LZMA_OUT_READ
+  vs->Range = Range;
+  vs->Code = Code;
+  vs->DictionaryPos = dictionaryPos;
+  vs->GlobalPos = globalPos + (UInt32)nowPos;
+  vs->DistanceLimit = distanceLimit;
+  vs->Reps[0] = rep0;
+  vs->Reps[1] = rep1;
+  vs->Reps[2] = rep2;
+  vs->Reps[3] = rep3;
+  vs->State = state;
+  vs->RemainLen = len;
+  vs->TempDictionary[0] = tempDictionary[0];
+  #endif
+
+  #ifdef _LZMA_IN_CB
+  vs->Buffer = Buffer;
+  vs->BufferLim = BufferLim;
+  #else
+  *inSizeProcessed = (SizeT)(Buffer - inStream);
+  #endif
+  *outSizeProcessed = nowPos;
+  return LZMA_RESULT_OK;
+}
diff --git a/target/image/generic/lzma-loader/src/LzmaDecode.h b/target/image/generic/lzma-loader/src/LzmaDecode.h
new file mode 100644 (file)
index 0000000..213062a
--- /dev/null
@@ -0,0 +1,131 @@
+/* 
+  LzmaDecode.h
+  LZMA Decoder interface
+
+  LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08)
+  http://www.7-zip.org/
+
+  LZMA SDK is licensed under two licenses:
+  1) GNU Lesser General Public License (GNU LGPL)
+  2) Common Public License (CPL)
+  It means that you can select one of these two licenses and 
+  follow rules of that license.
+
+  SPECIAL EXCEPTION:
+  Igor Pavlov, as the author of this code, expressly permits you to 
+  statically or dynamically link your code (or bind by name) to the 
+  interfaces of this file without subjecting your linked code to the 
+  terms of the CPL or GNU LGPL. Any modifications or additions 
+  to this file, however, are subject to the LGPL or CPL terms.
+*/
+
+#ifndef __LZMADECODE_H
+#define __LZMADECODE_H
+
+/* #define _LZMA_IN_CB */
+/* Use callback for input data */
+
+/* #define _LZMA_OUT_READ */
+/* Use read function for output data */
+
+/* #define _LZMA_PROB32 */
+/* It can increase speed on some 32-bit CPUs, 
+   but memory usage will be doubled in that case */
+
+/* #define _LZMA_LOC_OPT */
+/* Enable local speed optimizations inside code */
+
+/* #define _LZMA_SYSTEM_SIZE_T */
+/* Use system's size_t. You can use it to enable 64-bit sizes supporting*/
+
+#ifndef UInt32
+#ifdef _LZMA_UINT32_IS_ULONG
+#define UInt32 unsigned long
+#else
+#define UInt32 unsigned int
+#endif
+#endif
+
+#ifndef SizeT
+#ifdef _LZMA_SYSTEM_SIZE_T
+#include <stddef.h>
+#define SizeT size_t
+#else
+#define SizeT UInt32
+#endif
+#endif
+
+#ifdef _LZMA_PROB32
+#define CProb UInt32
+#else
+#define CProb unsigned short
+#endif
+
+#define LZMA_RESULT_OK 0
+#define LZMA_RESULT_DATA_ERROR 1
+
+#ifdef _LZMA_IN_CB
+typedef struct _ILzmaInCallback
+{
+  int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
+} ILzmaInCallback;
+#endif
+
+#define LZMA_BASE_SIZE 1846
+#define LZMA_LIT_SIZE 768
+
+#define LZMA_PROPERTIES_SIZE 5
+
+typedef struct _CLzmaProperties
+{
+  int lc;
+  int lp;
+  int pb;
+  #ifdef _LZMA_OUT_READ
+  UInt32 DictionarySize;
+  #endif
+}CLzmaProperties;
+
+int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
+
+#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
+
+#define kLzmaNeedInitId (-2)
+
+typedef struct _CLzmaDecoderState
+{
+  CLzmaProperties Properties;
+  CProb *Probs;
+
+  #ifdef _LZMA_IN_CB
+  const unsigned char *Buffer;
+  const unsigned char *BufferLim;
+  #endif
+
+  #ifdef _LZMA_OUT_READ
+  unsigned char *Dictionary;
+  UInt32 Range;
+  UInt32 Code;
+  UInt32 DictionaryPos;
+  UInt32 GlobalPos;
+  UInt32 DistanceLimit;
+  UInt32 Reps[4];
+  int State;
+  int RemainLen;
+  unsigned char TempDictionary[4];
+  #endif
+} CLzmaDecoderState;
+
+#ifdef _LZMA_OUT_READ
+#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
+#endif
+
+int LzmaDecode(CLzmaDecoderState *vs,
+    #ifdef _LZMA_IN_CB
+    ILzmaInCallback *inCallback,
+    #else
+    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
+    #endif
+    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
+
+#endif
diff --git a/target/image/generic/lzma-loader/src/Makefile b/target/image/generic/lzma-loader/src/Makefile
new file mode 100644 (file)
index 0000000..5435688
--- /dev/null
@@ -0,0 +1,57 @@
+LOADADDR = 0x80400000          # RAM start + 4M
+KERNEL_ENTRY = 0x80001000
+RAMSIZE = 0x00100000           # 1MB
+IMAGE_COPY:=0
+
+CROSS_COMPILE = mips-linux-
+
+OBJCOPY:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
+CFLAGS := -fno-builtin -Os -G 0 -ffunction-sections -mno-abicalls -fno-pic -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -Wall -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} -D_LZMA_IN_CB
+ifeq ($(IMAGE_COPY),1)
+CFLAGS += -DLOADADDR=${LOADADDR} -DIMAGE_COPY=1
+endif
+
+.S.s:
+       $(CPP) $(CFLAGS) $< -o $*.s
+.S.o:
+       $(CC) $(CFLAGS) -c $< -o $*.o
+.c.o:
+       $(CC) $(CFLAGS) -c $< -o $*.o
+
+CC =       $(CROSS_COMPILE)gcc
+LD =       $(CROSS_COMPILE)ld
+OBJDUMP =  $(CROSS_COMPILE)objdump
+
+O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
+
+# Drop some uninteresting sections in the kernel.
+# This is only relevant for ELF kernels but doesn't hurt a.out
+drop-sections   = .reginfo .mdebug .comment
+strip-flags     = $(addprefix --remove-section=,$(drop-sections))
+
+all : lzma.elf
+
+lzma.lds: lzma.lds.in
+       sed -e 's,@LOADADDR@,$(LOADADDR),g' -e 's,@ENTRY@,_start,g' $< >$@
+
+kernel.o: vmlinux.lzma lzma.lds
+       $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
+
+ifeq ($(IMAGE_COPY),1)
+lzma.o: decompress.o LzmaDecode.o kernel.o
+       sed -e 's,@LOADADDR@,$(LOADADDR),g' -e 's,@ENTRY@,entry,g' lzma.lds.in >lzma-stage2.lds
+       $(LD) -static --no-warn-mismatch -e entry -Tlzma-stage2.lds -o temp-$@ $^
+       $(OBJCOPY) temp-$@ lzma.tmp
+       @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > lzma-data.lds
+       $(LD) -no-warn-mismatch -T lzma-data.lds -r -o $@ -b binary lzma.tmp --oformat $(O_FORMAT)
+       
+lzma.elf: start.o lzma.o
+       sed -e 's,@LOADADDR@,$(KERNEL_ENTRY),g' lzma-copy.lds.in >lzma-copy.lds
+       $(LD) -s -Tlzma-copy.lds -o $@ $^
+else
+lzma.elf: start.o decompress.o LzmaDecode.o kernel.o
+       $(LD) -s -Tlzma.lds -o $@ $^
+endif
+
+clean:
+       rm -f *.o lzma.elf *.tmp *.lds
diff --git a/target/image/generic/lzma-loader/src/decompress.c b/target/image/generic/lzma-loader/src/decompress.c
new file mode 100644 (file)
index 0000000..4ed432d
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * LZMA compressed kernel decompressor for bcm947xx boards
+ *
+ * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Please note, this was code based on the bunzip2 decompressor code
+ * by Manuel Novoa III  (mjn3@codepoet.org), although the only thing left
+ * is an idea and part of original vendor code
+ *
+ *
+ * 12-Mar-2005  Mineharu Takahara <mtakahar@yahoo.com>
+ *   pass actual output size to decoder (stream mode
+ *   compressed input is not a requirement anymore)
+ *
+ * 24-Apr-2005 Oleg I. Vdovikin
+ *   reordered functions using lds script, removed forward decl
+ *
+ * ??-Nov-2005 Mike Baker
+ *   reorder the script as an lzma wrapper; do not depend on flash access
+ */
+
+#include "LzmaDecode.h"
+
+#define KSEG0                  0x80000000
+#define KSEG1                  0xa0000000
+
+#define KSEG1ADDR(a)           ((((unsigned)(a)) & 0x1fffffffU) | KSEG1)
+
+#define Index_Invalidate_I     0x00
+#define Index_Writeback_Inv_D   0x01
+
+#define cache_unroll(base,op)  \
+       __asm__ __volatile__(           \
+               ".set noreorder;\n"             \
+               ".set mips3;\n"                 \
+               "cache %1, (%0);\n"             \
+               ".set mips0;\n"                 \
+               ".set reorder\n"                \
+               :                                               \
+               : "r" (base),                   \
+                 "i" (op));
+
+
+static __inline__ void blast_icache(unsigned long size, unsigned long lsize)
+{
+       unsigned long start = KSEG0;
+       unsigned long end = (start + size);
+
+       while(start < end) {
+               cache_unroll(start,Index_Invalidate_I);
+               start += lsize;
+       }
+}
+
+static __inline__ void blast_dcache(unsigned long size, unsigned long lsize)
+{
+       unsigned long start = KSEG0;
+       unsigned long end = (start + size);
+
+       while(start < end) {
+               cache_unroll(start,Index_Writeback_Inv_D);
+               start += lsize;
+       }
+}
+
+unsigned char *data;
+
+static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
+{
+       *bufferSize = 1;
+       *buffer = data;
+       ++data;
+       return LZMA_RESULT_OK;
+}
+
+static __inline__ unsigned char get_byte(void)
+{
+       unsigned char *buffer;
+       UInt32 fake;
+       
+       return read_byte(0, &buffer, &fake), *buffer;
+}
+
+static char *buffer = (char *)0x80C00000;
+extern char lzma_start[];
+extern char lzma_end[];
+
+/* should be the first function */
+void entry(unsigned long icache_size, unsigned long icache_lsize, 
+       unsigned long dcache_size, unsigned long dcache_lsize)
+{
+       unsigned int i;  /* temp value */
+       unsigned int osize; /* uncompressed size */
+       volatile unsigned int arg0, arg1, arg2, arg3;
+
+       /* restore argument registers */
+       __asm__ __volatile__ ("ori %0, $12, 0":"=r"(arg0));
+       __asm__ __volatile__ ("ori %0, $13, 0":"=r"(arg1));
+       __asm__ __volatile__ ("ori %0, $14, 0":"=r"(arg2));
+       __asm__ __volatile__ ("ori %0, $15, 0":"=r"(arg3));
+
+       ILzmaInCallback callback;
+       CLzmaDecoderState vs;
+       callback.Read = read_byte;
+
+       data = lzma_start;
+
+       /* lzma args */
+       i = get_byte();
+       vs.Properties.lc = i % 9, i = i / 9;
+       vs.Properties.lp = i % 5, vs.Properties.pb = i / 5;
+
+       vs.Probs = (CProb *)buffer;
+
+       /* skip rest of the LZMA coder property */
+       for (i = 0; i < 4; i++)
+               get_byte();
+
+       /* read the lower half of uncompressed size in the header */
+       osize = ((unsigned int)get_byte()) +
+               ((unsigned int)get_byte() << 8) +
+               ((unsigned int)get_byte() << 16) +
+               ((unsigned int)get_byte() << 24);
+
+       /* skip rest of the header (upper half of uncompressed size) */
+       for (i = 0; i < 4; i++) 
+               get_byte();
+
+       /* decompress kernel */
+       if ((i = LzmaDecode(&vs, &callback,
+       (unsigned char*)KERNEL_ENTRY, osize, &osize)) == LZMA_RESULT_OK)
+       {
+               blast_dcache(dcache_size, dcache_lsize);
+               blast_icache(icache_size, icache_lsize);
+
+               /* Jump to load address */
+               ((void (*)(int a0, int a1, int a2, int a3)) KERNEL_ENTRY)(arg0, arg1, arg2, arg3);
+       }
+}
diff --git a/target/image/generic/lzma-loader/src/lzma-copy.lds.in b/target/image/generic/lzma-loader/src/lzma-copy.lds.in
new file mode 100644 (file)
index 0000000..fbc87ab
--- /dev/null
@@ -0,0 +1,20 @@
+OUTPUT_ARCH(mips)
+ENTRY(_start)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = @LOADADDR@;
+  .text      :
+  {
+    _ftext = . ;
+    *(.text)
+    *(.rodata)
+  } =0
+
+  .reginfo : { *(.reginfo) }
+
+  .bss       :
+  {
+   *(.bss)
+  }
+}
diff --git a/target/image/generic/lzma-loader/src/lzma.lds.in b/target/image/generic/lzma-loader/src/lzma.lds.in
new file mode 100644 (file)
index 0000000..6021cec
--- /dev/null
@@ -0,0 +1,24 @@
+OUTPUT_ARCH(mips)
+ENTRY(@ENTRY@)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = @LOADADDR@;
+  .text      :
+  {
+    _ftext = . ;
+    *(.text.entry)
+    *(.text)
+    *(.rodata)
+    lzma_start = .;
+    kernel.o
+    lzma_end = .;
+  } =0
+
+  .reginfo : { *(.reginfo) }
+
+  .bss       :
+  {
+   *(.bss)
+  }
+}
diff --git a/target/image/generic/lzma-loader/src/print.c b/target/image/generic/lzma-loader/src/print.c
new file mode 100644 (file)
index 0000000..950687b
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include       "print.h"
+
+/* macros */
+#define                IsDigit(x)      ( ((x) >= '0') && ((x) <= '9') )
+#define                Ctod(x)         ( (x) - '0')
+
+/* forward declaration */
+extern int PrintChar(char *, char, int, int);
+extern int PrintString(char *, char *, int, int);
+extern int PrintNum(char *, unsigned long, int, int, int, int, char, int);
+
+/* private variable */
+static const char theFatalMsg[] = "fatal error in lp_Print!";
+
+/* -*-
+ * A low level printf() function.
+ */
+void
+lp_Print(void (*output)(void *, char *, int), 
+        void * arg,
+        char *fmt, 
+        va_list ap)
+{
+
+#define        OUTPUT(arg, s, l)  \
+  { if (((l) < 0) || ((l) > LP_MAX_BUF)) { \
+       (*output)(arg, (char*)theFatalMsg, sizeof(theFatalMsg)-1); for(;;); \
+    } else { \
+      (*output)(arg, s, l); \
+    } \
+  }
+    
+    char buf[LP_MAX_BUF];
+
+    char c;
+    char *s;
+    long int num;
+
+    int longFlag;
+    int negFlag;
+    int width;
+    int prec;
+    int ladjust;
+    char padc;
+
+    int length;
+
+    for(;;) {
+       { 
+           /* scan for the next '%' */
+           char *fmtStart = fmt;
+           while ( (*fmt != '\0') && (*fmt != '%')) {
+               fmt ++;
+           }
+
+           /* flush the string found so far */
+           OUTPUT(arg, fmtStart, fmt-fmtStart);
+
+           /* are we hitting the end? */
+           if (*fmt == '\0') break;
+       }
+
+       /* we found a '%' */
+       fmt ++;
+       
+       /* check for long */
+       if (*fmt == 'l') {
+           longFlag = 1;
+           fmt ++;
+       } else {
+           longFlag = 0;
+       }
+
+       /* check for other prefixes */
+       width = 0;
+       prec = -1;
+       ladjust = 0;
+       padc = ' ';
+
+       if (*fmt == '-') {
+           ladjust = 1;
+           fmt ++;
+       }
+
+       if (*fmt == '0') {
+           padc = '0';
+           fmt++;
+       }
+
+       if (IsDigit(*fmt)) {
+           while (IsDigit(*fmt)) {
+               width = 10 * width + Ctod(*fmt++);
+           }
+       }
+
+       if (*fmt == '.') {
+           fmt ++;
+           if (IsDigit(*fmt)) {
+               prec = 0;
+               while (IsDigit(*fmt)) {
+                   prec = prec*10 + Ctod(*fmt++);
+               }
+           }
+       }
+
+
+       /* check format flag */
+       negFlag = 0;
+       switch (*fmt) {
+        case 'b':
+           if (longFlag) { 
+               num = va_arg(ap, long int); 
+           } else { 
+               num = va_arg(ap, int);
+           }
+           length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case 'd':
+        case 'D':
+           if (longFlag) { 
+               num = va_arg(ap, long int);
+           } else { 
+               num = va_arg(ap, int); 
+           }
+           if (num < 0) {
+               num = - num;
+               negFlag = 1;
+           }
+           length = PrintNum(buf, num, 10, negFlag, width, ladjust, padc, 0);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case 'o':
+        case 'O':
+           if (longFlag) { 
+               num = va_arg(ap, long int);
+           } else { 
+               num = va_arg(ap, int); 
+           }
+           length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case 'u':
+        case 'U':
+           if (longFlag) { 
+               num = va_arg(ap, long int);
+           } else { 
+               num = va_arg(ap, int); 
+           }
+           length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0);
+           OUTPUT(arg, buf, length);
+           break;
+           
+        case 'x':
+           if (longFlag) { 
+               num = va_arg(ap, long int);
+           } else { 
+               num = va_arg(ap, int); 
+           }
+           length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case 'X':
+           if (longFlag) { 
+               num = va_arg(ap, long int);
+           } else { 
+               num = va_arg(ap, int); 
+           }
+           length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case 'c':
+           c = (char)va_arg(ap, int);
+           length = PrintChar(buf, c, width, ladjust);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case 's':
+           s = (char*)va_arg(ap, char *);
+           length = PrintString(buf, s, width, ladjust);
+           OUTPUT(arg, buf, length);
+           break;
+
+        case '\0':
+           fmt --;
+           break;
+
+        default:
+           /* output this char as it is */
+           OUTPUT(arg, fmt, 1);
+       }       /* switch (*fmt) */
+
+       fmt ++;
+    }          /* for(;;) */
+
+    /* special termination call */
+    OUTPUT(arg, "\0", 1);
+}
+
+
+/* --------------- local help functions --------------------- */
+int
+PrintChar(char * buf, char c, int length, int ladjust)
+{
+    int i;
+    
+    if (length < 1) length = 1;
+    if (ladjust) {
+       *buf = c;
+       for (i=1; i< length; i++) buf[i] = ' ';
+    } else {
+       for (i=0; i< length-1; i++) buf[i] = ' ';
+       buf[length - 1] = c;
+    }
+    return length;
+}
+
+int
+PrintString(char * buf, char* s, int length, int ladjust)
+{
+    int i;
+    int len=0;
+    char* s1 = s;
+    while (*s1++) len++;
+    if (length < len) length = len;
+
+    if (ladjust) {
+       for (i=0; i< len; i++) buf[i] = s[i];
+       for (i=len; i< length; i++) buf[i] = ' ';
+    } else {
+       for (i=0; i< length-len; i++) buf[i] = ' ';
+       for (i=length-len; i < length; i++) buf[i] = s[i-length+len];
+    }
+    return length;
+}
+
+int
+PrintNum(char * buf, unsigned long u, int base, int negFlag, 
+        int length, int ladjust, char padc, int upcase)
+{
+    /* algorithm :
+     *  1. prints the number from left to right in reverse form.
+     *  2. fill the remaining spaces with padc if length is longer than
+     *     the actual length
+     *     TRICKY : if left adjusted, no "0" padding.
+     *             if negtive, insert  "0" padding between "0" and number.
+     *  3. if (!ladjust) we reverse the whole string including paddings
+     *  4. otherwise we only reverse the actual string representing the num.
+     */
+
+    int actualLength =0;
+    char *p = buf;
+    int i;
+
+    do {
+       int tmp = u %base;
+       if (tmp <= 9) {
+           *p++ = '0' + tmp;
+       } else if (upcase) {
+           *p++ = 'A' + tmp - 10;
+       } else {
+           *p++ = 'a' + tmp - 10;
+       }
+       u /= base;
+    } while (u != 0);
+
+    if (negFlag) {
+       *p++ = '-';
+    }
+
+    /* figure out actual length and adjust the maximum length */
+    actualLength = p - buf;
+    if (length < actualLength) length = actualLength;
+
+    /* add padding */
+    if (ladjust) {
+       padc = ' ';
+    }
+    if (negFlag && !ladjust && (padc == '0')) {
+       for (i = actualLength-1; i< length-1; i++) buf[i] = padc;
+       buf[length -1] = '-';
+    } else {
+       for (i = actualLength; i< length; i++) buf[i] = padc;
+    }
+           
+
+    /* prepare to reverse the string */
+    {
+       int begin = 0;
+       int end;
+       if (ladjust) {
+           end = actualLength - 1;
+       } else {
+           end = length -1;
+       }
+
+       while (end > begin) {
+           char tmp = buf[begin];
+           buf[begin] = buf[end];
+           buf[end] = tmp;
+           begin ++;
+           end --;
+       }
+    }
+
+    /* adjust the string pointer */
+    return length;
+}
diff --git a/target/image/generic/lzma-loader/src/print.h b/target/image/generic/lzma-loader/src/print.h
new file mode 100644 (file)
index 0000000..b051463
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _print_h_
+#define _print_h_
+
+#include <stdarg.h>
+
+/* this is the maximum width for a variable */
+#define                LP_MAX_BUF      80
+
+/* -*-
+ * output function takes an void pointer which is passed in as the
+ * second argument in lp_Print().  This black-box argument gives output
+ * function a way to track state.
+ *
+ * The second argument in output function is a pointer to char buffer.
+ * The third argument specifies the number of chars to outputed.
+ *
+ * output function cannot assume the buffer is null-terminated after
+ * l number of chars.
+ */
+void lp_Print(void (*output)(void *, char *, int), 
+             void * arg,
+             char *fmt, 
+             va_list ap);
+
+#endif
diff --git a/target/image/generic/lzma-loader/src/printf.c b/target/image/generic/lzma-loader/src/printf.c
new file mode 100644 (file)
index 0000000..49bd50d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include "printf.h"
+#include "print.h"
+#include "uart16550.h"
+
+static void myoutput(void *arg, char *s, int l)
+{
+    int i;
+
+    // special termination call
+    if ((l==1) && (s[0] == '\0')) return;
+    
+    for (i=0; i< l; i++) {
+       Uart16550Put(s[i]);
+       if (s[i] == '\n') Uart16550Put('\r');
+    }
+}
+
+void printf(char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    lp_Print(myoutput, 0, fmt, ap);
+    va_end(ap);
+}
diff --git a/target/image/generic/lzma-loader/src/printf.h b/target/image/generic/lzma-loader/src/printf.h
new file mode 100644 (file)
index 0000000..9b1c1df
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _printf_h_
+#define _printf_h_
+
+#include <stdarg.h>
+void printf(char *fmt, ...);
+
+#endif /* _printf_h_ */
diff --git a/target/image/generic/lzma-loader/src/start.S b/target/image/generic/lzma-loader/src/start.S
new file mode 100644 (file)
index 0000000..9a85c4c
--- /dev/null
@@ -0,0 +1,160 @@
+#include <asm/asm.h>
+#include <asm/regdef.h>
+
+#define KSEG0          0x80000000
+
+#define C0_CONFIG      $16
+#define C0_TAGLO       $28
+#define C0_TAGHI       $29
+
+#define        CONF1_DA_SHIFT  7                       /* D$ associativity */
+#define CONF1_DA_MASK  0x00000380
+#define CONF1_DA_BASE  1
+#define CONF1_DL_SHIFT 10                      /* D$ line size */
+#define CONF1_DL_MASK  0x00001c00
+#define CONF1_DL_BASE  2
+#define CONF1_DS_SHIFT 13                      /* D$ sets/way */
+#define CONF1_DS_MASK  0x0000e000
+#define CONF1_DS_BASE  64
+#define CONF1_IA_SHIFT 16                      /* I$ associativity */
+#define CONF1_IA_MASK  0x00070000
+#define CONF1_IA_BASE  1
+#define CONF1_IL_SHIFT 19                      /* I$ line size */
+#define CONF1_IL_MASK  0x00380000
+#define CONF1_IL_BASE  2
+#define CONF1_IS_SHIFT 22                      /* Instruction cache sets/way */
+#define CONF1_IS_MASK  0x01c00000
+#define CONF1_IS_BASE  64
+
+#define Index_Invalidate_I     0x00
+#define Index_Writeback_Inv_D   0x01
+
+LEAF(_start)
+       
+       .set    mips32
+       .set noreorder
+
+       /* save argument registers */
+       move t4, a0
+       move t5, a1
+       move t6, a2
+       move t7, a3
+       
+       /* set up stack */
+       li      sp, 0xa0000000 + RAMSIZE - 16
+
+#ifdef IMAGE_COPY
+       /* Copy decompressor code to the right place */
+       li  t2, LOADADDR
+       add a0, t2, 0
+       la  a1, code_start
+       la  a2, code_stop
+$L1:
+       lw  t0, 0(a1)
+       sw  t0, 0(a0)
+       add a1, 4
+       add a0, 4
+       blt a1, a2, $L1
+       nop
+#endif
+
+       /* At this point we need to invalidate dcache and */
+       /* icache before jumping to new code */
+
+1:     /* Get cache sizes */
+       mfc0    s0,C0_CONFIG,1
+
+       li      s1,CONF1_DL_MASK
+       and     s1,s0
+       beq     s1,zero,nodc
+       nop
+
+       srl     s1,CONF1_DL_SHIFT
+       li      t0,CONF1_DL_BASE
+       sll     s1,t0,s1                /* s1 has D$ cache line size */
+
+       li      s2,CONF1_DA_MASK
+       and     s2,s0
+       srl     s2,CONF1_DA_SHIFT
+       addiu   s2,CONF1_DA_BASE        /* s2 now has D$ associativity */
+
+       li      t0,CONF1_DS_MASK
+       and     t0,s0
+       srl     t0,CONF1_DS_SHIFT
+       li      s3,CONF1_DS_BASE
+       sll     s3,s3,t0                /* s3 has D$ sets per way */
+
+       multu   s2,s3                   /* sets/way * associativity */
+       mflo    t0                      /* total cache lines */
+
+       multu   s1,t0                   /* D$ linesize * lines */
+       mflo    s2                      /* s2 is now D$ size in bytes */
+
+       /* Initilize the D$: */
+       mtc0    zero,C0_TAGLO
+       mtc0    zero,C0_TAGHI
+
+       li      t0,KSEG0                /* Just an address for the first $ line */
+       addu    t1,t0,s2                /*  + size of cache == end */
+
+1:     cache   Index_Writeback_Inv_D,0(t0)
+       bne     t0,t1,1b
+       addu    t0,s1
+       
+nodc:
+       /* Now we get to do it all again for the I$ */
+       
+       move    s3,zero                 /* just in case there is no icache */
+       move    s4,zero
+
+       li      t0,CONF1_IL_MASK
+       and     t0,s0
+       beq     t0,zero,noic
+       nop
+
+       srl     t0,CONF1_IL_SHIFT
+       li      s3,CONF1_IL_BASE
+       sll     s3,t0                   /* s3 has I$ cache line size */
+
+       li      t0,CONF1_IA_MASK
+       and     t0,s0
+       srl     t0,CONF1_IA_SHIFT
+       addiu   s4,t0,CONF1_IA_BASE     /* s4 now has I$ associativity */
+
+       li      t0,CONF1_IS_MASK
+       and     t0,s0
+       srl     t0,CONF1_IS_SHIFT
+       li      s5,CONF1_IS_BASE
+       sll     s5,t0                   /* s5 has I$ sets per way */
+
+       multu   s4,s5                   /* sets/way * associativity */
+       mflo    t0                      /* s4 is now total cache lines */
+
+       multu   s3,t0                   /* I$ linesize * lines */
+       mflo    s4                      /* s4 is cache size in bytes */
+
+       /* Initilize the I$: */
+       mtc0    zero,C0_TAGLO
+       mtc0    zero,C0_TAGHI
+
+       li      t0,KSEG0                /* Just an address for the first $ line */
+       addu    t1,t0,s4                /*  + size of cache == end */
+
+1:     cache   Index_Invalidate_I,0(t0)
+       bne     t0,t1,1b
+       addu    t0,s3
+noic:
+       /* jump to main */
+       move    a0,s3                   /* icache line size */
+       move    a1,s4                   /* icache size */
+       move    a2,s1                   /* dcache line size */
+#ifdef IMAGE_COPY
+       jal             t2
+#else
+       jal     entry
+#endif
+       move    a3,s2                   /* dcache size */
+
+       .set reorder
+END(_start)
+
diff --git a/target/image/generic/lzma-loader/src/uart16550.c b/target/image/generic/lzma-loader/src/uart16550.c
new file mode 100644 (file)
index 0000000..7df5727
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+
+#include "uart16550.h"
+
+/* === CONFIG === */
+
+#define         BASE                    0xb8058000
+#define         MAX_BAUD                1152000
+#define         REG_OFFSET              4
+
+/* === END OF CONFIG === */
+
+/* register offset */
+#define         OFS_RCV_BUFFER          (0*REG_OFFSET)
+#define         OFS_TRANS_HOLD          (0*REG_OFFSET)
+#define         OFS_SEND_BUFFER         (0*REG_OFFSET)
+#define         OFS_INTR_ENABLE         (1*REG_OFFSET)
+#define         OFS_INTR_ID             (2*REG_OFFSET)
+#define         OFS_DATA_FORMAT         (3*REG_OFFSET)
+#define         OFS_LINE_CONTROL        (3*REG_OFFSET)
+#define         OFS_MODEM_CONTROL       (4*REG_OFFSET)
+#define         OFS_RS232_OUTPUT        (4*REG_OFFSET)
+#define         OFS_LINE_STATUS         (5*REG_OFFSET)
+#define         OFS_MODEM_STATUS        (6*REG_OFFSET)
+#define         OFS_RS232_INPUT         (6*REG_OFFSET)
+#define         OFS_SCRATCH_PAD         (7*REG_OFFSET)
+
+#define         OFS_DIVISOR_LSB         (0*REG_OFFSET)
+#define         OFS_DIVISOR_MSB         (1*REG_OFFSET)
+
+
+/* memory-mapped read/write of the port */
+#define         UART16550_READ(y)    (*((volatile uint32*)(BASE + y)))
+#define         UART16550_WRITE(y, z)  ((*((volatile uint32*)(BASE + y))) = z)
+
+#define DEBUG_LED (*(unsigned short*)0xb7ffffc0)
+#define OutputLED(x)  (DEBUG_LED = x)
+
+void Uart16550Init(uint32 baud, uint8 data, uint8 parity, uint8 stop)
+{
+    /* disable interrupts */
+    UART16550_WRITE(OFS_INTR_ENABLE, 0);
+
+    /* set up buad rate */
+    { 
+        uint32 divisor;
+       
+        /* set DIAB bit */
+        UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
+        
+        /* set divisor */
+        divisor = MAX_BAUD / baud;
+        UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
+        UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00)>>8);
+
+        /* clear DIAB bit */
+        UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
+    }
+
+    /* set data format */
+    UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
+}
+
+uint8 Uart16550GetPoll()
+{
+    while((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
+    return UART16550_READ(OFS_RCV_BUFFER);
+}
+
+
+void Uart16550Put(uint8 byte)
+{
+    while ((UART16550_READ(OFS_LINE_STATUS) &0x20) == 0);
+    UART16550_WRITE(OFS_SEND_BUFFER, byte);
+}
+
diff --git a/target/image/generic/lzma-loader/src/uart16550.h b/target/image/generic/lzma-loader/src/uart16550.h
new file mode 100644 (file)
index 0000000..b3fd6fd
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2001 MontaVista Software Inc.
+ * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _uart16550_h_
+#define _uart16550_h_
+
+typedef         unsigned char uint8;
+typedef         unsigned int  uint32;
+
+#define         UART16550_BAUD_2400             2400
+#define         UART16550_BAUD_4800             4800
+#define         UART16550_BAUD_9600             9600
+#define         UART16550_BAUD_19200            19200
+#define         UART16550_BAUD_38400            38400
+#define         UART16550_BAUD_57600            57600
+#define         UART16550_BAUD_115200           115200
+
+#define         UART16550_PARITY_NONE           0
+#define         UART16550_PARITY_ODD            0x08
+#define         UART16550_PARITY_EVEN           0x18
+#define         UART16550_PARITY_MARK           0x28
+#define         UART16550_PARITY_SPACE          0x38
+
+#define         UART16550_DATA_5BIT             0x0
+#define         UART16550_DATA_6BIT             0x1
+#define         UART16550_DATA_7BIT             0x2
+#define         UART16550_DATA_8BIT             0x3
+
+#define         UART16550_STOP_1BIT             0x0
+#define         UART16550_STOP_2BIT             0x4
+
+void Uart16550Init(uint32 baud, uint8 data, uint8 parity, uint8 stop);
+
+/* blocking call */
+uint8 Uart16550GetPoll();
+
+void Uart16550Put(uint8 byte);
+
+#endif
diff --git a/target/image/rb532/Makefile b/target/image/rb532/Makefile
new file mode 100644 (file)
index 0000000..bba8952
--- /dev/null
@@ -0,0 +1,51 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+LOADADDR = 0x81000000          # RAM start + 16M 
+KERNEL_ENTRY = 0x80101000
+RAMSIZE = 0x00100000           # 1MB
+IMAGE_COPY = 1
+
+LOADER_MAKEOPTS= \
+               KDIR=$(KDIR) \
+               LOADADDR=$(LOADADDR) \
+               KERNEL_ENTRY=$(KERNEL_ENTRY) \
+               RAMSIZE=$(RAMSIZE) \
+               IMAGE_COPY=$(IMAGE_COPY)
+
+define Build/Clean
+       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
+endef
+
+define Image/Prepare
+       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
+endef
+
+define Image/BuildKernel
+       $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
+endef
+
+PARTITION1=\x80\x01\x01\x00\x27\x01\x20\x7b\x20\x00\x00\x00\xe0\x1e\x00\x00# 4 MB  (kernel part)
+PARTITION2=\x00\x00\x01\x7c\x83\x01\xa0\x64\x00\x1f\x00\x00\x40\x7a\x00\x00# 16 MB (rootfs part)
+
+define Image/Build/jffs2-128k
+       ( \
+               echo -ne OWRT | dd bs=$$$$((0x1be)) conv=sync; \
+               ( \
+                       echo -ne '$(strip $(PARTITION1))'; \
+                       echo -ne '$(strip $(PARTITION2))'; \
+               ) | dd bs=$$$$((0x40)) conv=sync; \
+               echo -ne '\x55\xaa'; \
+               dd if=/dev/zero bs=$$$$((0x3e00)) conv=sync count=1; \
+               dd if=$(KDIR)/loader.elf bs=$$$$((0x3dc000)) conv=sync; \
+               cat $(KDIR)/root.$(1); \
+               echo -ne '\xde\xad\xc0\xde'; \
+       ) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
+endef
+
+define Image/Build
+       $(call Image/Build/$(1),$(1))
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/image/x86/Makefile b/target/image/x86/Makefile
new file mode 100644 (file)
index 0000000..e4b3a9e
--- /dev/null
@@ -0,0 +1,9 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+define Image/Build
+       cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
+       cp $(KDIR)/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/image/xscale/Makefile b/target/image/xscale/Makefile
new file mode 100644 (file)
index 0000000..683c602
--- /dev/null
@@ -0,0 +1,11 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+define Image/Build
+ifneq ($(FS),jffs2-64k)
+       cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
+       cp $(KDIR)/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
+endif
+endef
+
+$(eval $(call BuildImage))
index e1a314d..bab2684 100644 (file)
@@ -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/%,%,$@)
diff --git a/target/linux/image/ar7/Makefile b/target/linux/image/ar7/Makefile
deleted file mode 100644 (file)
index 5ee6b0d..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/ar7loader
-
-LOADADDR := 0x94020000
-OUTPUT_FORMAT := elf32-tradlittlemips
-
-CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-       -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
-       -pipe -mlong-calls -fno-common \
-       -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \
-       -DLOADADDR=$(LOADADDR)
-
-$(PKG_BUILD_DIR)/cksum.o: $(PKG_BUILD_DIR)/cksum.c
-       $(HOSTCC) -o $@ $<
-
-$(PKG_BUILD_DIR)/ckmain.o: $(PKG_BUILD_DIR)/ckmain.c
-       $(HOSTCC) -o $@ $<
-
-$(PKG_BUILD_DIR)/tichksum: $(PKG_BUILD_DIR)/ckmain.o $(PKG_BUILD_DIR)/cksum.o
-       $(HOSTCC) -o $@ $<
-
-$(PKG_BUILD_DIR)/LzmaDecode.o: src/LzmaDecode.c
-       $(TARGET_CC) $(CFLAGS) -c -o $@ $<
-
-$(PKG_BUILD_DIR)/loader.o: src/loader.c
-       $(TARGET_CC) $(CFLAGS) -c -o $@ $<
-
-$(STAGING_DIR)/bin/srec2bin: src/srec2bin.c
-       $(HOSTCC) -o $@ $<
-
-
-define Build/Compile
-       mkdir -p $(PKG_BUILD_DIR)
-       sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-           -e 's/@@LOADADDR@@/$(LOADADDR)/' \
-                       < src/zimage.script.in \
-                       > $(PKG_BUILD_DIR)/zimage.script
-       sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-           -e 's/@@LOADADDR@@/$(LOADADDR)/' \
-                       < src/ld.script.in \
-                       > $(PKG_BUILD_DIR)/ld.script
-       $(MAKE) $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin
-endef
-
-define Build/Clean
-       rm -rf $(PKG_BUILD_DIR)
-endef
-
-define Image/Prepare
-       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
-       $(TARGET_CROSS)ld -T $(PKG_BUILD_DIR)/zimage.script -r -b binary $(KDIR)/vmlinux.lzma -o $(KDIR)/zimage.o
-       $(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=0x$${shell nm $(KDIR)/linux-*/vmlinux | grep kernel_entry | cut -d' ' -f1} -T $(PKG_BUILD_DIR)/ld.script \
-               $(PKG_BUILD_DIR)/loader.o \
-               $(PKG_BUILD_DIR)/LzmaDecode.o \
-               $(KDIR)/zimage.o \
-               -o $(KDIR)/loader
-       $(TARGET_CROSS)objcopy -O srec $(KDIR)/loader $(KDIR)/ram_zimage.sre
-       $(STAGING_DIR)/bin/srec2bin $(KDIR)/ram_zimage.sre $(KDIR)/vmlinux.bin
-endef
-
-ifeq ($(FS),jffs2-8MB)
-ALIGN:=bs=131072 conv=sync
-endif
-ifeq ($(FS),jffs2-4MB)
-ALIGN:=bs=65536 conv=sync
-endif
-
-define Image/Build/CyberTAN
-       (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin) | \
-               $(STAGING_DIR)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
-endef
-
-define Image/Build/sErCoMm
-       cat sercomm/adam2.bin "$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin" > "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img"
-       dd if=sercomm/$(2) of="$(KDIR)/dgfw.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc
-       $(STAGING_DIR)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img" "$(KDIR)/dgfw.tmp"
-       rm -f "$(KDIR)/dgfw.tmp"
-endef
-
-define Image/Build
-       dd if=$(KDIR)/vmlinux.bin $(ALIGN) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
-       cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
-       $(call Image/Build/CyberTAN,$(1),AG1B,AG1B,$(1))
-       $(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
-       $(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
-       $(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
-       $(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
-       $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
-       $(call Image/Build/sErCoMm,$(1),dg834,$(1))
-       $(call Image/Build/sErCoMm,$(1),jdr454wb,$(1))
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/ar7/sercomm/adam2.bin b/target/linux/image/ar7/sercomm/adam2.bin
deleted file mode 100644 (file)
index d4aa0cd..0000000
Binary files a/target/linux/image/ar7/sercomm/adam2.bin and /dev/null differ
diff --git a/target/linux/image/ar7/sercomm/dg834 b/target/linux/image/ar7/sercomm/dg834
deleted file mode 100644 (file)
index 61fe336..0000000
Binary files a/target/linux/image/ar7/sercomm/dg834 and /dev/null differ
diff --git a/target/linux/image/ar7/sercomm/jdr454wb b/target/linux/image/ar7/sercomm/jdr454wb
deleted file mode 100644 (file)
index 821ff1c..0000000
Binary files a/target/linux/image/ar7/sercomm/jdr454wb and /dev/null differ
diff --git a/target/linux/image/ar7/src/LzmaDecode.c b/target/linux/image/ar7/src/LzmaDecode.c
deleted file mode 100644 (file)
index 951700b..0000000
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
-  LzmaDecode.c
-  LZMA Decoder
-  
-  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "LzmaDecode.h"
-
-#ifndef Byte
-#define Byte unsigned char
-#endif
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-typedef struct _CRangeDecoder
-{
-  Byte *Buffer;
-  Byte *BufferLim;
-  UInt32 Range;
-  UInt32 Code;
-  #ifdef _LZMA_IN_CB
-  ILzmaInCallback *InCallback;
-  int Result;
-  #endif
-  int ExtraBytes;
-} CRangeDecoder;
-
-Byte RangeDecoderReadByte(CRangeDecoder *rd)
-{
-  if (rd->Buffer == rd->BufferLim)
-  {
-    #ifdef _LZMA_IN_CB
-    UInt32 size;
-    rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
-    rd->BufferLim = rd->Buffer + size;
-    if (size == 0)
-    #endif
-    {
-      rd->ExtraBytes = 1;
-      return 0xFF;
-    }
-  }
-  return (*rd->Buffer++);
-}
-
-/* #define ReadByte (*rd->Buffer++) */
-#define ReadByte (RangeDecoderReadByte(rd))
-
-void RangeDecoderInit(CRangeDecoder *rd,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-  #else
-    Byte *stream, UInt32 bufferSize
-  #endif
-    )
-{
-  int i;
-  #ifdef _LZMA_IN_CB
-  rd->InCallback = inCallback;
-  rd->Buffer = rd->BufferLim = 0;
-  #else
-  rd->Buffer = stream;
-  rd->BufferLim = stream + bufferSize;
-  #endif
-  rd->ExtraBytes = 0;
-  rd->Code = 0;
-  rd->Range = (0xFFFFFFFF);
-  for(i = 0; i < 5; i++)
-    rd->Code = (rd->Code << 8) | ReadByte;
-}
-
-#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;        
-#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
-#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
-
-UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
-{
-  RC_INIT_VAR
-  UInt32 result = 0;
-  int i;
-  for (i = numTotalBits; i > 0; i--)
-  {
-    /* UInt32 t; */
-    range >>= 1;
-
-    result <<= 1;
-    if (code >= range)
-    {
-      code -= range;
-      result |= 1;
-    }
-    /*
-    t = (code - range) >> 31;
-    t &= 1;
-    code -= range & (t - 1);
-    result = (result + result) | (1 - t);
-    */
-    RC_NORMALIZE
-  }
-  RC_FLUSH_VAR
-  return result;
-}
-
-int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
-{
-  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
-  if (rd->Code < bound)
-  {
-    rd->Range = bound;
-    *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
-    if (rd->Range < kTopValue)
-    {
-      rd->Code = (rd->Code << 8) | ReadByte;
-      rd->Range <<= 8;
-    }
-    return 0;
-  }
-  else
-  {
-    rd->Range -= bound;
-    rd->Code -= bound;
-    *prob -= (*prob) >> kNumMoveBits;
-    if (rd->Range < kTopValue)
-    {
-      rd->Code = (rd->Code << 8) | ReadByte;
-      rd->Range <<= 8;
-    }
-    return 1;
-  }
-}
-
-#define RC_GET_BIT2(prob, mi, A0, A1) \
-  UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
-  if (code < bound) \
-    { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
-  else \
-    { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
-  RC_NORMALIZE
-
-#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)               
-
-int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-{
-  int mi = 1;
-  int i;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  for(i = numLevels; i > 0; i--)
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + mi;
-    RC_GET_BIT(prob, mi)
-    #else
-    mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
-    #endif
-  }
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return mi - (1 << numLevels);
-}
-
-int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-{
-  int mi = 1;
-  int i;
-  int symbol = 0;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  for(i = 0; i < numLevels; i++)
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + mi;
-    RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
-    #else
-    int bit = RangeDecoderBitDecode(probs + mi, rd);
-    mi = mi + mi + bit;
-    symbol |= (bit << i);
-    #endif
-  }
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
-{ 
-  int symbol = 1;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  do
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + symbol;
-    RC_GET_BIT(prob, symbol)
-    #else
-    symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-    #endif
-  }
-  while (symbol < 0x100);
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
-{ 
-  int symbol = 1;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  do
-  {
-    int bit;
-    int matchBit = (matchByte >> 7) & 1;
-    matchByte <<= 1;
-    #ifdef _LZMA_LOC_OPT
-    {
-      CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
-      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
-    }
-    #else
-    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
-    symbol = (symbol << 1) | bit;
-    #endif
-    if (matchBit != bit)
-    {
-      while (symbol < 0x100)
-      {
-        #ifdef _LZMA_LOC_OPT
-        CProb *prob = probs + symbol;
-        RC_GET_BIT(prob, symbol)
-        #else
-        symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-        #endif
-      }
-      break;
-    }
-  }
-  while (symbol < 0x100);
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
-
-int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
-{
-  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
-    return RangeDecoderBitTreeDecode(p + LenLow +
-        (posState << kLenNumLowBits), kLenNumLowBits, rd);
-  if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
-    return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
-        (posState << kLenNumMidBits), kLenNumMidBits, rd);
-  return kLenNumLowSymbols + kLenNumMidSymbols + 
-      RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
-}
-
-#define kNumStates 12
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-#ifdef _LZMA_OUT_READ
-
-typedef struct _LzmaVarState
-{
-  CRangeDecoder RangeDecoder;
-  Byte *Dictionary;
-  UInt32 DictionarySize;
-  UInt32 DictionaryPos;
-  UInt32 GlobalPos;
-  UInt32 Reps[4];
-  int lc;
-  int lp;
-  int pb;
-  int State;
-  int PreviousIsMatch;
-  int RemainLen;
-} LzmaVarState;
-
-int LzmaDecoderInit(
-    unsigned char *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    unsigned char *dictionary, UInt32 dictionarySize,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-    #else
-    unsigned char *inStream, UInt32 inSize
-    #endif
-    )
-{
-  LzmaVarState *vs = (LzmaVarState *)buffer;
-  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-  UInt32 i;
-  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
-    return LZMA_RESULT_NOT_ENOUGH_MEM;
-  vs->Dictionary = dictionary;
-  vs->DictionarySize = dictionarySize;
-  vs->DictionaryPos = 0;
-  vs->GlobalPos = 0;
-  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
-  vs->lc = lc;
-  vs->lp = lp;
-  vs->pb = pb;
-  vs->State = 0;
-  vs->PreviousIsMatch = 0;
-  vs->RemainLen = 0;
-  dictionary[dictionarySize - 1] = 0;
-  for (i = 0; i < numProbs; i++)
-    p[i] = kBitModelTotal >> 1; 
-  RangeDecoderInit(&vs->RangeDecoder, 
-      #ifdef _LZMA_IN_CB
-      inCallback
-      #else
-      inStream, inSize
-      #endif
-  );
-  return LZMA_RESULT_OK;
-}
-
-int LzmaDecode(unsigned char *buffer, 
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed)
-{
-  LzmaVarState *vs = (LzmaVarState *)buffer;
-  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-  CRangeDecoder rd = vs->RangeDecoder;
-  int state = vs->State;
-  int previousIsMatch = vs->PreviousIsMatch;
-  Byte previousByte;
-  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
-  UInt32 nowPos = 0;
-  UInt32 posStateMask = (1 << (vs->pb)) - 1;
-  UInt32 literalPosMask = (1 << (vs->lp)) - 1;
-  int lc = vs->lc;
-  int len = vs->RemainLen;
-  UInt32 globalPos = vs->GlobalPos;
-
-  Byte *dictionary = vs->Dictionary;
-  UInt32 dictionarySize = vs->DictionarySize;
-  UInt32 dictionaryPos = vs->DictionaryPos;
-
-  if (len == -1)
-  {
-    *outSizeProcessed = 0;
-    return LZMA_RESULT_OK;
-  }
-
-  while(len > 0 && nowPos < outSize)
-  {
-    UInt32 pos = dictionaryPos - rep0;
-    if (pos >= dictionarySize)
-      pos += dictionarySize;
-    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
-    if (++dictionaryPos == dictionarySize)
-      dictionaryPos = 0;
-    len--;
-  }
-  if (dictionaryPos == 0)
-    previousByte = dictionary[dictionarySize - 1];
-  else
-    previousByte = dictionary[dictionaryPos - 1];
-#else
-
-int LzmaDecode(
-    Byte *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-    #else
-    unsigned char *inStream, UInt32 inSize,
-    #endif
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed)
-{
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-  CProb *p = (CProb *)buffer;
-  CRangeDecoder rd;
-  UInt32 i;
-  int state = 0;
-  int previousIsMatch = 0;
-  Byte previousByte = 0;
-  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
-  UInt32 nowPos = 0;
-  UInt32 posStateMask = (1 << pb) - 1;
-  UInt32 literalPosMask = (1 << lp) - 1;
-  int len = 0;
-  if (bufferSize < numProbs * sizeof(CProb))
-    return LZMA_RESULT_NOT_ENOUGH_MEM;
-  for (i = 0; i < numProbs; i++)
-    p[i] = kBitModelTotal >> 1; 
-  RangeDecoderInit(&rd, 
-      #ifdef _LZMA_IN_CB
-      inCallback
-      #else
-      inStream, inSize
-      #endif
-      );
-#endif
-
-  *outSizeProcessed = 0;
-  while(nowPos < outSize)
-  {
-    int posState = (int)(
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & posStateMask);
-    #ifdef _LZMA_IN_CB
-    if (rd.Result != LZMA_RESULT_OK)
-      return rd.Result;
-    #endif
-    if (rd.ExtraBytes != 0)
-      return LZMA_RESULT_DATA_ERROR;
-    if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
-    {
-      CProb *probs = p + Literal + (LZMA_LIT_SIZE * 
-        (((
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
-      if (state < 4) state = 0;
-      else if (state < 10) state -= 3;
-      else state -= 6;
-      if (previousIsMatch)
-      {
-        Byte matchByte;
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        matchByte = dictionary[pos];
-        #else
-        matchByte = outStream[nowPos - rep0];
-        #endif
-        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
-        previousIsMatch = 0;
-      }
-      else
-        previousByte = LzmaLiteralDecode(probs, &rd);
-      outStream[nowPos++] = previousByte;
-      #ifdef _LZMA_OUT_READ
-      dictionary[dictionaryPos] = previousByte;
-      if (++dictionaryPos == dictionarySize)
-        dictionaryPos = 0;
-      #endif
-    }
-    else             
-    {
-      previousIsMatch = 1;
-      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
-      {
-        if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
-        {
-          if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
-          {
-            #ifdef _LZMA_OUT_READ
-            UInt32 pos;
-            #endif
-            if (
-               (nowPos 
-                #ifdef _LZMA_OUT_READ
-                + globalPos
-                #endif
-               )
-               == 0)
-              return LZMA_RESULT_DATA_ERROR;
-            state = state < 7 ? 9 : 11;
-            #ifdef _LZMA_OUT_READ
-            pos = dictionaryPos - rep0;
-            if (pos >= dictionarySize)
-              pos += dictionarySize;
-            previousByte = dictionary[pos];
-            dictionary[dictionaryPos] = previousByte;
-            if (++dictionaryPos == dictionarySize)
-              dictionaryPos = 0;
-            #else
-            previousByte = outStream[nowPos - rep0];
-            #endif
-            outStream[nowPos++] = previousByte;
-            continue;
-          }
-        }
-        else
-        {
-          UInt32 distance;
-          if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
-            distance = rep1;
-          else 
-          {
-            if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
-              distance = rep2;
-            else
-            {
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
-        state = state < 7 ? 8 : 11;
-      }
-      else
-      {
-        int posSlot;
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        state = state < 7 ? 7 : 10;
-        len = LzmaLenDecode(p + LenCoder, &rd, posState);
-        posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
-            kNumPosSlotBits), kNumPosSlotBits, &rd);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-          rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
-          if (posSlot < kEndPosModelIndex)
-          {
-            rep0 += RangeDecoderReverseBitTreeDecode(
-                p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
-          }
-          else
-          {
-            rep0 += RangeDecoderDecodeDirectBits(&rd, 
-                numDirectBits - kNumAlignBits) << kNumAlignBits;
-            rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
-          }
-        }
-        else
-          rep0 = posSlot;
-        rep0++;
-      }
-      if (rep0 == (UInt32)(0))
-      {
-        /* it's for stream version */
-        len = -1;
-        break;
-      }
-      if (rep0 > nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-      {
-        return LZMA_RESULT_DATA_ERROR;
-      }
-      len += kMatchMinLen;
-      do
-      {
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        previousByte = dictionary[pos];
-        dictionary[dictionaryPos] = previousByte;
-        if (++dictionaryPos == dictionarySize)
-          dictionaryPos = 0;
-        #else
-        previousByte = outStream[nowPos - rep0];
-        #endif
-        outStream[nowPos++] = previousByte;
-        len--;
-      }
-      while(len > 0 && nowPos < outSize);
-    }
-  }
-
-  #ifdef _LZMA_OUT_READ
-  vs->RangeDecoder = rd;
-  vs->DictionaryPos = dictionaryPos;
-  vs->GlobalPos = globalPos + nowPos;
-  vs->Reps[0] = rep0;
-  vs->Reps[1] = rep1;
-  vs->Reps[2] = rep2;
-  vs->Reps[3] = rep3;
-  vs->State = state;
-  vs->PreviousIsMatch = previousIsMatch;
-  vs->RemainLen = len;
-  #endif
-
-  *outSizeProcessed = nowPos;
-  return LZMA_RESULT_OK;
-}
diff --git a/target/linux/image/ar7/src/LzmaDecode.h b/target/linux/image/ar7/src/LzmaDecode.h
deleted file mode 100644 (file)
index f58944e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/* 
-  LzmaDecode.h
-  LZMA Decoder interface
-
-  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMADECODE_H
-#define __LZMADECODE_H
-
-/* #define _LZMA_IN_CB */
-/* Use callback for input data */
-
-/* #define _LZMA_OUT_READ */
-/* Use read function for output data */
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs, 
-   but memory usage will be doubled in that case */
-
-/* #define _LZMA_LOC_OPT */
-/* Enable local speed optimizations inside code */
-
-#ifndef UInt32
-#ifdef _LZMA_UINT32_IS_ULONG
-#define UInt32 unsigned long
-#else
-#define UInt32 unsigned int
-#endif
-#endif
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb unsigned short
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-#define LZMA_RESULT_NOT_ENOUGH_MEM 2
-
-#ifdef _LZMA_IN_CB
-typedef struct _ILzmaInCallback
-{
-  int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
-} ILzmaInCallback;
-#endif
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-/* 
-bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
-bufferSize += 100 in case of _LZMA_OUT_READ
-by default CProb is unsigned short, 
-but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
-*/
-
-#ifdef _LZMA_OUT_READ
-int LzmaDecoderInit(
-    unsigned char *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    unsigned char *dictionary, UInt32 dictionarySize,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-  #else
-    unsigned char *inStream, UInt32 inSize
-  #endif
-);
-#endif
-
-int LzmaDecode(
-    unsigned char *buffer, 
-  #ifndef _LZMA_OUT_READ
-    UInt32 bufferSize,
-    int lc, int lp, int pb,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-  #else
-    unsigned char *inStream, UInt32 inSize,
-  #endif
-  #endif
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed);
-
-#endif
diff --git a/target/linux/image/ar7/src/gzip.h b/target/linux/image/ar7/src/gzip.h
deleted file mode 100644 (file)
index 917e666..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//bvb#include "timemmap.h"
-
-#define OF(args)  args
-#define STATIC static
-
-#define WSIZE 0x8000           /* Slideing window size (defined as var
-                                * "window" below) must be at least 32k, 
-                                * and a power of two.  This is the
-                                * data work window used for input buffer
-                                * by the input routine */
-
-typedef unsigned char  uch;
-typedef unsigned short ush;
-typedef unsigned long  ulg;
-
-
-static char *output_data;
-static ulg output_ptr;
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define NOMEMCPY                /* Does routine memcpy exist? */
-
-//bvb static uch *inbuf;               /* input buffer */
-static uch *window;
-
-//bvb static uch outwin[WSIZE];
-
-//bvb static unsigned insize;          /* valid bytes in inbuf */
-static unsigned inptr;         /* index of next byte to process in inbuf */
-
-static unsigned outcnt;                /* bytes in output buffer */
-
-/* gzip flag byte */
-#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
-#define COMMENT      0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
-#define RESERVED     0xC0 /* bit 6,7:   reserved */
-
-/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
-#define BMAX 16         /* maximum bit length of any code (16 for explode) */
-#define N_MAX 288       /* maximum number of codes in any set */
-
-static char *input_data;
-
-static void *freememstart;
diff --git a/target/linux/image/ar7/src/ld.script.in b/target/linux/image/ar7/src/ld.script.in
deleted file mode 100644 (file)
index 40389e6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-       OUTPUT_FORMAT("@@OUTPUT_FORMAT@@")
-       OUTPUT_ARCH(mips)
-ENTRY(tikernelunzip)
-       SECTIONS
-{
-
-       /* Allocate memory space on top of kernel bss space */
-       . = 0x94200000;
-       .text :
-       {
-               *(.text)
-               *(.rodata)
-               *(.rodata1)
-               *(.gnu.warning)
-               *(.text.init)
-               *(.data.init)
-       }                    
-
-       .data :
-       {
-               *(*)
-       }
-
-       .bss :
-       {
-               *(.dynbss)
-               *(COMMON)
-               *(.bss)
-               *(.sbss)
-               *(.scommon)
-               . = ALIGN (0x8000);
-               workspace = .;
-       }
-}
diff --git a/target/linux/image/ar7/src/loader.c b/target/linux/image/ar7/src/loader.c
deleted file mode 100644 (file)
index 22b909d..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/* inflate.c -- Not copyrighted 1992 by Mark Adler
-   version c10p1, 10 January 1993 */
-
-/*
- * Adapted for booting Linux by Hannu Savolainen 1993
- * based on gzip-1.0.3
- *
- * Nicolas Pitre <nico@visuaide.com>, 1999/04/14 :
- *   Little mods for all variable to reside either into rodata or bss segments
- *   by marking constant variables with 'const' and initializing all the others
- *   at run-time only.  This allows for the kernel uncompressor to run
- *   directly from Flash or ROM memory on embeded systems.
- */
-
-#include <linux/config.h>
-#include "gzip.h"
-#include "LzmaDecode.h"
-
-/* Function prototypes */
-unsigned char get_byte(void);
-int tikernelunzip(int,char *[], char *[]);
-static int tidecompress(uch *, uch *);
-
-void kernel_entry(int, char *[], char *[]);
-void (*ke)(int, char *[], char *[]); /* Gen reference to kernel function */
-void (*prnt)(unsigned int, char *);            /* Gen reference to Yamon print function */
-void printf(char *ptr);                        /* Generate our own printf */
-
-int tikernelunzip(int argc, char *argv[], char *arge[])
-{
-       extern unsigned int _ftext;
-       extern uch kernelimage[];
-       uch *in, *out;
-       int status;
-
-       printf("Launching kernel decompressor.\n");
-
-       out = (unsigned char *) LOADADDR;
-       in = &(kernelimage[0]);
-
-       status = tidecompress(in, out);
-
-       if (status == 0) {
-               printf("Kernel decompressor was successful ... launching kernel.\n");
-
-               ke = ( void(*)(int, char *[],char*[]))kernel_entry;
-               (*ke)(argc,argv,arge);
-
-               return (0);
-       } else {
-               printf("Error in decompression.\n");
-               return(1);
-       }
-}
-
-#if 0
-char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
-void print_i(int i)
-{
-       int j;
-       char buf[11];
-
-       buf[0] = '0';
-       buf[1] = 'x';
-       buf[10] = 0;
-       
-       for (j = 0; j < 8; j++)
-       {
-               buf[2 + 7 - j] = hex[i & 0xf];
-               i = i >> 4;
-       }
-
-       printf(buf);
-}
-#endif
-
-int tidecompress(uch *indata, uch *outdata)
-{
-       extern unsigned int workspace;
-       extern unsigned char kernelimage[], kernelimage_end[];
-       unsigned int i;  /* temp value */
-       unsigned int lc; /* literal context bits */
-       unsigned int lp; /* literal pos state bits */
-       unsigned int pb; /* pos state bits */
-       unsigned int osize; /* uncompressed size */
-       unsigned int wsize; /* window size */
-       unsigned int insize = kernelimage_end - kernelimage;
-       int status;
-       
-       output_ptr = 0;
-       output_data = outdata;
-       input_data = indata;
-
-       /* lzma args */
-       i = get_byte();
-       lc = i % 9, i = i / 9;
-       lp = i % 5, pb = i / 5;
-
-       /* skip rest of the LZMA coder property */
-       for (i = 0; i < 4; i++)
-               get_byte();
-       
-       /* read the lower half of uncompressed size in the header */
-       osize = ((unsigned int)get_byte()) +
-               ((unsigned int)get_byte() << 8) +
-               ((unsigned int)get_byte() << 16) +
-               ((unsigned int)get_byte() << 24);
-
-       /* skip rest of the header (upper half of uncompressed size) */
-       for (i = 0; i < 4; i++)
-               get_byte();
-       
-       i = 0;
-       wsize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp))) * sizeof(CProb);
-
-       if ((status = LzmaDecode((unsigned char *) &workspace, wsize, lc, lp, pb,
-               indata + 13, insize - 13, (unsigned char *) output_data, osize, &i)) == LZMA_RESULT_OK)
-                       return 0;
-
-       return status;
-}
-
-
-void printf(char *ptr)
-{
-       unsigned int *tempptr = (unsigned int  *)0x90000534;
-       prnt = ( void (*)(unsigned int, char *)) *tempptr;
-       (*prnt)(0,ptr);
-}
-
-unsigned char get_byte()
-{
-       unsigned char c;
-       
-       c = *input_data;
-       input_data++;
-
-       return c;
-}
-
diff --git a/target/linux/image/ar7/src/srec2bin.c b/target/linux/image/ar7/src/srec2bin.c
deleted file mode 100644 (file)
index 0eb8b20..0000000
+++ /dev/null
@@ -1,523 +0,0 @@
-#include <stdio.h>
-#include <ctype.h>
-
-//Rev 0.1 Original
-// 8 Jan 2001  MJH  Added code to write data to Binary file
-//                  note: outputfile is name.bin, where name is first part
-//                  of input file.  ie tmp.rec -> tmp.bin
-//
-//   srec2bin <input SREC file> <Output Binary File> <If Present, Big Endian>
-//
-//   TAG   
-//        bit32u TAG_BIG     = 0xDEADBE42;
-//        bit32u TAG_LITTLE  = 0xFEEDFA42;
-//
-//  File Structure
-//
-//  TAG    :   32 Bits
-//  [DATA RECORDS]
-//
-//  Data Records Structure
-//
-//  LENGTH  :  32 Bits    <- Length of DATA, excludes ADDRESS and CHECKSUM
-//  ADDRESS :  32 Bits
-//  DATA    :  8 Bits * LENGTH
-//  CHECKSUM:  32 Bits    <-  0 - (Sum of Length --> End of Data)
-//
-//  Note : If Length == 0, Address will be Program Start
-//
-//
-//  
-//
-//
-
-#define MajRevNum 0
-#define MinRevNum 2
-
-
-#define EndianSwitch(x) ((x >> 24) | (x << 24) | ((x << 8) & (0x00FF0000)) | ((x >> 8) & (0x0000FF00)) )
-
-typedef unsigned char bit8u;
-typedef unsigned int bit32u;
-typedef int bit32;
-
-#define FALSE 0
-#define TRUE (!FALSE)
-
-
-bit32u CheckSum;
-int RecStart;
-int debug;
-int verbose;
-
-FILE *OpenOutputFile( char *Name );
-FILE *fOut;
-bit32u RecLength=0;
-
-bit32u AddressCurrent;
-
-bit32u gh(char *cp,int nibs);
-
-int BigEndian;
-
-int inputline;
-
-// char buf[16*1024];
-
-char buffer[2048];
-char *cur_ptr;
-int cur_line=0;
-int cur_len=0;
-
-int s1s2s3_total=0;
-
-bit32u PBVal;
-int    PBValid;
-bit32u PBAdr;
-
-
-void dumpfTell(char *s, bit32u Value)
-{
-    int Length;
-    Length = (int) RecLength;
-    if (debug)
-          printf("[%s  ] ftell()[0x%08lX] Length[0x%4X] Length[%4d] Value[0x%08x]\n",
-                s, ftell(fOut), Length, Length, Value);
-}
-
-void DispHex(bit32u Hex)
-{
-//    printf("%X", Hex);
-}
-
-void WaitDisplay(void)
-{
-   static int Count=0;
-   static int Index=0;
-   char iline[]={"-\\|/"};
-
-   Count++;
-   if ((Count % 32)==0)
-   {
-     if (verbose)
-        printf("%c%c",iline[Index++],8);
-     Index &= 3;
-   }
-}
-
-
-void binOut32 ( bit32u Data )
-{
-// On UNIX machine all 32bit writes need ENDIAN switched
-//    Data = EndianSwitch(Data);
-//    fwrite( &Data, sizeof(bit32u), 1, fOut);
-
-   char sdat[4];
-   int i;
-
-   for(i=0;i<4;i++)
-    sdat[i]=(char)(Data>>(i*8));
-   fwrite( sdat, 1, 4, fOut);
-   dumpfTell("Out32" , Data);
-}
-
-// Only update RecLength on Byte Writes
-// All 32 bit writes will be for Length etc
-
-void binOut8 ( bit8u Data )
-{
-    int n;
-    dumpfTell("B4Data" , (bit32u) (Data & 0xFF) );
-    n = fwrite( &Data, sizeof(bit8u), 1, fOut);
-    if (n != 1)
-        printf("Error in writing %X for Address 0x%8X\n", Data, AddressCurrent);
-    RecLength += 1;
-}
-
-//  Currently ONLY used for outputting Program Start
-
-void binRecStart(bit32u Address)
-{
-    RecLength      = 0;
-    CheckSum       = Address;
-    RecStart       = TRUE;
-
-    if (debug)
-          printf("[RecStart] CheckSum[0x%08X] Length[%4d] Address[0x%08X]\n",
-                CheckSum, RecLength, Address);
-
-
-    dumpfTell("RecLength", RecLength);
-    binOut32( RecLength );
-    dumpfTell("Address", Address);
-    binOut32( Address );
-}
-
-void binRecEnd(void)
-{
-    long RecEnd;
-
-    if (!RecStart)   //  if no record started, do not end it
-    {
-        return;
-    }
-
-    RecStart = FALSE;
-
-
-    RecEnd = ftell(fOut);         // Save Current position
-
-    if (debug)
-          printf("[RecEnd  ] CheckSum[0x%08X] Length[%4d] Length[0x%X] RecEnd[0x%08lX]\n",
-                CheckSum, RecLength, RecLength, RecEnd);
-
-    fseek( fOut, -((long) RecLength), SEEK_CUR);  // move back Start Of Data
-
-    dumpfTell("Data   ", -1);
-
-    fseek( fOut, -4, SEEK_CUR);  // move back Start Of Address
-
-    dumpfTell("Address   ", -1);
-
-    fseek( fOut, -4, SEEK_CUR);  // move back Start Of Length
-
-    dumpfTell("Length   ", -1);
-
-    binOut32( RecLength );
-
-    fseek( fOut, RecEnd, SEEK_SET);  // move to end of Record
-
-    CheckSum += RecLength;
-
-    CheckSum =  ~CheckSum + 1;  // Two's complement
-
-    binOut32( CheckSum );
-
-    if (verbose)
-        printf("[Created Record of %d Bytes with CheckSum [0x%8X]\n", RecLength, CheckSum);
-}
-
-void binRecOutProgramStart(bit32u Address)
-{
-    if (Address != (AddressCurrent+1))
-    {
-        binRecEnd();
-        binRecStart(Address);
-    }
-    AddressCurrent = Address;
-}
-void binRecOutByte(bit32u Address, bit8u Data)
-{
-    //  If Address is one after Current Address, output Byte
-    //  If not, close out last record, update Length, write checksum
-    //  Then Start New Record, updating Current Address
-
-    if (Address != (AddressCurrent+1))
-    {
-        binRecEnd();
-        binRecStart(Address);
-    }
-    AddressCurrent = Address;
-    CheckSum += Data;
-    binOut8( Data );
-}
-
-//=============================================================================
-//       SUPPORT FUNCTIONS
-//=============================================================================
-int readline(FILE *fil,char *buf,int len)
-{
-    int rlen;
-    
-    rlen=0;
-    if (len==0)  return(0);
-    while(1)
-    {
-      if (cur_len==0)
-      {
-        cur_len=fread(buffer, 1, sizeof(buffer), fil);
-        if (cur_len==0)
-        {
-          if (rlen)
-          {
-            *buf=0;
-            return(rlen);
-          }
-          return(-1);
-        }
-        cur_ptr=buffer;
-      }
-      if (cur_len)
-      {
-        if (*cur_ptr=='\n')
-        {
-          *buf=0;
-          cur_ptr++;
-          cur_len--;
-          return(rlen);
-        }
-         else
-         {
-           if ((len>1)&&(*cur_ptr!='\r'))
-           {
-             *buf++=*cur_ptr++;
-             len--;
-           }
-           else
-             cur_ptr++;
-
-           rlen++;
-           cur_len--;
-         }
-      }
-      else
-      {
-        *buf=0;
-        cur_ptr++;
-        cur_len--;
-        return(rlen);
-      }
-    }
-}
-
-
-int SRLerrorout(char *c1,char *c2)
-{
-  printf("\nERROR: %s - '%s'.",c1,c2);
-  return(FALSE);
-}
-
-
-int checksum(char *cp,int count)
-{
-  char *scp;
-  int cksum;
-  int dum;
-
-  scp=cp;
-  while(*scp)
-  {
-    if (!isxdigit(*scp++))
-      return(SRLerrorout("Invalid hex digits",cp));
-  }
-  scp=cp;
-
-  cksum=count;
-
-  while(count)
-  {
-    cksum += gh(scp,2);
-    if (count == 2)
-        dum = ~cksum;
-    scp += 2;
-    count--;
-  }
-  cksum&=0x0ff; 
-  //  printf("\nCk:%02x",cksum);
-  return(cksum==0x0ff);
-}
-
-bit32u gh(char *cp,int nibs)
-{
-  int i;
-  bit32u j;
-
-  j=0;
-
-  for(i=0;i<nibs;i++)
-  {
-    j<<=4;
-    if ((*cp>='a')&&(*cp<='z')) *cp &= 0x5f;
-    if ((*cp>='0')&&(*cp<='9')) 
-      j += (*cp-0x30);
-     else
-      if ((*cp>='A')&&(*cp<='F'))
-        j += (*cp-0x37);
-       else
-        SRLerrorout("Bad Hex char", cp);
-    cp++;
-  }
-  return(j);
-}
-
-
-//=============================================================================
-//       PROCESS SREC LINE
-//=============================================================================
-
-int srecLine(char *pSrecLine)
-{
-    char *scp,ch;
-    int  itmp,count,dat;
-    bit32u adr;
-    static bit32u RecordCounter=0;
-
-    cur_line++;
-    scp=pSrecLine;
-  
-    if (*pSrecLine!='S')
-      return(SRLerrorout("Not an Srecord file",scp));
-    pSrecLine++;
-    if (strlen(pSrecLine)<4)
-      return(SRLerrorout("Srecord too short",scp));
-  
-    ch=*pSrecLine++;
-  
-    count=gh(pSrecLine,2);
-  
-    pSrecLine += 2;
-  
-  //  if(debug)
-  //        printf("count %d, strlen(pSrecLine) = %d, pSrecLine =[%s]\n", count, strlen(pSrecLine), pSrecLine);
-     RecordCounter++;
-     DispHex(RecordCounter);
-  
-    if ((count*2) != strlen(pSrecLine)) return(SRLerrorout("Count field larger than record",scp));
-  
-    if (!checksum(pSrecLine, count)) return(SRLerrorout("Bad Checksum",scp));
-  
-    switch(ch)
-    {
-        case '0': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
-                  itmp=gh(pSrecLine,4); pSrecLine+=4; count-=2;
-                  if (itmp) return(SRLerrorout("Srecord 1 address not zero",scp));
-        break;
-        case '1': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
-                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
-        break;
-        case '2': if (count<4) return(SRLerrorout("Invalid Srecord count field",scp));
-                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
-        break;
-        case '3': if (count<5) return(SRLerrorout("Invalid Srecord count field",scp));
-                  adr=gh(pSrecLine,8); pSrecLine+=8; count-=4;
-                  count--;
-                  while(count)
-                  {
-                    dat=gh(pSrecLine,2); pSrecLine+=2; count--;
-                    binRecOutByte(adr, (char) (dat & 0xFF));
-                    adr++;
-                  }
-                  s1s2s3_total++;
-        break;
-        case '4': return(SRLerrorout("Invalid Srecord type",scp));
-        break;
-        case '5': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
-                  itmp=gh(pSrecLine,4); pSrecLine+=4; count-=2;
-                  if (itmp|=s1s2s3_total) return(SRLerrorout("Incorrect number of S3 Record processed",scp));
-        break;
-        case '6': return(SRLerrorout("Invalid Srecord type",scp));
-        break;
-        case '7': // PROGRAM START
-                  if (count<5) return(SRLerrorout("Invalid Srecord count field",scp));
-                  adr=gh(pSrecLine,8); pSrecLine+=8; count-=4;
-                  if (count!=1) return(SRLerrorout("Invalid Srecord count field",scp));
-                  binRecOutProgramStart(adr);
-        break;
-        case '8': if (count<4) return(SRLerrorout("Invalid Srecord count field",scp));
-                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
-        break;
-        case '9': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
-                  return(SRLerrorout("Srecord Not valid for MIPS",scp));
-        break;
-        default:
-        break;
-    }
-    return(TRUE);
-}
-
-//=============================================================================
-//       MAIN LOGIC, READS IN LINE AND OUTPUTS BINARY
-//=============================================================================
-
-int srec2bin(int argc,char *argv[],int verbose)
-{
-    int i,rlen,sts;
-    FILE *fp;
-    char ac;
-    char buff[256];
-    bit32u TAG_BIG     = 0xDEADBE42;
-    bit32u TAG_LITTLE  = 0xFEEDFA42;
-
-    bit32u Tag;
-
-  
-    if(argc < 3)
-    {
-      printf("\nError: <srec2bin <srec input file> <bin output file>\n\n");
-      return(0);
-    }
-  
-    if (argc > 3) BigEndian=TRUE; else BigEndian=FALSE;
-
-    if (BigEndian)
-        Tag = TAG_BIG;
-    else
-        Tag = TAG_LITTLE;
-
-    if (verbose)
-       printf("\nEndian: %s, Tag is 0x%8X\n",(BigEndian)?"BIG":"LITTLE", Tag);
-
-    fp = fopen(argv[1],"rt");
-
-    if (fp==NULL)
-    {
-      printf("\nError: Opening input file, %s.", argv[1]);
-      return(0);
-    }
-  
-    fOut = fopen( argv[2], "wb");
-    
-    if (fOut==NULL)
-    {
-      printf("\nError: Opening Output file, %s.", argv[2]);
-      if(fp) fclose(fp);
-      return(0);
-    }
-    RecStart = FALSE;
-
-    AddressCurrent = 0xFFFFFFFFL;
-
-    // Setup Tag 
-  
-    dumpfTell("Tag", Tag);
-
-    binOut32(Tag);
-
-  
-    inputline=0;
-    sts=TRUE;
-
-    rlen = readline(fp,buff,sizeof buff);
-
-    while( (sts) && (rlen != -1))
-    {
-        if (strlen(buff))
-        {
-            sts &= srecLine(buff);
-            WaitDisplay();
-        }
-       rlen = readline(fp,buff,sizeof buff);
-    }
-
-  
-  //  printf("PC: 0x%08X, Length 0x%08X, Tag 0x%08X\n", ProgramStart, RecLength, TAG_LITTLE);
-  
-    binRecEnd();
-
-    if(fp) fclose(fp);
-    if(fOut) fclose(fOut);
-
-    return(1);
-}
-
-main(int argc, char *argv[])
-{
-    debug = TRUE;
-    debug = FALSE;
-    verbose = FALSE;
-    srec2bin(argc,argv,verbose);
-    return 0;
-}
-
diff --git a/target/linux/image/ar7/src/zimage.script.in b/target/linux/image/ar7/src/zimage.script.in
deleted file mode 100644 (file)
index 1a0865b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-       OUTPUT_FORMAT("@@OUTPUT_FORMAT@@")
-OUTPUT_ARCH(mips)
-       SECTIONS
-{
-       .data :
-       {
-               kernelimage = .;
-               *(.data)
-               kernelimage_end = .;
-       }
-}
diff --git a/target/linux/image/aruba/Makefile b/target/linux/image/aruba/Makefile
deleted file mode 100644 (file)
index ad13ffd..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-LOADADDR = 0x81000000          # RAM start + 16M 
-KERNEL_ENTRY = 0x80100000
-RAMSIZE = 0x00100000           # 1MB
-
-LOADER_MAKEOPTS= \
-               KDIR=$(KDIR) \
-               LOADADDR=$(LOADADDR) \
-               KERNEL_ENTRY=$(KERNEL_ENTRY) \
-               RAMSIZE=$(RAMSIZE)
-
-define Build/Clean
-       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
-endef
-
-define Image/Prepare
-       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
-       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
-endef
-
-define Image/BuildKernel
-       ./addVersion -n ArubaOS $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari version
-endef
-
-define Image/Build/jffs2-64k
-       @dd if=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari of=$(KDIR)/image.tmp bs=655360 conv=sync
-       @cat $(KDIR)/root.$(1) >> $(KDIR)/image.tmp
-       @dd if=$(KDIR)/image.tmp of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(patsubst jffs2-%,jffs2,$(1)).bin bs=3604480 conv=sync
-       @rm -f $(KDIR)/image.tmp
-endef
-
-define Image/Build
-       $(call Image/Build/$(1),$(1))
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/aruba/addVersion b/target/linux/image/aruba/addVersion
deleted file mode 100755 (executable)
index 796f73a..0000000
Binary files a/target/linux/image/aruba/addVersion and /dev/null differ
diff --git a/target/linux/image/aruba/version b/target/linux/image/aruba/version
deleted file mode 100644 (file)
index fff5589..0000000
+++ /dev/null
@@ -1 +0,0 @@
-3.0.0.0
diff --git a/target/linux/image/au1000/Makefile b/target/linux/image/au1000/Makefile
deleted file mode 100644 (file)
index 3aaf665..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-LOADADDR = 0x8108c8f4          # RAM start + 16M 
-KERNEL_ENTRY = 0x80100000      # Default kernel entry in arch/mips/Makefile
-RAMSIZE = 0x04000000           # 64MB
-
-LOADER_MAKEOPTS= \
-               KDIR=$(KDIR) \
-               LOADADDR=$(LOADADDR) \
-               KERNEL_ENTRY=$(KERNEL_ENTRY) \
-               RAMSIZE=$(RAMSIZE)
-
-define Build/Clean
-       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
-endef
-
-define Image/Prepare
-       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
-       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile
-endef
-
-define Image/Build
-       $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(1) $(KDIR)/root.srec
-       grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
-       grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/brcm/Makefile b/target/linux/image/brcm/Makefile
deleted file mode 100644 (file)
index 30bad50..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Build/Compile
-       rm -f $(KDIR)/loader.gz
-       $(MAKE) -C lzma-loader \
-               BUILD_DIR="$(KDIR)" \
-               TARGET="$(KDIR)" \
-               install
-       echo -ne "\\x00" >> $(KDIR)/loader.gz
-endef
-
-define Build/Clean
-       $(MAKE) -C lzma-loader clean
-endef
-
-define Image/Prepare
-       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
-endef
-
-define Image/Build/wgt634u
-       dd if=$(KDIR)/loader.elf of=$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(2).bin bs=131072 conv=sync
-       cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx >> $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(2).bin
-endef
-
-define Image/Build/CyberTAN
-       $(STAGING_DIR)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(5).bin
-endef
-
-define Image/Build/Motorola
-       $(STAGING_DIR)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
-endef
-
-define trxalign/jffs2-128k
--a 0x20000
-endef
-define trxalign/jffs2-64k
--a 0x10000
-endef
-define trxalign/squashfs
--a 1024
-endef
-
-define Image/Build
-       $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(KDIR)/loader.gz $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) $(KDIR)/root.$(1)
-ifneq ($(1),jffs2-128k)
-       $(call Image/Build/CyberTAN,$(1),wrt54g3g,W54F,1.99.5,$(patsubst jffs2-%,jffs2,$(1)))
-       $(call Image/Build/CyberTAN,$(1),wrt54g,W54G,4.40.1,$(patsubst jffs2-%,jffs2,$(1)))
-       $(call Image/Build/CyberTAN,$(1),wrt54gs_v4,W54s,1.09.1,$(patsubst jffs2-%,jffs2,$(1)))
-       $(call Image/Build/Motorola,$(1),wa840g,2,$(patsubst jffs2-%,jffs2,$(1)))
-       $(call Image/Build/Motorola,$(1),we800g,3,$(patsubst jffs2-%,jffs2,$(1)))
-endif
-ifneq ($(1),jffs2-64k)
-       $(call Image/Build/CyberTAN,$(1),wrt54gs,W54S,4.80.1,$(patsubst jffs2-%,jffs2,$(1)))
-       $(call Image/Build/CyberTAN,$(1),wrtsl54gs,W54U,2.00.5,$(patsubst jffs2-%,jffs2,$(1)))
-       $(call Image/Build/wgt634u,$(1),$(patsubst jffs2-%,jffs2,$(1)))
-endif
-       $(call Image/Build/Motorola,$(1),wr850g,1,$(1))
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/brcm/lzma-loader/Makefile b/target/linux/image/brcm/lzma-loader/Makefile
deleted file mode 100644 (file)
index 3fa00fa..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# $Id$
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME := lzma-loader
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-
-$(PKG_BUILD_DIR)/.prepared:
-       mkdir $(PKG_BUILD_DIR)
-       $(CP) ./src/* $(PKG_BUILD_DIR)/
-       touch $@
-
-$(PKG_BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/.prepared
-       $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \
-               LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS)
-
-source: 
-prepare: $(PKG_BUILD_DIR)/.prepared
-compile: $(PKG_BUILD_DIR)/loader.gz
-install:
-
-ifneq ($(TARGET),)
-install: compile
-       $(CP) $(PKG_BUILD_DIR)/loader.gz $(PKG_BUILD_DIR)/loader.elf $(TARGET)/
-endif
-
-clean:
-       rm -rf $(PKG_BUILD_DIR)
diff --git a/target/linux/image/brcm/lzma-loader/src/LzmaDecode.c b/target/linux/image/brcm/lzma-loader/src/LzmaDecode.c
deleted file mode 100644 (file)
index 951700b..0000000
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
-  LzmaDecode.c
-  LZMA Decoder
-  
-  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "LzmaDecode.h"
-
-#ifndef Byte
-#define Byte unsigned char
-#endif
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-typedef struct _CRangeDecoder
-{
-  Byte *Buffer;
-  Byte *BufferLim;
-  UInt32 Range;
-  UInt32 Code;
-  #ifdef _LZMA_IN_CB
-  ILzmaInCallback *InCallback;
-  int Result;
-  #endif
-  int ExtraBytes;
-} CRangeDecoder;
-
-Byte RangeDecoderReadByte(CRangeDecoder *rd)
-{
-  if (rd->Buffer == rd->BufferLim)
-  {
-    #ifdef _LZMA_IN_CB
-    UInt32 size;
-    rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
-    rd->BufferLim = rd->Buffer + size;
-    if (size == 0)
-    #endif
-    {
-      rd->ExtraBytes = 1;
-      return 0xFF;
-    }
-  }
-  return (*rd->Buffer++);
-}
-
-/* #define ReadByte (*rd->Buffer++) */
-#define ReadByte (RangeDecoderReadByte(rd))
-
-void RangeDecoderInit(CRangeDecoder *rd,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-  #else
-    Byte *stream, UInt32 bufferSize
-  #endif
-    )
-{
-  int i;
-  #ifdef _LZMA_IN_CB
-  rd->InCallback = inCallback;
-  rd->Buffer = rd->BufferLim = 0;
-  #else
-  rd->Buffer = stream;
-  rd->BufferLim = stream + bufferSize;
-  #endif
-  rd->ExtraBytes = 0;
-  rd->Code = 0;
-  rd->Range = (0xFFFFFFFF);
-  for(i = 0; i < 5; i++)
-    rd->Code = (rd->Code << 8) | ReadByte;
-}
-
-#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;        
-#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
-#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
-
-UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
-{
-  RC_INIT_VAR
-  UInt32 result = 0;
-  int i;
-  for (i = numTotalBits; i > 0; i--)
-  {
-    /* UInt32 t; */
-    range >>= 1;
-
-    result <<= 1;
-    if (code >= range)
-    {
-      code -= range;
-      result |= 1;
-    }
-    /*
-    t = (code - range) >> 31;
-    t &= 1;
-    code -= range & (t - 1);
-    result = (result + result) | (1 - t);
-    */
-    RC_NORMALIZE
-  }
-  RC_FLUSH_VAR
-  return result;
-}
-
-int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
-{
-  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
-  if (rd->Code < bound)
-  {
-    rd->Range = bound;
-    *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
-    if (rd->Range < kTopValue)
-    {
-      rd->Code = (rd->Code << 8) | ReadByte;
-      rd->Range <<= 8;
-    }
-    return 0;
-  }
-  else
-  {
-    rd->Range -= bound;
-    rd->Code -= bound;
-    *prob -= (*prob) >> kNumMoveBits;
-    if (rd->Range < kTopValue)
-    {
-      rd->Code = (rd->Code << 8) | ReadByte;
-      rd->Range <<= 8;
-    }
-    return 1;
-  }
-}
-
-#define RC_GET_BIT2(prob, mi, A0, A1) \
-  UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
-  if (code < bound) \
-    { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
-  else \
-    { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
-  RC_NORMALIZE
-
-#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)               
-
-int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-{
-  int mi = 1;
-  int i;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  for(i = numLevels; i > 0; i--)
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + mi;
-    RC_GET_BIT(prob, mi)
-    #else
-    mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
-    #endif
-  }
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return mi - (1 << numLevels);
-}
-
-int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-{
-  int mi = 1;
-  int i;
-  int symbol = 0;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  for(i = 0; i < numLevels; i++)
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + mi;
-    RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
-    #else
-    int bit = RangeDecoderBitDecode(probs + mi, rd);
-    mi = mi + mi + bit;
-    symbol |= (bit << i);
-    #endif
-  }
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
-{ 
-  int symbol = 1;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  do
-  {
-    #ifdef _LZMA_LOC_OPT
-    CProb *prob = probs + symbol;
-    RC_GET_BIT(prob, symbol)
-    #else
-    symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-    #endif
-  }
-  while (symbol < 0x100);
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
-{ 
-  int symbol = 1;
-  #ifdef _LZMA_LOC_OPT
-  RC_INIT_VAR
-  #endif
-  do
-  {
-    int bit;
-    int matchBit = (matchByte >> 7) & 1;
-    matchByte <<= 1;
-    #ifdef _LZMA_LOC_OPT
-    {
-      CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
-      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
-    }
-    #else
-    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
-    symbol = (symbol << 1) | bit;
-    #endif
-    if (matchBit != bit)
-    {
-      while (symbol < 0x100)
-      {
-        #ifdef _LZMA_LOC_OPT
-        CProb *prob = probs + symbol;
-        RC_GET_BIT(prob, symbol)
-        #else
-        symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-        #endif
-      }
-      break;
-    }
-  }
-  while (symbol < 0x100);
-  #ifdef _LZMA_LOC_OPT
-  RC_FLUSH_VAR
-  #endif
-  return symbol;
-}
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
-
-int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
-{
-  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
-    return RangeDecoderBitTreeDecode(p + LenLow +
-        (posState << kLenNumLowBits), kLenNumLowBits, rd);
-  if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
-    return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
-        (posState << kLenNumMidBits), kLenNumMidBits, rd);
-  return kLenNumLowSymbols + kLenNumMidSymbols + 
-      RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
-}
-
-#define kNumStates 12
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-#ifdef _LZMA_OUT_READ
-
-typedef struct _LzmaVarState
-{
-  CRangeDecoder RangeDecoder;
-  Byte *Dictionary;
-  UInt32 DictionarySize;
-  UInt32 DictionaryPos;
-  UInt32 GlobalPos;
-  UInt32 Reps[4];
-  int lc;
-  int lp;
-  int pb;
-  int State;
-  int PreviousIsMatch;
-  int RemainLen;
-} LzmaVarState;
-
-int LzmaDecoderInit(
-    unsigned char *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    unsigned char *dictionary, UInt32 dictionarySize,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-    #else
-    unsigned char *inStream, UInt32 inSize
-    #endif
-    )
-{
-  LzmaVarState *vs = (LzmaVarState *)buffer;
-  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-  UInt32 i;
-  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
-    return LZMA_RESULT_NOT_ENOUGH_MEM;
-  vs->Dictionary = dictionary;
-  vs->DictionarySize = dictionarySize;
-  vs->DictionaryPos = 0;
-  vs->GlobalPos = 0;
-  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
-  vs->lc = lc;
-  vs->lp = lp;
-  vs->pb = pb;
-  vs->State = 0;
-  vs->PreviousIsMatch = 0;
-  vs->RemainLen = 0;
-  dictionary[dictionarySize - 1] = 0;
-  for (i = 0; i < numProbs; i++)
-    p[i] = kBitModelTotal >> 1; 
-  RangeDecoderInit(&vs->RangeDecoder, 
-      #ifdef _LZMA_IN_CB
-      inCallback
-      #else
-      inStream, inSize
-      #endif
-  );
-  return LZMA_RESULT_OK;
-}
-
-int LzmaDecode(unsigned char *buffer, 
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed)
-{
-  LzmaVarState *vs = (LzmaVarState *)buffer;
-  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-  CRangeDecoder rd = vs->RangeDecoder;
-  int state = vs->State;
-  int previousIsMatch = vs->PreviousIsMatch;
-  Byte previousByte;
-  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
-  UInt32 nowPos = 0;
-  UInt32 posStateMask = (1 << (vs->pb)) - 1;
-  UInt32 literalPosMask = (1 << (vs->lp)) - 1;
-  int lc = vs->lc;
-  int len = vs->RemainLen;
-  UInt32 globalPos = vs->GlobalPos;
-
-  Byte *dictionary = vs->Dictionary;
-  UInt32 dictionarySize = vs->DictionarySize;
-  UInt32 dictionaryPos = vs->DictionaryPos;
-
-  if (len == -1)
-  {
-    *outSizeProcessed = 0;
-    return LZMA_RESULT_OK;
-  }
-
-  while(len > 0 && nowPos < outSize)
-  {
-    UInt32 pos = dictionaryPos - rep0;
-    if (pos >= dictionarySize)
-      pos += dictionarySize;
-    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
-    if (++dictionaryPos == dictionarySize)
-      dictionaryPos = 0;
-    len--;
-  }
-  if (dictionaryPos == 0)
-    previousByte = dictionary[dictionarySize - 1];
-  else
-    previousByte = dictionary[dictionaryPos - 1];
-#else
-
-int LzmaDecode(
-    Byte *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-    #else
-    unsigned char *inStream, UInt32 inSize,
-    #endif
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed)
-{
-  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-  CProb *p = (CProb *)buffer;
-  CRangeDecoder rd;
-  UInt32 i;
-  int state = 0;
-  int previousIsMatch = 0;
-  Byte previousByte = 0;
-  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
-  UInt32 nowPos = 0;
-  UInt32 posStateMask = (1 << pb) - 1;
-  UInt32 literalPosMask = (1 << lp) - 1;
-  int len = 0;
-  if (bufferSize < numProbs * sizeof(CProb))
-    return LZMA_RESULT_NOT_ENOUGH_MEM;
-  for (i = 0; i < numProbs; i++)
-    p[i] = kBitModelTotal >> 1; 
-  RangeDecoderInit(&rd, 
-      #ifdef _LZMA_IN_CB
-      inCallback
-      #else
-      inStream, inSize
-      #endif
-      );
-#endif
-
-  *outSizeProcessed = 0;
-  while(nowPos < outSize)
-  {
-    int posState = (int)(
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & posStateMask);
-    #ifdef _LZMA_IN_CB
-    if (rd.Result != LZMA_RESULT_OK)
-      return rd.Result;
-    #endif
-    if (rd.ExtraBytes != 0)
-      return LZMA_RESULT_DATA_ERROR;
-    if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
-    {
-      CProb *probs = p + Literal + (LZMA_LIT_SIZE * 
-        (((
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
-      if (state < 4) state = 0;
-      else if (state < 10) state -= 3;
-      else state -= 6;
-      if (previousIsMatch)
-      {
-        Byte matchByte;
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        matchByte = dictionary[pos];
-        #else
-        matchByte = outStream[nowPos - rep0];
-        #endif
-        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
-        previousIsMatch = 0;
-      }
-      else
-        previousByte = LzmaLiteralDecode(probs, &rd);
-      outStream[nowPos++] = previousByte;
-      #ifdef _LZMA_OUT_READ
-      dictionary[dictionaryPos] = previousByte;
-      if (++dictionaryPos == dictionarySize)
-        dictionaryPos = 0;
-      #endif
-    }
-    else             
-    {
-      previousIsMatch = 1;
-      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
-      {
-        if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
-        {
-          if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
-          {
-            #ifdef _LZMA_OUT_READ
-            UInt32 pos;
-            #endif
-            if (
-               (nowPos 
-                #ifdef _LZMA_OUT_READ
-                + globalPos
-                #endif
-               )
-               == 0)
-              return LZMA_RESULT_DATA_ERROR;
-            state = state < 7 ? 9 : 11;
-            #ifdef _LZMA_OUT_READ
-            pos = dictionaryPos - rep0;
-            if (pos >= dictionarySize)
-              pos += dictionarySize;
-            previousByte = dictionary[pos];
-            dictionary[dictionaryPos] = previousByte;
-            if (++dictionaryPos == dictionarySize)
-              dictionaryPos = 0;
-            #else
-            previousByte = outStream[nowPos - rep0];
-            #endif
-            outStream[nowPos++] = previousByte;
-            continue;
-          }
-        }
-        else
-        {
-          UInt32 distance;
-          if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
-            distance = rep1;
-          else 
-          {
-            if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
-              distance = rep2;
-            else
-            {
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
-        state = state < 7 ? 8 : 11;
-      }
-      else
-      {
-        int posSlot;
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        state = state < 7 ? 7 : 10;
-        len = LzmaLenDecode(p + LenCoder, &rd, posState);
-        posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
-            kNumPosSlotBits), kNumPosSlotBits, &rd);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-          rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
-          if (posSlot < kEndPosModelIndex)
-          {
-            rep0 += RangeDecoderReverseBitTreeDecode(
-                p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
-          }
-          else
-          {
-            rep0 += RangeDecoderDecodeDirectBits(&rd, 
-                numDirectBits - kNumAlignBits) << kNumAlignBits;
-            rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
-          }
-        }
-        else
-          rep0 = posSlot;
-        rep0++;
-      }
-      if (rep0 == (UInt32)(0))
-      {
-        /* it's for stream version */
-        len = -1;
-        break;
-      }
-      if (rep0 > nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-      {
-        return LZMA_RESULT_DATA_ERROR;
-      }
-      len += kMatchMinLen;
-      do
-      {
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        previousByte = dictionary[pos];
-        dictionary[dictionaryPos] = previousByte;
-        if (++dictionaryPos == dictionarySize)
-          dictionaryPos = 0;
-        #else
-        previousByte = outStream[nowPos - rep0];
-        #endif
-        outStream[nowPos++] = previousByte;
-        len--;
-      }
-      while(len > 0 && nowPos < outSize);
-    }
-  }
-
-  #ifdef _LZMA_OUT_READ
-  vs->RangeDecoder = rd;
-  vs->DictionaryPos = dictionaryPos;
-  vs->GlobalPos = globalPos + nowPos;
-  vs->Reps[0] = rep0;
-  vs->Reps[1] = rep1;
-  vs->Reps[2] = rep2;
-  vs->Reps[3] = rep3;
-  vs->State = state;
-  vs->PreviousIsMatch = previousIsMatch;
-  vs->RemainLen = len;
-  #endif
-
-  *outSizeProcessed = nowPos;
-  return LZMA_RESULT_OK;
-}
diff --git a/target/linux/image/brcm/lzma-loader/src/LzmaDecode.h b/target/linux/image/brcm/lzma-loader/src/LzmaDecode.h
deleted file mode 100644 (file)
index f58944e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/* 
-  LzmaDecode.h
-  LZMA Decoder interface
-
-  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMADECODE_H
-#define __LZMADECODE_H
-
-/* #define _LZMA_IN_CB */
-/* Use callback for input data */
-
-/* #define _LZMA_OUT_READ */
-/* Use read function for output data */
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs, 
-   but memory usage will be doubled in that case */
-
-/* #define _LZMA_LOC_OPT */
-/* Enable local speed optimizations inside code */
-
-#ifndef UInt32
-#ifdef _LZMA_UINT32_IS_ULONG
-#define UInt32 unsigned long
-#else
-#define UInt32 unsigned int
-#endif
-#endif
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb unsigned short
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-#define LZMA_RESULT_NOT_ENOUGH_MEM 2
-
-#ifdef _LZMA_IN_CB
-typedef struct _ILzmaInCallback
-{
-  int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
-} ILzmaInCallback;
-#endif
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-/* 
-bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
-bufferSize += 100 in case of _LZMA_OUT_READ
-by default CProb is unsigned short, 
-but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
-*/
-
-#ifdef _LZMA_OUT_READ
-int LzmaDecoderInit(
-    unsigned char *buffer, UInt32 bufferSize,
-    int lc, int lp, int pb,
-    unsigned char *dictionary, UInt32 dictionarySize,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback
-  #else
-    unsigned char *inStream, UInt32 inSize
-  #endif
-);
-#endif
-
-int LzmaDecode(
-    unsigned char *buffer, 
-  #ifndef _LZMA_OUT_READ
-    UInt32 bufferSize,
-    int lc, int lp, int pb,
-  #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-  #else
-    unsigned char *inStream, UInt32 inSize,
-  #endif
-  #endif
-    unsigned char *outStream, UInt32 outSize,
-    UInt32 *outSizeProcessed);
-
-#endif
diff --git a/target/linux/image/brcm/lzma-loader/src/Makefile b/target/linux/image/brcm/lzma-loader/src/Makefile
deleted file mode 100644 (file)
index 85a8646..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Makefile for Broadcom BCM947XX boards
-#
-# Copyright 2001-2003, Broadcom Corporation
-# All Rights Reserved.
-# 
-# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
-# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
-# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
-# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
-#
-# Copyright 2004  Manuel Novoa III <mjn3@codepoet.org>
-#   Modified to support bzip'd kernels.
-#   Of course, it would be better to integrate bunzip capability into CFE.
-#
-# Copyright 2005  Oleg I. Vdovikin <oleg@cs.msu.su>
-#   Cleaned up, modified for lzma support, removed from kernel
-#
-
-TEXT_START     := 0x80001000
-BZ_TEXT_START  := 0x80300000
-
-OBJCOPY                := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
-
-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 -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)
-
-SEDFLAGS       := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
-
-OBJECTS                := head.o data.o
-
-all: loader.gz loader.elf
-
-# Don't build dependencies, this may die if $(CC) isn't gcc
-dep:
-
-install:
-
-loader.gz: loader
-       gzip -nc9 $< > $@
-
-loader.elf: loader.o
-       cp $< $@
-
-loader: loader.o
-       $(OBJCOPY) $< $@
-
-loader.o: loader.lds $(OBJECTS)
-       $(LD) -static --gc-sections -no-warn-mismatch -T loader.lds -o $@ $(OBJECTS)
-
-loader.lds: loader.lds.in Makefile
-       @sed "$(SEDFLAGS)" < $< > $@
-
-data.o: data.lds decompress.image
-       $(LD) -no-warn-mismatch -T data.lds -r -o $@ -b binary decompress.image -b elf32-tradlittlemips
-
-data.lds:
-       @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > $@
-
-decompress.image: decompress
-       $(OBJCOPY) $< $@
-
-decompress: decompress.lds decompress.o LzmaDecode.o
-       $(LD) -static --gc-sections -no-warn-mismatch -T decompress.lds -o $@ decompress.o LzmaDecode.o
-
-decompress.lds: decompress.lds.in Makefile
-       @sed "$(SEDFLAGS)" < $< > $@
-
-mrproper: clean
-
-clean:
-       rm -f loader.gz loader decompress *.lds *.o *.image
diff --git a/target/linux/image/brcm/lzma-loader/src/README b/target/linux/image/brcm/lzma-loader/src/README
deleted file mode 100644 (file)
index 16649e9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * LZMA compressed kernel decompressor for bcm947xx boards
- *
- * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-The code is intended to decompress kernel, being compressed using lzma utility
-build using 7zip LZMA SDK. This utility is located in the LZMA_Alone directory
-
-decompressor code expects that your .trx file consist of three partitions: 
-
-1) decompressor itself (this is gziped code which pmon/cfe will extract and run
-on boot-up instead of real kernel)
-2) LZMA compressed kernel (both streamed and regular modes are supported now)
-3) Root filesystem
-
-Please be sure to apply the following patch for use this new trx layout (it will
-allow using both new and old trx files for root filesystem lookup code)
-
---- linuz/arch/mips/brcm-boards/bcm947xx/setup.c        2005-01-23 19:24:27.503322896 +0300
-+++ linux/arch/mips/brcm-boards/bcm947xx/setup.c        2005-01-23 19:29:05.237100944 +0300
-@@ -221,7 +221,9 @@
-                /* Try looking at TRX header for rootfs offset */
-                if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
-                        bcm947xx_parts[1].offset = off;
--                       if (le32_to_cpu(trx->offsets[1]) > off)
-+                       if (le32_to_cpu(trx->offsets[2]) > off)
-+                               off = le32_to_cpu(trx->offsets[2]);
-+                       else if (le32_to_cpu(trx->offsets[1]) > off)
-                                off = le32_to_cpu(trx->offsets[1]);
-                        continue;
-                }
-
-
-Revision history:
-       0.02    Initial release
-       0.03    Added Mineharu Takahara <mtakahar@yahoo.com> patch to pass actual
-               output size to decoder (stream mode compressed input is not 
-               a requirement anymore)
-       0.04    Reordered functions using lds script
diff --git a/target/linux/image/brcm/lzma-loader/src/decompress.c b/target/linux/image/brcm/lzma-loader/src/decompress.c
deleted file mode 100644 (file)
index ec510e2..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * LZMA compressed kernel decompressor for bcm947xx boards
- *
- * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * Please note, this was code based on the bunzip2 decompressor code
- * by Manuel Novoa III  (mjn3@codepoet.org), although the only thing left
- * is an idea and part of original vendor code
- *
- *
- * 12-Mar-2005  Mineharu Takahara <mtakahar@yahoo.com>
- *   pass actual output size to decoder (stream mode
- *   compressed input is not a requirement anymore)
- *
- * 24-Apr-2005 Oleg I. Vdovikin
- *   reordered functions using lds script, removed forward decl
- *
- */
-
-#include "LzmaDecode.h"
-
-#define BCM4710_FLASH          0x1fc00000      /* Flash */
-
-#define KSEG0                  0x80000000
-#define KSEG1                  0xa0000000
-
-#define KSEG1ADDR(a)           ((((unsigned)(a)) & 0x1fffffffU) | KSEG1)
-
-#define Index_Invalidate_I     0x00
-#define Index_Writeback_Inv_D   0x01
-
-#define cache_unroll(base,op)  \
-       __asm__ __volatile__(           \
-               ".set noreorder;\n"             \
-               ".set mips3;\n"                 \
-               "cache %1, (%0);\n"             \
-               ".set mips0;\n"                 \
-               ".set reorder\n"                \
-               :                                               \
-               : "r" (base),                   \
-                 "i" (op));
-
-static __inline__ void blast_icache(unsigned long size, unsigned long lsize)
-{
-       unsigned long start = KSEG0;
-       unsigned long end = (start + size);
-
-       while(start < end) {
-               cache_unroll(start,Index_Invalidate_I);
-               start += lsize;
-       }
-}
-
-static __inline__ void blast_dcache(unsigned long size, unsigned long lsize)
-{
-       unsigned long start = KSEG0;
-       unsigned long end = (start + size);
-
-       while(start < end) {
-               cache_unroll(start,Index_Writeback_Inv_D);
-               start += lsize;
-       }
-}
-
-#define TRX_MAGIC       0x30524448      /* "HDR0" */
-
-struct trx_header {
-       unsigned int magic;             /* "HDR0" */
-       unsigned int len;               /* Length of file including header */
-       unsigned int crc32;             /* 32-bit CRC from flag_version to end of file */
-       unsigned int flag_version;      /* 0:15 flags, 16:31 version */
-       unsigned int offsets[3];        /* Offsets of partitions from start of header */
-};
-
-/* beyound the image end, size not known in advance */
-extern unsigned char workspace[];
-
-unsigned int offset;
-unsigned char *data;
-
-/* flash access should be aligned, so wrapper is used */
-/* read byte from the flash, all accesses are 32-bit aligned */
-static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
-{
-       static unsigned int val;
-
-       if (((unsigned int)offset % 4) == 0) {
-               val = *(unsigned int *)data;
-               data += 4;
-       }
-       
-       *bufferSize = 1;
-       *buffer = ((unsigned char *)&val) + (offset++ & 3);
-       
-       return LZMA_RESULT_OK;
-}
-
-static __inline__ unsigned char get_byte(void)
-{
-       unsigned char *buffer;
-       UInt32 fake;
-       
-       return read_byte(0, &buffer, &fake), *buffer;
-}
-
-/* should be the first function */
-void entry(unsigned long icache_size, unsigned long icache_lsize, 
-       unsigned long dcache_size, unsigned long dcache_lsize)
-{
-       unsigned int i;  /* temp value */
-       unsigned int lc; /* literal context bits */
-       unsigned int lp; /* literal pos state bits */
-       unsigned int pb; /* pos state bits */
-       unsigned int osize; /* uncompressed size */
-
-       ILzmaInCallback callback;
-       callback.Read = read_byte;
-
-       /* look for trx header, 32-bit data access */
-       for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
-               ((struct trx_header *)data)->magic != TRX_MAGIC; data += 65536);
-
-       /* compressed kernel is in the partition 0 or 1 */
-       if (((struct trx_header *)data)->offsets[1] > 65536) 
-               data += ((struct trx_header *)data)->offsets[0];
-       else
-               data += ((struct trx_header *)data)->offsets[1];
-
-       offset = 0;
-
-       /* lzma args */
-       i = get_byte();
-       lc = i % 9, i = i / 9;
-       lp = i % 5, pb = i / 5;
-
-       /* skip rest of the LZMA coder property */
-       for (i = 0; i < 4; i++)
-               get_byte();
-
-       /* read the lower half of uncompressed size in the header */
-       osize = ((unsigned int)get_byte()) +
-               ((unsigned int)get_byte() << 8) +
-               ((unsigned int)get_byte() << 16) +
-               ((unsigned int)get_byte() << 24);
-
-       /* skip rest of the header (upper half of uncompressed size) */
-       for (i = 0; i < 4; i++) 
-               get_byte();
-
-       /* decompress kernel */
-       if (LzmaDecode(workspace, ~0, lc, lp, pb, &callback,
-               (unsigned char*)LOADADDR, osize, &i) == LZMA_RESULT_OK)
-       {
-               blast_dcache(dcache_size, dcache_lsize);
-               blast_icache(icache_size, icache_lsize);
-
-               /* Jump to load address */
-               ((void (*)(void)) LOADADDR)();
-       }
-}
diff --git a/target/linux/image/brcm/lzma-loader/src/decompress.lds.in b/target/linux/image/brcm/lzma-loader/src/decompress.lds.in
deleted file mode 100644 (file)
index 33f56f8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-OUTPUT_ARCH(mips)
-ENTRY(entry)
-SECTIONS {
-       . = BZ_TEXT_START;
-       .text : {
-               *(.text.entry)
-               *(.text)
-               *(.rodata)
-       }
-
-       .data : {
-               *(.data)
-       }
-
-       .bss : {
-               *(.bss)
-       }
-
-       workspace = .;
-}
diff --git a/target/linux/image/brcm/lzma-loader/src/head.S b/target/linux/image/brcm/lzma-loader/src/head.S
deleted file mode 100644 (file)
index 9bfbd53..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Copyright 2005 Oleg I. Vdovikin (oleg@cs.msu.su)    */
-/* cache manipulation adapted from Broadcom code       */
-/* idea taken from original bunzip2 decompressor code  */
-/* Copyright 2004 Manuel Novoa III (mjn3@codepoet.org) */
-/* Licensed under the linux kernel's version of the GPL.*/
-
-#include <asm/asm.h>
-#include <asm/regdef.h>
-
-#define KSEG0          0x80000000
-
-#define C0_CONFIG      $16
-#define C0_TAGLO       $28
-#define C0_TAGHI       $29
-
-#define        CONF1_DA_SHIFT  7                       /* D$ associativity */
-#define CONF1_DA_MASK  0x00000380
-#define CONF1_DA_BASE  1
-#define CONF1_DL_SHIFT 10                      /* D$ line size */
-#define CONF1_DL_MASK  0x00001c00
-#define CONF1_DL_BASE  2
-#define CONF1_DS_SHIFT 13                      /* D$ sets/way */
-#define CONF1_DS_MASK  0x0000e000
-#define CONF1_DS_BASE  64
-#define CONF1_IA_SHIFT 16                      /* I$ associativity */
-#define CONF1_IA_MASK  0x00070000
-#define CONF1_IA_BASE  1
-#define CONF1_IL_SHIFT 19                      /* I$ line size */
-#define CONF1_IL_MASK  0x00380000
-#define CONF1_IL_BASE  2
-#define CONF1_IS_SHIFT 22                      /* Instruction cache sets/way */
-#define CONF1_IS_MASK  0x01c00000
-#define CONF1_IS_BASE  64
-
-#define Index_Invalidate_I     0x00
-#define Index_Writeback_Inv_D   0x01
-
-       .text
-       LEAF(startup)
-       .set noreorder
-       
-       /* Copy decompressor code to the right place */
-       li      t2, BZ_TEXT_START
-       add     a0, t2, 0
-       la      a1, code_start
-       la      a2, code_stop
-$L1:
-       lw      t0, 0(a1)
-       sw      t0, 0(a0)
-       add     a1, 4
-       add     a0, 4
-       blt     a1, a2, $L1
-       nop
-       
-       /* At this point we need to invalidate dcache and */
-       /* icache before jumping to new code */
-
-1:     /* Get cache sizes */
-       .set    mips32
-       mfc0    s0,C0_CONFIG,1
-       .set    mips0
-
-       li      s1,CONF1_DL_MASK
-       and     s1,s0
-       beq     s1,zero,nodc
-       nop
-
-       srl     s1,CONF1_DL_SHIFT
-       li      t0,CONF1_DL_BASE
-       sll     s1,t0,s1                /* s1 has D$ cache line size */
-
-       li      s2,CONF1_DA_MASK
-       and     s2,s0
-       srl     s2,CONF1_DA_SHIFT
-       addiu   s2,CONF1_DA_BASE        /* s2 now has D$ associativity */
-
-       li      t0,CONF1_DS_MASK
-       and     t0,s0
-       srl     t0,CONF1_DS_SHIFT
-       li      s3,CONF1_DS_BASE
-       sll     s3,s3,t0                /* s3 has D$ sets per way */
-
-       multu   s2,s3                   /* sets/way * associativity */
-       mflo    t0                      /* total cache lines */
-
-       multu   s1,t0                   /* D$ linesize * lines */
-       mflo    s2                      /* s2 is now D$ size in bytes */
-
-       /* Initilize the D$: */
-       mtc0    zero,C0_TAGLO
-       mtc0    zero,C0_TAGHI
-
-       li      t0,KSEG0                /* Just an address for the first $ line */
-       addu    t1,t0,s2                /*  + size of cache == end */
-
-       .set    mips3
-1:     cache   Index_Writeback_Inv_D,0(t0)
-       .set    mips0
-       bne     t0,t1,1b
-       addu    t0,s1
-       
-nodc:
-       /* Now we get to do it all again for the I$ */
-       
-       move    s3,zero                 /* just in case there is no icache */
-       move    s4,zero
-
-       li      t0,CONF1_IL_MASK
-       and     t0,s0
-       beq     t0,zero,noic
-       nop
-
-       srl     t0,CONF1_IL_SHIFT
-       li      s3,CONF1_IL_BASE
-       sll     s3,t0                   /* s3 has I$ cache line size */
-
-       li      t0,CONF1_IA_MASK
-       and     t0,s0
-       srl     t0,CONF1_IA_SHIFT
-       addiu   s4,t0,CONF1_IA_BASE     /* s4 now has I$ associativity */
-
-       li      t0,CONF1_IS_MASK
-       and     t0,s0
-       srl     t0,CONF1_IS_SHIFT
-       li      s5,CONF1_IS_BASE
-       sll     s5,t0                   /* s5 has I$ sets per way */
-
-       multu   s4,s5                   /* sets/way * associativity */
-       mflo    t0                      /* s4 is now total cache lines */
-
-       multu   s3,t0                   /* I$ linesize * lines */
-       mflo    s4                      /* s4 is cache size in bytes */
-
-       /* Initilize the I$: */
-       mtc0    zero,C0_TAGLO
-       mtc0    zero,C0_TAGHI
-
-       li      t0,KSEG0                /* Just an address for the first $ line */
-       addu    t1,t0,s4                /*  + size of cache == end */
-
-       .set    mips3
-1:     cache   Index_Invalidate_I,0(t0)
-       .set    mips0
-       bne     t0,t1,1b
-       addu    t0,s3
-
-noic:
-       move    a0,s3                   /* icache line size */
-       move    a1,s4                   /* icache size */
-       move    a2,s1                   /* dcache line size */
-       jal     t2
-       move    a3,s2                   /* dcache size */
-       
-       .set reorder
-       END(startup)
diff --git a/target/linux/image/brcm/lzma-loader/src/loader.lds.in b/target/linux/image/brcm/lzma-loader/src/loader.lds.in
deleted file mode 100644 (file)
index 20f2ea9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-OUTPUT_ARCH(mips)
-ENTRY(startup)
-SECTIONS {
-       . = TEXT_START;
-       .text : {
-               *(.text)
-               *(.rodata)
-       }
-
-       .data : {
-               *(.data)
-       }
-
-       .bss : {
-               *(.bss)
-       }
-}
diff --git a/target/linux/image/generic/Makefile b/target/linux/image/generic/Makefile
deleted file mode 100644 (file)
index 3cb3b2e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-# use default targets for everything
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/generic/lzma-loader/Makefile b/target/linux/image/generic/lzma-loader/Makefile
deleted file mode 100644 (file)
index 3de04a8..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# $Id: Makefile 1823 2005-09-01 20:07:42Z nbd $
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME := loader
-PKG_VERSION := 0.05
-
-PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)-$(PKG_VERSION)
-
-$(PKG_BUILD_DIR)/.prepared:
-       mkdir $(PKG_BUILD_DIR)
-       $(CP) ./src/* $(PKG_BUILD_DIR)/
-       touch $@
-
-$(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma
-       $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \
-               LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS) \
-               RAMSIZE=$(RAMSIZE) \
-               LOADADDR=$(LOADADDR) \
-               KERNEL_ENTRY=$(KERNEL_ENTRY) \
-               IMAGE_COPY=$(IMAGE_COPY)
-
-
-$(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma
-       $(CP) $< $@
-
-$(KDIR)/loader.elf: $(PKG_BUILD_DIR)/lzma.elf
-       $(CP) $< $@
-
-source: 
-prepare: $(PKG_BUILD_DIR)/.prepared
-compile: $(KDIR)/loader.elf
-install:
-
-clean:
-       rm -rf $(PKG_BUILD_DIR)
-       rm -f $(KDIR)/loader.elf
diff --git a/target/linux/image/generic/lzma-loader/src/LzmaDecode.c b/target/linux/image/generic/lzma-loader/src/LzmaDecode.c
deleted file mode 100644 (file)
index c90a0d3..0000000
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
-  LzmaDecode.c
-  LZMA Decoder (optimized for Speed version)
-  
-  LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this Code, expressly permits you to 
-  statically or dynamically link your Code (or bind by name) to the 
-  interfaces of this file without subjecting your linked Code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#include "LzmaDecode.h"
-
-#ifndef Byte
-#define Byte unsigned char
-#endif
-
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_READ_BYTE (*Buffer++)
-
-#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
-  { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
-
-#ifdef _LZMA_IN_CB
-
-#define RC_TEST { if (Buffer == BufferLim) \
-  { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \
-  BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }}
-
-#define RC_INIT Buffer = BufferLim = 0; RC_INIT2
-
-#else
-
-#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
-
-#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
-#endif
-
-#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
-
-#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
-#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
-#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
-
-#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
-  { UpdateBit0(p); mi <<= 1; A0; } else \
-  { UpdateBit1(p); mi = (mi + mi) + 1; A1; } 
-  
-#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)               
-
-#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
-  { int i = numLevels; res = 1; \
-  do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
-  res -= (1 << numLevels); }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#if Literal != LZMA_BASE_SIZE
-StopCompilingDueBUG
-#endif
-
-#if 0
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
-{
-  unsigned char prop0;
-  if (size < LZMA_PROPERTIES_SIZE)
-    return LZMA_RESULT_DATA_ERROR;
-  prop0 = propsData[0];
-  if (prop0 >= (9 * 5 * 5))
-    return LZMA_RESULT_DATA_ERROR;
-  {
-    for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
-    for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
-    propsRes->lc = prop0;
-    /*
-    unsigned char remainder = (unsigned char)(prop0 / 9);
-    propsRes->lc = prop0 % 9;
-    propsRes->pb = remainder / 5;
-    propsRes->lp = remainder % 5;
-    */
-  }
-
-  #ifdef _LZMA_OUT_READ
-  {
-    int i;
-    propsRes->DictionarySize = 0;
-    for (i = 0; i < 4; i++)
-      propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
-    if (propsRes->DictionarySize == 0)
-      propsRes->DictionarySize = 1;
-  }
-  #endif
-  return LZMA_RESULT_OK;
-}
-#endif
-
-#define kLzmaStreamWasFinishedId (-1)
-
-int LzmaDecode(CLzmaDecoderState *vs,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *InCallback,
-    #else
-    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
-    #endif
-    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
-{
-  CProb *p = vs->Probs;
-  SizeT nowPos = 0;
-  Byte previousByte = 0;
-  UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
-  UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
-  int lc = vs->Properties.lc;
-
-  #ifdef _LZMA_OUT_READ
-  
-  UInt32 Range = vs->Range;
-  UInt32 Code = vs->Code;
-  #ifdef _LZMA_IN_CB
-  const Byte *Buffer = vs->Buffer;
-  const Byte *BufferLim = vs->BufferLim;
-  #else
-  const Byte *Buffer = inStream;
-  const Byte *BufferLim = inStream + inSize;
-  #endif
-  int state = vs->State;
-  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
-  int len = vs->RemainLen;
-  UInt32 globalPos = vs->GlobalPos;
-  UInt32 distanceLimit = vs->DistanceLimit;
-
-  Byte *dictionary = vs->Dictionary;
-  UInt32 dictionarySize = vs->Properties.DictionarySize;
-  UInt32 dictionaryPos = vs->DictionaryPos;
-
-  Byte tempDictionary[4];
-
-  #ifndef _LZMA_IN_CB
-  *inSizeProcessed = 0;
-  #endif
-  *outSizeProcessed = 0;
-  if (len == kLzmaStreamWasFinishedId)
-    return LZMA_RESULT_OK;
-
-  if (dictionarySize == 0)
-  {
-    dictionary = tempDictionary;
-    dictionarySize = 1;
-    tempDictionary[0] = vs->TempDictionary[0];
-  }
-
-  if (len == kLzmaNeedInitId)
-  {
-    {
-      UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
-      UInt32 i;
-      for (i = 0; i < numProbs; i++)
-        p[i] = kBitModelTotal >> 1; 
-      rep0 = rep1 = rep2 = rep3 = 1;
-      state = 0;
-      globalPos = 0;
-      distanceLimit = 0;
-      dictionaryPos = 0;
-      dictionary[dictionarySize - 1] = 0;
-      #ifdef _LZMA_IN_CB
-      RC_INIT;
-      #else
-      RC_INIT(inStream, inSize);
-      #endif
-    }
-    len = 0;
-  }
-  while(len != 0 && nowPos < outSize)
-  {
-    UInt32 pos = dictionaryPos - rep0;
-    if (pos >= dictionarySize)
-      pos += dictionarySize;
-    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
-    if (++dictionaryPos == dictionarySize)
-      dictionaryPos = 0;
-    len--;
-  }
-  if (dictionaryPos == 0)
-    previousByte = dictionary[dictionarySize - 1];
-  else
-    previousByte = dictionary[dictionaryPos - 1];
-
-  #else /* if !_LZMA_OUT_READ */
-
-  int state = 0;
-  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
-  int len = 0;
-  const Byte *Buffer;
-  const Byte *BufferLim;
-  UInt32 Range;
-  UInt32 Code;
-
-  #ifndef _LZMA_IN_CB
-  *inSizeProcessed = 0;
-  #endif
-  *outSizeProcessed = 0;
-
-  {
-    UInt32 i;
-    UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
-    for (i = 0; i < numProbs; i++)
-      p[i] = kBitModelTotal >> 1;
-  }
-  
-  #ifdef _LZMA_IN_CB
-  RC_INIT;
-  #else
-  RC_INIT(inStream, inSize);
-  #endif
-
-  #endif /* _LZMA_OUT_READ */
-
-  while(nowPos < outSize)
-  {
-    CProb *prob;
-    UInt32 bound;
-    int posState = (int)(
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & posStateMask);
-
-    prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
-    IfBit0(prob)
-    {
-      int symbol = 1;
-      UpdateBit0(prob)
-      prob = p + Literal + (LZMA_LIT_SIZE * 
-        (((
-        (nowPos 
-        #ifdef _LZMA_OUT_READ
-        + globalPos
-        #endif
-        )
-        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-
-      if (state >= kNumLitStates)
-      {
-        int matchByte;
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        matchByte = dictionary[pos];
-        #else
-        matchByte = outStream[nowPos - rep0];
-        #endif
-        do
-        {
-          int bit;
-          CProb *probLit;
-          matchByte <<= 1;
-          bit = (matchByte & 0x100);
-          probLit = prob + 0x100 + bit + symbol;
-          RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
-        }
-        while (symbol < 0x100);
-      }
-      while (symbol < 0x100)
-      {
-        CProb *probLit = prob + symbol;
-        RC_GET_BIT(probLit, symbol)
-      }
-      previousByte = (Byte)symbol;
-
-      outStream[nowPos++] = previousByte;
-      #ifdef _LZMA_OUT_READ
-      if (distanceLimit < dictionarySize)
-        distanceLimit++;
-
-      dictionary[dictionaryPos] = previousByte;
-      if (++dictionaryPos == dictionarySize)
-        dictionaryPos = 0;
-      #endif
-      if (state < 4) state = 0;
-      else if (state < 10) state -= 3;
-      else state -= 6;
-    }
-    else             
-    {
-      UpdateBit1(prob);
-      prob = p + IsRep + state;
-      IfBit0(prob)
-      {
-        UpdateBit0(prob);
-        rep3 = rep2;
-        rep2 = rep1;
-        rep1 = rep0;
-        state = state < kNumLitStates ? 0 : 3;
-        prob = p + LenCoder;
-      }
-      else
-      {
-        UpdateBit1(prob);
-        prob = p + IsRepG0 + state;
-        IfBit0(prob)
-        {
-          UpdateBit0(prob);
-          prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
-          IfBit0(prob)
-          {
-            #ifdef _LZMA_OUT_READ
-            UInt32 pos;
-            #endif
-            UpdateBit0(prob);
-            
-            #ifdef _LZMA_OUT_READ
-            if (distanceLimit == 0)
-            #else
-            if (nowPos == 0)
-            #endif
-              return LZMA_RESULT_DATA_ERROR;
-            
-            state = state < kNumLitStates ? 9 : 11;
-            #ifdef _LZMA_OUT_READ
-            pos = dictionaryPos - rep0;
-            if (pos >= dictionarySize)
-              pos += dictionarySize;
-            previousByte = dictionary[pos];
-            dictionary[dictionaryPos] = previousByte;
-            if (++dictionaryPos == dictionarySize)
-              dictionaryPos = 0;
-            #else
-            previousByte = outStream[nowPos - rep0];
-            #endif
-            outStream[nowPos++] = previousByte;
-            #ifdef _LZMA_OUT_READ
-            if (distanceLimit < dictionarySize)
-              distanceLimit++;
-            #endif
-
-            continue;
-          }
-          else
-          {
-            UpdateBit1(prob);
-          }
-        }
-        else
-        {
-          UInt32 distance;
-          UpdateBit1(prob);
-          prob = p + IsRepG1 + state;
-          IfBit0(prob)
-          {
-            UpdateBit0(prob);
-            distance = rep1;
-          }
-          else 
-          {
-            UpdateBit1(prob);
-            prob = p + IsRepG2 + state;
-            IfBit0(prob)
-            {
-              UpdateBit0(prob);
-              distance = rep2;
-            }
-            else
-            {
-              UpdateBit1(prob);
-              distance = rep3;
-              rep3 = rep2;
-            }
-            rep2 = rep1;
-          }
-          rep1 = rep0;
-          rep0 = distance;
-        }
-        state = state < kNumLitStates ? 8 : 11;
-        prob = p + RepLenCoder;
-      }
-      {
-        int numBits, offset;
-        CProb *probLen = prob + LenChoice;
-        IfBit0(probLen)
-        {
-          UpdateBit0(probLen);
-          probLen = prob + LenLow + (posState << kLenNumLowBits);
-          offset = 0;
-          numBits = kLenNumLowBits;
-        }
-        else
-        {
-          UpdateBit1(probLen);
-          probLen = prob + LenChoice2;
-          IfBit0(probLen)
-          {
-            UpdateBit0(probLen);
-            probLen = prob + LenMid + (posState << kLenNumMidBits);
-            offset = kLenNumLowSymbols;
-            numBits = kLenNumMidBits;
-          }
-          else
-          {
-            UpdateBit1(probLen);
-            probLen = prob + LenHigh;
-            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-            numBits = kLenNumHighBits;
-          }
-        }
-        RangeDecoderBitTreeDecode(probLen, numBits, len);
-        len += offset;
-      }
-
-      if (state < 4)
-      {
-        int posSlot;
-        state += kNumLitStates;
-        prob = p + PosSlot +
-            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
-            kNumPosSlotBits);
-        RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
-        if (posSlot >= kStartPosModelIndex)
-        {
-          int numDirectBits = ((posSlot >> 1) - 1);
-          rep0 = (2 | ((UInt32)posSlot & 1));
-          if (posSlot < kEndPosModelIndex)
-          {
-            rep0 <<= numDirectBits;
-            prob = p + SpecPos + rep0 - posSlot - 1;
-          }
-          else
-          {
-            numDirectBits -= kNumAlignBits;
-            do
-            {
-              RC_NORMALIZE
-              Range >>= 1;
-              rep0 <<= 1;
-              if (Code >= Range)
-              {
-                Code -= Range;
-                rep0 |= 1;
-              }
-            }
-            while (--numDirectBits != 0);
-            prob = p + Align;
-            rep0 <<= kNumAlignBits;
-            numDirectBits = kNumAlignBits;
-          }
-          {
-            int i = 1;
-            int mi = 1;
-            do
-            {
-              CProb *prob3 = prob + mi;
-              RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
-              i <<= 1;
-            }
-            while(--numDirectBits != 0);
-          }
-        }
-        else
-          rep0 = posSlot;
-        if (++rep0 == (UInt32)(0))
-        {
-          /* it's for stream version */
-          len = kLzmaStreamWasFinishedId;
-          break;
-        }
-      }
-
-      len += kMatchMinLen;
-      #ifdef _LZMA_OUT_READ
-      if (rep0 > distanceLimit) 
-      #else
-      if (rep0 > nowPos)
-      #endif
-        return LZMA_RESULT_DATA_ERROR;
-
-      #ifdef _LZMA_OUT_READ
-      if (dictionarySize - distanceLimit > (UInt32)len)
-        distanceLimit += len;
-      else
-        distanceLimit = dictionarySize;
-      #endif
-
-      do
-      {
-        #ifdef _LZMA_OUT_READ
-        UInt32 pos = dictionaryPos - rep0;
-        if (pos >= dictionarySize)
-          pos += dictionarySize;
-        previousByte = dictionary[pos];
-        dictionary[dictionaryPos] = previousByte;
-        if (++dictionaryPos == dictionarySize)
-          dictionaryPos = 0;
-        #else
-        previousByte = outStream[nowPos - rep0];
-        #endif
-        len--;
-        outStream[nowPos++] = previousByte;
-      }
-      while(len != 0 && nowPos < outSize);
-    }
-  }
-  RC_NORMALIZE;
-
-  #ifdef _LZMA_OUT_READ
-  vs->Range = Range;
-  vs->Code = Code;
-  vs->DictionaryPos = dictionaryPos;
-  vs->GlobalPos = globalPos + (UInt32)nowPos;
-  vs->DistanceLimit = distanceLimit;
-  vs->Reps[0] = rep0;
-  vs->Reps[1] = rep1;
-  vs->Reps[2] = rep2;
-  vs->Reps[3] = rep3;
-  vs->State = state;
-  vs->RemainLen = len;
-  vs->TempDictionary[0] = tempDictionary[0];
-  #endif
-
-  #ifdef _LZMA_IN_CB
-  vs->Buffer = Buffer;
-  vs->BufferLim = BufferLim;
-  #else
-  *inSizeProcessed = (SizeT)(Buffer - inStream);
-  #endif
-  *outSizeProcessed = nowPos;
-  return LZMA_RESULT_OK;
-}
diff --git a/target/linux/image/generic/lzma-loader/src/LzmaDecode.h b/target/linux/image/generic/lzma-loader/src/LzmaDecode.h
deleted file mode 100644 (file)
index 213062a..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/* 
-  LzmaDecode.h
-  LZMA Decoder interface
-
-  LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08)
-  http://www.7-zip.org/
-
-  LZMA SDK is licensed under two licenses:
-  1) GNU Lesser General Public License (GNU LGPL)
-  2) Common Public License (CPL)
-  It means that you can select one of these two licenses and 
-  follow rules of that license.
-
-  SPECIAL EXCEPTION:
-  Igor Pavlov, as the author of this code, expressly permits you to 
-  statically or dynamically link your code (or bind by name) to the 
-  interfaces of this file without subjecting your linked code to the 
-  terms of the CPL or GNU LGPL. Any modifications or additions 
-  to this file, however, are subject to the LGPL or CPL terms.
-*/
-
-#ifndef __LZMADECODE_H
-#define __LZMADECODE_H
-
-/* #define _LZMA_IN_CB */
-/* Use callback for input data */
-
-/* #define _LZMA_OUT_READ */
-/* Use read function for output data */
-
-/* #define _LZMA_PROB32 */
-/* It can increase speed on some 32-bit CPUs, 
-   but memory usage will be doubled in that case */
-
-/* #define _LZMA_LOC_OPT */
-/* Enable local speed optimizations inside code */
-
-/* #define _LZMA_SYSTEM_SIZE_T */
-/* Use system's size_t. You can use it to enable 64-bit sizes supporting*/
-
-#ifndef UInt32
-#ifdef _LZMA_UINT32_IS_ULONG
-#define UInt32 unsigned long
-#else
-#define UInt32 unsigned int
-#endif
-#endif
-
-#ifndef SizeT
-#ifdef _LZMA_SYSTEM_SIZE_T
-#include <stddef.h>
-#define SizeT size_t
-#else
-#define SizeT UInt32
-#endif
-#endif
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb unsigned short
-#endif
-
-#define LZMA_RESULT_OK 0
-#define LZMA_RESULT_DATA_ERROR 1
-
-#ifdef _LZMA_IN_CB
-typedef struct _ILzmaInCallback
-{
-  int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
-} ILzmaInCallback;
-#endif
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 768
-
-#define LZMA_PROPERTIES_SIZE 5
-
-typedef struct _CLzmaProperties
-{
-  int lc;
-  int lp;
-  int pb;
-  #ifdef _LZMA_OUT_READ
-  UInt32 DictionarySize;
-  #endif
-}CLzmaProperties;
-
-int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
-
-#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
-
-#define kLzmaNeedInitId (-2)
-
-typedef struct _CLzmaDecoderState
-{
-  CLzmaProperties Properties;
-  CProb *Probs;
-
-  #ifdef _LZMA_IN_CB
-  const unsigned char *Buffer;
-  const unsigned char *BufferLim;
-  #endif
-
-  #ifdef _LZMA_OUT_READ
-  unsigned char *Dictionary;
-  UInt32 Range;
-  UInt32 Code;
-  UInt32 DictionaryPos;
-  UInt32 GlobalPos;
-  UInt32 DistanceLimit;
-  UInt32 Reps[4];
-  int State;
-  int RemainLen;
-  unsigned char TempDictionary[4];
-  #endif
-} CLzmaDecoderState;
-
-#ifdef _LZMA_OUT_READ
-#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
-#endif
-
-int LzmaDecode(CLzmaDecoderState *vs,
-    #ifdef _LZMA_IN_CB
-    ILzmaInCallback *inCallback,
-    #else
-    const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
-    #endif
-    unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
-
-#endif
diff --git a/target/linux/image/generic/lzma-loader/src/Makefile b/target/linux/image/generic/lzma-loader/src/Makefile
deleted file mode 100644 (file)
index 5435688..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-LOADADDR = 0x80400000          # RAM start + 4M
-KERNEL_ENTRY = 0x80001000
-RAMSIZE = 0x00100000           # 1MB
-IMAGE_COPY:=0
-
-CROSS_COMPILE = mips-linux-
-
-OBJCOPY:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
-CFLAGS := -fno-builtin -Os -G 0 -ffunction-sections -mno-abicalls -fno-pic -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -Wall -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} -D_LZMA_IN_CB
-ifeq ($(IMAGE_COPY),1)
-CFLAGS += -DLOADADDR=${LOADADDR} -DIMAGE_COPY=1
-endif
-
-.S.s:
-       $(CPP) $(CFLAGS) $< -o $*.s
-.S.o:
-       $(CC) $(CFLAGS) -c $< -o $*.o
-.c.o:
-       $(CC) $(CFLAGS) -c $< -o $*.o
-
-CC =       $(CROSS_COMPILE)gcc
-LD =       $(CROSS_COMPILE)ld
-OBJDUMP =  $(CROSS_COMPILE)objdump
-
-O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
-
-# Drop some uninteresting sections in the kernel.
-# This is only relevant for ELF kernels but doesn't hurt a.out
-drop-sections   = .reginfo .mdebug .comment
-strip-flags     = $(addprefix --remove-section=,$(drop-sections))
-
-all : lzma.elf
-
-lzma.lds: lzma.lds.in
-       sed -e 's,@LOADADDR@,$(LOADADDR),g' -e 's,@ENTRY@,_start,g' $< >$@
-
-kernel.o: vmlinux.lzma lzma.lds
-       $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
-
-ifeq ($(IMAGE_COPY),1)
-lzma.o: decompress.o LzmaDecode.o kernel.o
-       sed -e 's,@LOADADDR@,$(LOADADDR),g' -e 's,@ENTRY@,entry,g' lzma.lds.in >lzma-stage2.lds
-       $(LD) -static --no-warn-mismatch -e entry -Tlzma-stage2.lds -o temp-$@ $^
-       $(OBJCOPY) temp-$@ lzma.tmp
-       @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > lzma-data.lds
-       $(LD) -no-warn-mismatch -T lzma-data.lds -r -o $@ -b binary lzma.tmp --oformat $(O_FORMAT)
-       
-lzma.elf: start.o lzma.o
-       sed -e 's,@LOADADDR@,$(KERNEL_ENTRY),g' lzma-copy.lds.in >lzma-copy.lds
-       $(LD) -s -Tlzma-copy.lds -o $@ $^
-else
-lzma.elf: start.o decompress.o LzmaDecode.o kernel.o
-       $(LD) -s -Tlzma.lds -o $@ $^
-endif
-
-clean:
-       rm -f *.o lzma.elf *.tmp *.lds
diff --git a/target/linux/image/generic/lzma-loader/src/decompress.c b/target/linux/image/generic/lzma-loader/src/decompress.c
deleted file mode 100644 (file)
index 4ed432d..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * LZMA compressed kernel decompressor for bcm947xx boards
- *
- * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * Please note, this was code based on the bunzip2 decompressor code
- * by Manuel Novoa III  (mjn3@codepoet.org), although the only thing left
- * is an idea and part of original vendor code
- *
- *
- * 12-Mar-2005  Mineharu Takahara <mtakahar@yahoo.com>
- *   pass actual output size to decoder (stream mode
- *   compressed input is not a requirement anymore)
- *
- * 24-Apr-2005 Oleg I. Vdovikin
- *   reordered functions using lds script, removed forward decl
- *
- * ??-Nov-2005 Mike Baker
- *   reorder the script as an lzma wrapper; do not depend on flash access
- */
-
-#include "LzmaDecode.h"
-
-#define KSEG0                  0x80000000
-#define KSEG1                  0xa0000000
-
-#define KSEG1ADDR(a)           ((((unsigned)(a)) & 0x1fffffffU) | KSEG1)
-
-#define Index_Invalidate_I     0x00
-#define Index_Writeback_Inv_D   0x01
-
-#define cache_unroll(base,op)  \
-       __asm__ __volatile__(           \
-               ".set noreorder;\n"             \
-               ".set mips3;\n"                 \
-               "cache %1, (%0);\n"             \
-               ".set mips0;\n"                 \
-               ".set reorder\n"                \
-               :                                               \
-               : "r" (base),                   \
-                 "i" (op));
-
-
-static __inline__ void blast_icache(unsigned long size, unsigned long lsize)
-{
-       unsigned long start = KSEG0;
-       unsigned long end = (start + size);
-
-       while(start < end) {
-               cache_unroll(start,Index_Invalidate_I);
-               start += lsize;
-       }
-}
-
-static __inline__ void blast_dcache(unsigned long size, unsigned long lsize)
-{
-       unsigned long start = KSEG0;
-       unsigned long end = (start + size);
-
-       while(start < end) {
-               cache_unroll(start,Index_Writeback_Inv_D);
-               start += lsize;
-       }
-}
-
-unsigned char *data;
-
-static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
-{
-       *bufferSize = 1;
-       *buffer = data;
-       ++data;
-       return LZMA_RESULT_OK;
-}
-
-static __inline__ unsigned char get_byte(void)
-{
-       unsigned char *buffer;
-       UInt32 fake;
-       
-       return read_byte(0, &buffer, &fake), *buffer;
-}
-
-static char *buffer = (char *)0x80C00000;
-extern char lzma_start[];
-extern char lzma_end[];
-
-/* should be the first function */
-void entry(unsigned long icache_size, unsigned long icache_lsize, 
-       unsigned long dcache_size, unsigned long dcache_lsize)
-{
-       unsigned int i;  /* temp value */
-       unsigned int osize; /* uncompressed size */
-       volatile unsigned int arg0, arg1, arg2, arg3;
-
-       /* restore argument registers */
-       __asm__ __volatile__ ("ori %0, $12, 0":"=r"(arg0));
-       __asm__ __volatile__ ("ori %0, $13, 0":"=r"(arg1));
-       __asm__ __volatile__ ("ori %0, $14, 0":"=r"(arg2));
-       __asm__ __volatile__ ("ori %0, $15, 0":"=r"(arg3));
-
-       ILzmaInCallback callback;
-       CLzmaDecoderState vs;
-       callback.Read = read_byte;
-
-       data = lzma_start;
-
-       /* lzma args */
-       i = get_byte();
-       vs.Properties.lc = i % 9, i = i / 9;
-       vs.Properties.lp = i % 5, vs.Properties.pb = i / 5;
-
-       vs.Probs = (CProb *)buffer;
-
-       /* skip rest of the LZMA coder property */
-       for (i = 0; i < 4; i++)
-               get_byte();
-
-       /* read the lower half of uncompressed size in the header */
-       osize = ((unsigned int)get_byte()) +
-               ((unsigned int)get_byte() << 8) +
-               ((unsigned int)get_byte() << 16) +
-               ((unsigned int)get_byte() << 24);
-
-       /* skip rest of the header (upper half of uncompressed size) */
-       for (i = 0; i < 4; i++) 
-               get_byte();
-
-       /* decompress kernel */
-       if ((i = LzmaDecode(&vs, &callback,
-       (unsigned char*)KERNEL_ENTRY, osize, &osize)) == LZMA_RESULT_OK)
-       {
-               blast_dcache(dcache_size, dcache_lsize);
-               blast_icache(icache_size, icache_lsize);
-
-               /* Jump to load address */
-               ((void (*)(int a0, int a1, int a2, int a3)) KERNEL_ENTRY)(arg0, arg1, arg2, arg3);
-       }
-}
diff --git a/target/linux/image/generic/lzma-loader/src/lzma-copy.lds.in b/target/linux/image/generic/lzma-loader/src/lzma-copy.lds.in
deleted file mode 100644 (file)
index fbc87ab..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-OUTPUT_ARCH(mips)
-ENTRY(_start)
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = @LOADADDR@;
-  .text      :
-  {
-    _ftext = . ;
-    *(.text)
-    *(.rodata)
-  } =0
-
-  .reginfo : { *(.reginfo) }
-
-  .bss       :
-  {
-   *(.bss)
-  }
-}
diff --git a/target/linux/image/generic/lzma-loader/src/lzma.lds.in b/target/linux/image/generic/lzma-loader/src/lzma.lds.in
deleted file mode 100644 (file)
index 6021cec..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-OUTPUT_ARCH(mips)
-ENTRY(@ENTRY@)
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = @LOADADDR@;
-  .text      :
-  {
-    _ftext = . ;
-    *(.text.entry)
-    *(.text)
-    *(.rodata)
-    lzma_start = .;
-    kernel.o
-    lzma_end = .;
-  } =0
-
-  .reginfo : { *(.reginfo) }
-
-  .bss       :
-  {
-   *(.bss)
-  }
-}
diff --git a/target/linux/image/generic/lzma-loader/src/print.c b/target/linux/image/generic/lzma-loader/src/print.c
deleted file mode 100644 (file)
index 950687b..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#include       "print.h"
-
-/* macros */
-#define                IsDigit(x)      ( ((x) >= '0') && ((x) <= '9') )
-#define                Ctod(x)         ( (x) - '0')
-
-/* forward declaration */
-extern int PrintChar(char *, char, int, int);
-extern int PrintString(char *, char *, int, int);
-extern int PrintNum(char *, unsigned long, int, int, int, int, char, int);
-
-/* private variable */
-static const char theFatalMsg[] = "fatal error in lp_Print!";
-
-/* -*-
- * A low level printf() function.
- */
-void
-lp_Print(void (*output)(void *, char *, int), 
-        void * arg,
-        char *fmt, 
-        va_list ap)
-{
-
-#define        OUTPUT(arg, s, l)  \
-  { if (((l) < 0) || ((l) > LP_MAX_BUF)) { \
-       (*output)(arg, (char*)theFatalMsg, sizeof(theFatalMsg)-1); for(;;); \
-    } else { \
-      (*output)(arg, s, l); \
-    } \
-  }
-    
-    char buf[LP_MAX_BUF];
-
-    char c;
-    char *s;
-    long int num;
-
-    int longFlag;
-    int negFlag;
-    int width;
-    int prec;
-    int ladjust;
-    char padc;
-
-    int length;
-
-    for(;;) {
-       { 
-           /* scan for the next '%' */
-           char *fmtStart = fmt;
-           while ( (*fmt != '\0') && (*fmt != '%')) {
-               fmt ++;
-           }
-
-           /* flush the string found so far */
-           OUTPUT(arg, fmtStart, fmt-fmtStart);
-
-           /* are we hitting the end? */
-           if (*fmt == '\0') break;
-       }
-
-       /* we found a '%' */
-       fmt ++;
-       
-       /* check for long */
-       if (*fmt == 'l') {
-           longFlag = 1;
-           fmt ++;
-       } else {
-           longFlag = 0;
-       }
-
-       /* check for other prefixes */
-       width = 0;
-       prec = -1;
-       ladjust = 0;
-       padc = ' ';
-
-       if (*fmt == '-') {
-           ladjust = 1;
-           fmt ++;
-       }
-
-       if (*fmt == '0') {
-           padc = '0';
-           fmt++;
-       }
-
-       if (IsDigit(*fmt)) {
-           while (IsDigit(*fmt)) {
-               width = 10 * width + Ctod(*fmt++);
-           }
-       }
-
-       if (*fmt == '.') {
-           fmt ++;
-           if (IsDigit(*fmt)) {
-               prec = 0;
-               while (IsDigit(*fmt)) {
-                   prec = prec*10 + Ctod(*fmt++);
-               }
-           }
-       }
-
-
-       /* check format flag */
-       negFlag = 0;
-       switch (*fmt) {
-        case 'b':
-           if (longFlag) { 
-               num = va_arg(ap, long int); 
-           } else { 
-               num = va_arg(ap, int);
-           }
-           length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case 'd':
-        case 'D':
-           if (longFlag) { 
-               num = va_arg(ap, long int);
-           } else { 
-               num = va_arg(ap, int); 
-           }
-           if (num < 0) {
-               num = - num;
-               negFlag = 1;
-           }
-           length = PrintNum(buf, num, 10, negFlag, width, ladjust, padc, 0);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case 'o':
-        case 'O':
-           if (longFlag) { 
-               num = va_arg(ap, long int);
-           } else { 
-               num = va_arg(ap, int); 
-           }
-           length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case 'u':
-        case 'U':
-           if (longFlag) { 
-               num = va_arg(ap, long int);
-           } else { 
-               num = va_arg(ap, int); 
-           }
-           length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0);
-           OUTPUT(arg, buf, length);
-           break;
-           
-        case 'x':
-           if (longFlag) { 
-               num = va_arg(ap, long int);
-           } else { 
-               num = va_arg(ap, int); 
-           }
-           length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case 'X':
-           if (longFlag) { 
-               num = va_arg(ap, long int);
-           } else { 
-               num = va_arg(ap, int); 
-           }
-           length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case 'c':
-           c = (char)va_arg(ap, int);
-           length = PrintChar(buf, c, width, ladjust);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case 's':
-           s = (char*)va_arg(ap, char *);
-           length = PrintString(buf, s, width, ladjust);
-           OUTPUT(arg, buf, length);
-           break;
-
-        case '\0':
-           fmt --;
-           break;
-
-        default:
-           /* output this char as it is */
-           OUTPUT(arg, fmt, 1);
-       }       /* switch (*fmt) */
-
-       fmt ++;
-    }          /* for(;;) */
-
-    /* special termination call */
-    OUTPUT(arg, "\0", 1);
-}
-
-
-/* --------------- local help functions --------------------- */
-int
-PrintChar(char * buf, char c, int length, int ladjust)
-{
-    int i;
-    
-    if (length < 1) length = 1;
-    if (ladjust) {
-       *buf = c;
-       for (i=1; i< length; i++) buf[i] = ' ';
-    } else {
-       for (i=0; i< length-1; i++) buf[i] = ' ';
-       buf[length - 1] = c;
-    }
-    return length;
-}
-
-int
-PrintString(char * buf, char* s, int length, int ladjust)
-{
-    int i;
-    int len=0;
-    char* s1 = s;
-    while (*s1++) len++;
-    if (length < len) length = len;
-
-    if (ladjust) {
-       for (i=0; i< len; i++) buf[i] = s[i];
-       for (i=len; i< length; i++) buf[i] = ' ';
-    } else {
-       for (i=0; i< length-len; i++) buf[i] = ' ';
-       for (i=length-len; i < length; i++) buf[i] = s[i-length+len];
-    }
-    return length;
-}
-
-int
-PrintNum(char * buf, unsigned long u, int base, int negFlag, 
-        int length, int ladjust, char padc, int upcase)
-{
-    /* algorithm :
-     *  1. prints the number from left to right in reverse form.
-     *  2. fill the remaining spaces with padc if length is longer than
-     *     the actual length
-     *     TRICKY : if left adjusted, no "0" padding.
-     *             if negtive, insert  "0" padding between "0" and number.
-     *  3. if (!ladjust) we reverse the whole string including paddings
-     *  4. otherwise we only reverse the actual string representing the num.
-     */
-
-    int actualLength =0;
-    char *p = buf;
-    int i;
-
-    do {
-       int tmp = u %base;
-       if (tmp <= 9) {
-           *p++ = '0' + tmp;
-       } else if (upcase) {
-           *p++ = 'A' + tmp - 10;
-       } else {
-           *p++ = 'a' + tmp - 10;
-       }
-       u /= base;
-    } while (u != 0);
-
-    if (negFlag) {
-       *p++ = '-';
-    }
-
-    /* figure out actual length and adjust the maximum length */
-    actualLength = p - buf;
-    if (length < actualLength) length = actualLength;
-
-    /* add padding */
-    if (ladjust) {
-       padc = ' ';
-    }
-    if (negFlag && !ladjust && (padc == '0')) {
-       for (i = actualLength-1; i< length-1; i++) buf[i] = padc;
-       buf[length -1] = '-';
-    } else {
-       for (i = actualLength; i< length; i++) buf[i] = padc;
-    }
-           
-
-    /* prepare to reverse the string */
-    {
-       int begin = 0;
-       int end;
-       if (ladjust) {
-           end = actualLength - 1;
-       } else {
-           end = length -1;
-       }
-
-       while (end > begin) {
-           char tmp = buf[begin];
-           buf[begin] = buf[end];
-           buf[end] = tmp;
-           begin ++;
-           end --;
-       }
-    }
-
-    /* adjust the string pointer */
-    return length;
-}
diff --git a/target/linux/image/generic/lzma-loader/src/print.h b/target/linux/image/generic/lzma-loader/src/print.h
deleted file mode 100644 (file)
index b051463..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef _print_h_
-#define _print_h_
-
-#include <stdarg.h>
-
-/* this is the maximum width for a variable */
-#define                LP_MAX_BUF      80
-
-/* -*-
- * output function takes an void pointer which is passed in as the
- * second argument in lp_Print().  This black-box argument gives output
- * function a way to track state.
- *
- * The second argument in output function is a pointer to char buffer.
- * The third argument specifies the number of chars to outputed.
- *
- * output function cannot assume the buffer is null-terminated after
- * l number of chars.
- */
-void lp_Print(void (*output)(void *, char *, int), 
-             void * arg,
-             char *fmt, 
-             va_list ap);
-
-#endif
diff --git a/target/linux/image/generic/lzma-loader/src/printf.c b/target/linux/image/generic/lzma-loader/src/printf.c
deleted file mode 100644 (file)
index 49bd50d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#include "printf.h"
-#include "print.h"
-#include "uart16550.h"
-
-static void myoutput(void *arg, char *s, int l)
-{
-    int i;
-
-    // special termination call
-    if ((l==1) && (s[0] == '\0')) return;
-    
-    for (i=0; i< l; i++) {
-       Uart16550Put(s[i]);
-       if (s[i] == '\n') Uart16550Put('\r');
-    }
-}
-
-void printf(char *fmt, ...)
-{
-    va_list ap;
-    va_start(ap, fmt);
-    lp_Print(myoutput, 0, fmt, ap);
-    va_end(ap);
-}
diff --git a/target/linux/image/generic/lzma-loader/src/printf.h b/target/linux/image/generic/lzma-loader/src/printf.h
deleted file mode 100644 (file)
index 9b1c1df..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef _printf_h_
-#define _printf_h_
-
-#include <stdarg.h>
-void printf(char *fmt, ...);
-
-#endif /* _printf_h_ */
diff --git a/target/linux/image/generic/lzma-loader/src/start.S b/target/linux/image/generic/lzma-loader/src/start.S
deleted file mode 100644 (file)
index 9a85c4c..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#include <asm/asm.h>
-#include <asm/regdef.h>
-
-#define KSEG0          0x80000000
-
-#define C0_CONFIG      $16
-#define C0_TAGLO       $28
-#define C0_TAGHI       $29
-
-#define        CONF1_DA_SHIFT  7                       /* D$ associativity */
-#define CONF1_DA_MASK  0x00000380
-#define CONF1_DA_BASE  1
-#define CONF1_DL_SHIFT 10                      /* D$ line size */
-#define CONF1_DL_MASK  0x00001c00
-#define CONF1_DL_BASE  2
-#define CONF1_DS_SHIFT 13                      /* D$ sets/way */
-#define CONF1_DS_MASK  0x0000e000
-#define CONF1_DS_BASE  64
-#define CONF1_IA_SHIFT 16                      /* I$ associativity */
-#define CONF1_IA_MASK  0x00070000
-#define CONF1_IA_BASE  1
-#define CONF1_IL_SHIFT 19                      /* I$ line size */
-#define CONF1_IL_MASK  0x00380000
-#define CONF1_IL_BASE  2
-#define CONF1_IS_SHIFT 22                      /* Instruction cache sets/way */
-#define CONF1_IS_MASK  0x01c00000
-#define CONF1_IS_BASE  64
-
-#define Index_Invalidate_I     0x00
-#define Index_Writeback_Inv_D   0x01
-
-LEAF(_start)
-       
-       .set    mips32
-       .set noreorder
-
-       /* save argument registers */
-       move t4, a0
-       move t5, a1
-       move t6, a2
-       move t7, a3
-       
-       /* set up stack */
-       li      sp, 0xa0000000 + RAMSIZE - 16
-
-#ifdef IMAGE_COPY
-       /* Copy decompressor code to the right place */
-       li  t2, LOADADDR
-       add a0, t2, 0
-       la  a1, code_start
-       la  a2, code_stop
-$L1:
-       lw  t0, 0(a1)
-       sw  t0, 0(a0)
-       add a1, 4
-       add a0, 4
-       blt a1, a2, $L1
-       nop
-#endif
-
-       /* At this point we need to invalidate dcache and */
-       /* icache before jumping to new code */
-
-1:     /* Get cache sizes */
-       mfc0    s0,C0_CONFIG,1
-
-       li      s1,CONF1_DL_MASK
-       and     s1,s0
-       beq     s1,zero,nodc
-       nop
-
-       srl     s1,CONF1_DL_SHIFT
-       li      t0,CONF1_DL_BASE
-       sll     s1,t0,s1                /* s1 has D$ cache line size */
-
-       li      s2,CONF1_DA_MASK
-       and     s2,s0
-       srl     s2,CONF1_DA_SHIFT
-       addiu   s2,CONF1_DA_BASE        /* s2 now has D$ associativity */
-
-       li      t0,CONF1_DS_MASK
-       and     t0,s0
-       srl     t0,CONF1_DS_SHIFT
-       li      s3,CONF1_DS_BASE
-       sll     s3,s3,t0                /* s3 has D$ sets per way */
-
-       multu   s2,s3                   /* sets/way * associativity */
-       mflo    t0                      /* total cache lines */
-
-       multu   s1,t0                   /* D$ linesize * lines */
-       mflo    s2                      /* s2 is now D$ size in bytes */
-
-       /* Initilize the D$: */
-       mtc0    zero,C0_TAGLO
-       mtc0    zero,C0_TAGHI
-
-       li      t0,KSEG0                /* Just an address for the first $ line */
-       addu    t1,t0,s2                /*  + size of cache == end */
-
-1:     cache   Index_Writeback_Inv_D,0(t0)
-       bne     t0,t1,1b
-       addu    t0,s1
-       
-nodc:
-       /* Now we get to do it all again for the I$ */
-       
-       move    s3,zero                 /* just in case there is no icache */
-       move    s4,zero
-
-       li      t0,CONF1_IL_MASK
-       and     t0,s0
-       beq     t0,zero,noic
-       nop
-
-       srl     t0,CONF1_IL_SHIFT
-       li      s3,CONF1_IL_BASE
-       sll     s3,t0                   /* s3 has I$ cache line size */
-
-       li      t0,CONF1_IA_MASK
-       and     t0,s0
-       srl     t0,CONF1_IA_SHIFT
-       addiu   s4,t0,CONF1_IA_BASE     /* s4 now has I$ associativity */
-
-       li      t0,CONF1_IS_MASK
-       and     t0,s0
-       srl     t0,CONF1_IS_SHIFT
-       li      s5,CONF1_IS_BASE
-       sll     s5,t0                   /* s5 has I$ sets per way */
-
-       multu   s4,s5                   /* sets/way * associativity */
-       mflo    t0                      /* s4 is now total cache lines */
-
-       multu   s3,t0                   /* I$ linesize * lines */
-       mflo    s4                      /* s4 is cache size in bytes */
-
-       /* Initilize the I$: */
-       mtc0    zero,C0_TAGLO
-       mtc0    zero,C0_TAGHI
-
-       li      t0,KSEG0                /* Just an address for the first $ line */
-       addu    t1,t0,s4                /*  + size of cache == end */
-
-1:     cache   Index_Invalidate_I,0(t0)
-       bne     t0,t1,1b
-       addu    t0,s3
-noic:
-       /* jump to main */
-       move    a0,s3                   /* icache line size */
-       move    a1,s4                   /* icache size */
-       move    a2,s1                   /* dcache line size */
-#ifdef IMAGE_COPY
-       jal             t2
-#else
-       jal     entry
-#endif
-       move    a3,s2                   /* dcache size */
-
-       .set reorder
-END(_start)
-
diff --git a/target/linux/image/generic/lzma-loader/src/uart16550.c b/target/linux/image/generic/lzma-loader/src/uart16550.c
deleted file mode 100644 (file)
index 7df5727..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-
-#include "uart16550.h"
-
-/* === CONFIG === */
-
-#define         BASE                    0xb8058000
-#define         MAX_BAUD                1152000
-#define         REG_OFFSET              4
-
-/* === END OF CONFIG === */
-
-/* register offset */
-#define         OFS_RCV_BUFFER          (0*REG_OFFSET)
-#define         OFS_TRANS_HOLD          (0*REG_OFFSET)
-#define         OFS_SEND_BUFFER         (0*REG_OFFSET)
-#define         OFS_INTR_ENABLE         (1*REG_OFFSET)
-#define         OFS_INTR_ID             (2*REG_OFFSET)
-#define         OFS_DATA_FORMAT         (3*REG_OFFSET)
-#define         OFS_LINE_CONTROL        (3*REG_OFFSET)
-#define         OFS_MODEM_CONTROL       (4*REG_OFFSET)
-#define         OFS_RS232_OUTPUT        (4*REG_OFFSET)
-#define         OFS_LINE_STATUS         (5*REG_OFFSET)
-#define         OFS_MODEM_STATUS        (6*REG_OFFSET)
-#define         OFS_RS232_INPUT         (6*REG_OFFSET)
-#define         OFS_SCRATCH_PAD         (7*REG_OFFSET)
-
-#define         OFS_DIVISOR_LSB         (0*REG_OFFSET)
-#define         OFS_DIVISOR_MSB         (1*REG_OFFSET)
-
-
-/* memory-mapped read/write of the port */
-#define         UART16550_READ(y)    (*((volatile uint32*)(BASE + y)))
-#define         UART16550_WRITE(y, z)  ((*((volatile uint32*)(BASE + y))) = z)
-
-#define DEBUG_LED (*(unsigned short*)0xb7ffffc0)
-#define OutputLED(x)  (DEBUG_LED = x)
-
-void Uart16550Init(uint32 baud, uint8 data, uint8 parity, uint8 stop)
-{
-    /* disable interrupts */
-    UART16550_WRITE(OFS_INTR_ENABLE, 0);
-
-    /* set up buad rate */
-    { 
-        uint32 divisor;
-       
-        /* set DIAB bit */
-        UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
-        
-        /* set divisor */
-        divisor = MAX_BAUD / baud;
-        UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
-        UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00)>>8);
-
-        /* clear DIAB bit */
-        UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
-    }
-
-    /* set data format */
-    UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
-}
-
-uint8 Uart16550GetPoll()
-{
-    while((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
-    return UART16550_READ(OFS_RCV_BUFFER);
-}
-
-
-void Uart16550Put(uint8 byte)
-{
-    while ((UART16550_READ(OFS_LINE_STATUS) &0x20) == 0);
-    UART16550_WRITE(OFS_SEND_BUFFER, byte);
-}
-
diff --git a/target/linux/image/generic/lzma-loader/src/uart16550.h b/target/linux/image/generic/lzma-loader/src/uart16550.h
deleted file mode 100644 (file)
index b3fd6fd..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef _uart16550_h_
-#define _uart16550_h_
-
-typedef         unsigned char uint8;
-typedef         unsigned int  uint32;
-
-#define         UART16550_BAUD_2400             2400
-#define         UART16550_BAUD_4800             4800
-#define         UART16550_BAUD_9600             9600
-#define         UART16550_BAUD_19200            19200
-#define         UART16550_BAUD_38400            38400
-#define         UART16550_BAUD_57600            57600
-#define         UART16550_BAUD_115200           115200
-
-#define         UART16550_PARITY_NONE           0
-#define         UART16550_PARITY_ODD            0x08
-#define         UART16550_PARITY_EVEN           0x18
-#define         UART16550_PARITY_MARK           0x28
-#define         UART16550_PARITY_SPACE          0x38
-
-#define         UART16550_DATA_5BIT             0x0
-#define         UART16550_DATA_6BIT             0x1
-#define         UART16550_DATA_7BIT             0x2
-#define         UART16550_DATA_8BIT             0x3
-
-#define         UART16550_STOP_1BIT             0x0
-#define         UART16550_STOP_2BIT             0x4
-
-void Uart16550Init(uint32 baud, uint8 data, uint8 parity, uint8 stop);
-
-/* blocking call */
-uint8 Uart16550GetPoll();
-
-void Uart16550Put(uint8 byte);
-
-#endif
diff --git a/target/linux/image/rb532/Makefile b/target/linux/image/rb532/Makefile
deleted file mode 100644 (file)
index bba8952..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-LOADADDR = 0x81000000          # RAM start + 16M 
-KERNEL_ENTRY = 0x80101000
-RAMSIZE = 0x00100000           # 1MB
-IMAGE_COPY = 1
-
-LOADER_MAKEOPTS= \
-               KDIR=$(KDIR) \
-               LOADADDR=$(LOADADDR) \
-               KERNEL_ENTRY=$(KERNEL_ENTRY) \
-               RAMSIZE=$(RAMSIZE) \
-               IMAGE_COPY=$(IMAGE_COPY)
-
-define Build/Clean
-       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
-endef
-
-define Image/Prepare
-       cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
-       $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
-endef
-
-define Image/BuildKernel
-       $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
-endef
-
-PARTITION1=\x80\x01\x01\x00\x27\x01\x20\x7b\x20\x00\x00\x00\xe0\x1e\x00\x00# 4 MB  (kernel part)
-PARTITION2=\x00\x00\x01\x7c\x83\x01\xa0\x64\x00\x1f\x00\x00\x40\x7a\x00\x00# 16 MB (rootfs part)
-
-define Image/Build/jffs2-128k
-       ( \
-               echo -ne OWRT | dd bs=$$$$((0x1be)) conv=sync; \
-               ( \
-                       echo -ne '$(strip $(PARTITION1))'; \
-                       echo -ne '$(strip $(PARTITION2))'; \
-               ) | dd bs=$$$$((0x40)) conv=sync; \
-               echo -ne '\x55\xaa'; \
-               dd if=/dev/zero bs=$$$$((0x3e00)) conv=sync count=1; \
-               dd if=$(KDIR)/loader.elf bs=$$$$((0x3dc000)) conv=sync; \
-               cat $(KDIR)/root.$(1); \
-               echo -ne '\xde\xad\xc0\xde'; \
-       ) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
-endef
-
-define Image/Build
-       $(call Image/Build/$(1),$(1))
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/x86/Makefile b/target/linux/image/x86/Makefile
deleted file mode 100644 (file)
index e4b3a9e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Image/Build
-       cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
-       cp $(KDIR)/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/image/xscale/Makefile b/target/linux/image/xscale/Makefile
deleted file mode 100644 (file)
index 683c602..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Image/Build
-ifneq ($(FS),jffs2-64k)
-       cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
-       cp $(KDIR)/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
-endif
-endef
-
-$(eval $(call BuildImage))
This page took 0.248508 seconds and 4 git commands to generate.