diff options
Diffstat (limited to 'openwrt/target/linux/image')
48 files changed, 0 insertions, 5189 deletions
diff --git a/openwrt/target/linux/image/Makefile b/openwrt/target/linux/image/Makefile deleted file mode 100644 index e64efbf35..000000000 --- a/openwrt/target/linux/image/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -include $(TOPDIR)/rules.mk - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - -ifeq ($(BR2_TARGET_ROOTFS_JFFS2),y) -include ./jffs2.mk -endif - -ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS_LZMA),y) -include ./squashfs.mk -endif - -ifeq ($(BR2_TARGET_ROOTFS_TGZ),y) -include ./tgz.mk -endif - -prepare: - $(MAKE) prepare-targets $(MAKE_TRACE) -compile: - $(MAKE) compile-targets $(MAKE_TRACE) -install: - $(MAKE) install-targets $(MAKE_TRACE) - -.PHONY: prepare compile install - -$(BOARD)-compile: - @$(TRACE) target/linux/image/$(BOARD)-prepare - $(MAKE) -C $(BOARD) prepare - @$(TRACE) target/linux/image/$(BOARD)-compile - $(MAKE) -C $(BOARD) compile - -install-ib: - @$(TRACE) target/linux/image/$(BOARD)-install-ib - -$(MAKE) -C $(BOARD) IB_DIR="$(IB_DIR)" install-ib - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/kernel[-_]*.ipk $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ - -install-prepare: - find $(KDIR)/root -type f -not -perm +0100 | xargs chmod 0644 - find $(KDIR)/root -type f -perm +0100 | xargs chmod 0755 - find $(KDIR)/root -type d | xargs chmod 0755 - mkdir -p $(KDIR)/root/tmp - chmod 0777 $(KDIR)/root/tmp - -rebuild: clean prepare compile install -clean: - $(MAKE) clean-targets $(MAKE_TRACE) diff --git a/openwrt/target/linux/image/ar7/Makefile b/openwrt/target/linux/image/ar7/Makefile deleted file mode 100644 index cb29ced02..000000000 --- a/openwrt/target/linux/image/ar7/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -include $(TOPDIR)/rules.mk - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - -PKG_BUILD_DIR:=$(BUILD_DIR)/ar7loader - -ifeq ($(IB),) -LOADADDR := 0x94020000 -KERNEL_ENTRY := 0x${shell nm $(KDIR)/linux-$(KERNEL)*/vmlinux | grep kernel_entry | cut -d' ' -f1} -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): - mkdir -p $(PKG_BUILD_DIR) - -$(PKG_BUILD_DIR)/zimage.script: src/zimage.script.in - sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \ - -e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@ - -$(PKG_BUILD_DIR)/ld.script: src/ld.script.in - sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \ - -e 's/@@LOADADDR@@/$(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 $@ $< - -$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux - cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false) - -$(KDIR)/vmlinux.bin: $(KDIR)/vmlinux.lzma compile - $(TARGET_CROSS)ld -T $(PKG_BUILD_DIR)/zimage.script -r -b binary $< -o $(KDIR)/zimage.o - $(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=$(KERNEL_ENTRY) -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 $@ - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin: $(KDIR)/vmlinux.bin -endif - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin: - $(CP) $(KDIR)/vmlinux.bin $@ - -ifeq ($(FS),jffs2-8MB) -ALIGN:=bs=131072 conv=sync -endif -ifeq ($(FS),jffs2-4MB) -ALIGN:=bs=65536 conv=sync -endif - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin - dd if=$< $(ALIGN) > $@ - cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(FS) >> $@ - -define pattern_template -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin - (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin) | \ - $(STAGING_DIR)/bin/addpattern -p $(1) $(2) -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin -endef - -define sercomm_template -$(BIN_DIR)/openwrt-$(1)-$(KERNEL)-$(FS).img: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin - cat sercomm/adam2.bin "$$^" > "$$@.tmp" - dd if=sercomm/$(1) of="$$@.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc - $(STAGING_DIR)/bin/dgfirmware -f -w "$$@" "$$@.tmp" - rm -f "$$@.tmp" - -install: $(BIN_DIR)/openwrt-$(1)-$(KERNEL)-$(FS).img -endef - -$(eval $(call sercomm_template,dg834)) -$(eval $(call sercomm_template,jdr454wb)) - -$(eval $(call pattern_template,AG1B)) -$(eval $(call pattern_template,WA22)) -$(eval $(call pattern_template,WAG2)) -$(eval $(call pattern_template,WA21)) -$(eval $(call pattern_template,WA31,-b)) -$(eval $(call pattern_template,WA32,-b)) - -ifeq ($(IB),) -clean: - rm -rf $(PKG_BUILD_DIR) - rm -f $(BIN_DIR)/openwrt-$(BOARD)* - -prepare: $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/zimage.script $(PKG_BUILD_DIR)/ld.script -compile: prepare $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin -else -clean: -prepare: -compile: -endif - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin -install-ib: - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(KDIR)/vmlinux.bin $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ - mkdir -p $(IB_DIR)/staging_dir_$(ARCH) - $(CP) $(STAGING_DIR)/bin/addpattern $(IB_DIR)/staging_dir_$(ARCH)/bin/ - $(CP) $(STAGING_DIR)/bin/dgfirmware $(IB_DIR)/staging_dir_$(ARCH)/bin/ - diff --git a/openwrt/target/linux/image/ar7/sercomm/adam2.bin b/openwrt/target/linux/image/ar7/sercomm/adam2.bin Binary files differdeleted file mode 100644 index d4aa0cd2d..000000000 --- a/openwrt/target/linux/image/ar7/sercomm/adam2.bin +++ /dev/null diff --git a/openwrt/target/linux/image/ar7/sercomm/dg834 b/openwrt/target/linux/image/ar7/sercomm/dg834 Binary files differdeleted file mode 100644 index 61fe336e8..000000000 --- a/openwrt/target/linux/image/ar7/sercomm/dg834 +++ /dev/null diff --git a/openwrt/target/linux/image/ar7/sercomm/jdr454wb b/openwrt/target/linux/image/ar7/sercomm/jdr454wb Binary files differdeleted file mode 100644 index 821ff1c1a..000000000 --- a/openwrt/target/linux/image/ar7/sercomm/jdr454wb +++ /dev/null diff --git a/openwrt/target/linux/image/ar7/src/LzmaDecode.c b/openwrt/target/linux/image/ar7/src/LzmaDecode.c deleted file mode 100644 index 951700bdd..000000000 --- a/openwrt/target/linux/image/ar7/src/LzmaDecode.c +++ /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/openwrt/target/linux/image/ar7/src/LzmaDecode.h b/openwrt/target/linux/image/ar7/src/LzmaDecode.h deleted file mode 100644 index f58944e3c..000000000 --- a/openwrt/target/linux/image/ar7/src/LzmaDecode.h +++ /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/openwrt/target/linux/image/ar7/src/gzip.h b/openwrt/target/linux/image/ar7/src/gzip.h deleted file mode 100644 index 917e66655..000000000 --- a/openwrt/target/linux/image/ar7/src/gzip.h +++ /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/openwrt/target/linux/image/ar7/src/ld.script.in b/openwrt/target/linux/image/ar7/src/ld.script.in deleted file mode 100644 index 40389e644..000000000 --- a/openwrt/target/linux/image/ar7/src/ld.script.in +++ /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/openwrt/target/linux/image/ar7/src/loader.c b/openwrt/target/linux/image/ar7/src/loader.c deleted file mode 100644 index 22b909d7e..000000000 --- a/openwrt/target/linux/image/ar7/src/loader.c +++ /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/openwrt/target/linux/image/ar7/src/srec2bin.c b/openwrt/target/linux/image/ar7/src/srec2bin.c deleted file mode 100644 index 0eb8b2023..000000000 --- a/openwrt/target/linux/image/ar7/src/srec2bin.c +++ /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/openwrt/target/linux/image/ar7/src/zimage.script.in b/openwrt/target/linux/image/ar7/src/zimage.script.in deleted file mode 100644 index 1a0865b08..000000000 --- a/openwrt/target/linux/image/ar7/src/zimage.script.in +++ /dev/null @@ -1,11 +0,0 @@ - OUTPUT_FORMAT("@@OUTPUT_FORMAT@@") -OUTPUT_ARCH(mips) - SECTIONS -{ - .data : - { - kernelimage = .; - *(.data) - kernelimage_end = .; - } -} diff --git a/openwrt/target/linux/image/aruba/Makefile b/openwrt/target/linux/image/aruba/Makefile deleted file mode 100644 index a2cceaf0c..000000000 --- a/openwrt/target/linux/image/aruba/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -include $(TOPDIR)/rules.mk - -LOADADDR = 0x81000000 # RAM start + 16M -KERNEL_ENTRY = 0x80100000 -RAMSIZE = 0x00100000 # 1MB - -LOADER_MAKEOPTS= \ - KDIR=$(KDIR) \ - LOADADDR=$(LOADADDR) \ - KERNEL_ENTRY=$(KERNEL_ENTRY) \ - RAMSIZE=$(RAMSIZE) - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - -lzma-loader-clean: - $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean - -lzma-loader-prepare: - $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) prepare - -lzma-loader-compile: $(KDIR)/vmlinux.lzma lzma-loader-prepare - $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile - -ifeq ($(IB),) -$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux - cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari: $(KDIR)/vmlinux.lzma -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari -endif - -ifeq ($(KERNEL),2.6) -FSNAME:=$(patsubst jffs2-%,jffs2,$(FS)) - -ifeq ($(FS),jffs2-4MB) -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari: $(KDIR)/loader.elf - ./addVersion -n ArubaOS $(KDIR)/loader.elf $@ version - -ifneq ($(BR2_ARUBA_RAMDISK),y) -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari $(KDIR)/root.$(FS) - @dd if=$< of=$@.tmp bs=655360 conv=sync - @cat $(KDIR)/root.$(FS) >> $@.tmp - @dd if=$@.tmp of=$@ bs=3604480 conv=sync - @rm -f $@.tmp - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin -endif - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari -endif -endif - -ifeq ($(IB),) -clean: lzma-loader-clean -prepare: lzma-loader-prepare -compile: lzma-loader-compile -else -clean: -prepare: -compile: -endif -install-ib: - mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(KDIR)/loader.elf $(IB_DIR)/build_$(ARCH)/ - $(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ diff --git a/openwrt/target/linux/image/aruba/addVersion b/openwrt/target/linux/image/aruba/addVersion Binary files differdeleted file mode 100755 index 796f73ad1..000000000 --- a/openwrt/target/linux/image/aruba/addVersion +++ /dev/null diff --git a/openwrt/target/linux/image/aruba/version b/openwrt/target/linux/image/aruba/version deleted file mode 100644 index fff5589e1..000000000 --- a/openwrt/target/linux/image/aruba/version +++ /dev/null @@ -1 +0,0 @@ -3.0.0.0 diff --git a/openwrt/target/linux/image/au1000/Makefile b/openwrt/target/linux/image/au1000/Makefile deleted file mode 100644 index c7158ca76..000000000 --- a/openwrt/target/linux/image/au1000/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -include $(TOPDIR)/rules.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) - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - -lzma-loader-clean: - $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean - -lzma-loader-prepare: - $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) prepare - -lzma-loader-compile: $(KDIR)/vmlinux.lzma lzma-loader-prepare - $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile - -ifeq ($(IB),) -$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux - cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false) - -install: $(KDIR)/vmlinux.lzma -endif - -ifeq ($(FS),jffs2-8MB) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS) - $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec - grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img - grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin -endif - -ifeq ($(FS),tgz) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz - $(CP) $^ $@ - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz - -endif - -ifeq ($(FS),squashfs) -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS) - $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec - grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img - grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img - -endif - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/zImage.flash - $(CP) $^ $@ - -ifeq ($(IB),) -clean: lzma-loader-clean -prepare: lzma-loader-prepare -compile: lzma-loader-compile -else -clean: -prepare: -compile: -endif -install-ib: - mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(KDIR)/loader.elf $(IB_DIR)/build_$(ARCH)/ - $(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ - $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/loader.elf $(KDIR)/loader.srec - grep -v S0 $(KDIR)/loader.srec > $(KDIR)/kernel.srec diff --git a/openwrt/target/linux/image/brcm/Makefile b/openwrt/target/linux/image/brcm/Makefile deleted file mode 100644 index 0fe3ceeac..000000000 --- a/openwrt/target/linux/image/brcm/Makefile +++ /dev/null @@ -1,135 +0,0 @@ -include $(TOPDIR)/rules.mk - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - -lzma-loader-clean: - $(MAKE) -C lzma-loader clean - -lzma-loader-prepare: - $(MAKE) -C lzma-loader prepare - -lzma-loader-compile: lzma-loader-prepare - $(MAKE) -C lzma-loader compile - -ifeq ($(IB),) -$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux - cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false) - -$(KDIR)/loader.tmp.gz: compile -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/vmlinux.lzma -endif - -ifeq ($(FS),jffs2-8MB) -TRXALIGN:=-a 0x20000 -endif -ifeq ($(FS),jffs2-4MB) -TRXALIGN:=-a 0x10000 -endif -# see ticket #155 -ifeq ($(FS),squashfs) -TRXALIGN:=-a 1024 -endif - - -$(KDIR)/loader.tmp.gz: - $(CP) $(BUILD_DIR)/loader.gz $@ - echo -ne "\\x00" >> $@ - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/loader.tmp.gz - $(STAGING_DIR)/bin/trx -o $@ $(KDIR)/loader.tmp.gz $(KDIR)/vmlinux.lzma $(TRXALIGN) $(KDIR)/root.$(FS) - -ifeq ($(KERNEL),2.6) -FSNAME:=$(patsubst jffs2-%,jffs2,$(FS)) - -ifneq ($(FS),jffs2-4MB) -$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - dd if=$(BUILD_DIR)/loader.elf of=$@ bs=131072 conv=sync - cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx >> $@ - -$(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g - -install: $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin - -endif - -ifneq ($(FS),jffs2-8MB) -$(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54F -v v1.99.5 -i $< -o $@ -g - -$(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g - -$(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.2 -i $< -o $@ -g - -install: $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin - -endif -endif - -ifeq ($(KERNEL),2.4) -FSNAME:=$(patsubst jffs2-%,jffs2,$(FS)) - -# ifeq ($(FS),squashfs) -# $(BIN_DIR)/openwrt-wap54g-$(KERNEL)-$(FSNAME).trx: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx -# $(CP) $< $@ -# echo -ne '\x01' >> $@ -# -# install: $(BIN_DIR)/openwrt-wap54g-$(KERNEL)-$(FSNAME).trx -# endif - -ifneq ($(FS),jffs2-8MB) -$(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54F -v v1.99.5 -i $< -o $@ -g - -$(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g - -$(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.2 -i $< -o $@ -g - -$(BIN_DIR)/openwrt-wr850g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/motorola-bin -1 $< $@ - -$(BIN_DIR)/openwrt-wa840g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/motorola-bin -2 $< $@ - -$(BIN_DIR)/openwrt-we800g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/motorola-bin -3 $< $@ - -install: $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wr850g-$(FSNAME).bin $(BIN_DIR)/openwrt-wa840g-$(FSNAME).bin $(BIN_DIR)/openwrt-we800g-$(FSNAME).bin -endif - -ifneq ($(FS),jffs2-4MB) -$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - dd if=$(BUILD_DIR)/loader.elf of=$@ bs=131072 conv=sync - cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx >> $@ - -$(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g - -$(BIN_DIR)/openwrt-wrtsl54gs-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx - $(STAGING_DIR)/bin/addpattern -4 -p W54U -v v2.00.0 -i $< -o $@ -g - -install: $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrtsl54gs-$(FSNAME).bin -endif -endif - -ifeq ($(IB),) -clean: lzma-loader-clean -prepare: lzma-loader-prepare -compile: lzma-loader-compile -else -clean: -prepare: -compile: -endif -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx -install-ib: - mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin - $(CP) $(STAGING_DIR)/bin/addpattern $(STAGING_DIR)/bin/trx $(STAGING_DIR)/bin/motorola-bin $(IB_DIR)/staging_dir_$(ARCH)/bin - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(BUILD_DIR)/loader.gz $(IB_DIR)/build_$(ARCH)/ - $(CP) $(BUILD_DIR)/loader.elf $(IB_DIR)/build_$(ARCH)/ - $(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ diff --git a/openwrt/target/linux/image/brcm/lzma-loader/Makefile b/openwrt/target/linux/image/brcm/lzma-loader/Makefile deleted file mode 100644 index 1d7b6a319..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# $Id$ - -include $(TOPDIR)/rules.mk - -PKG_NAME := loader -PKG_VERSION := 0.04 - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) - -$(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) - -$(BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/loader.gz - $(CP) $< $@ - -$(BUILD_DIR)/loader.elf: $(PKG_BUILD_DIR)/loader.o - $(CP) $< $@ - -source: -prepare: $(PKG_BUILD_DIR)/.prepared -compile: $(BUILD_DIR)/loader.gz $(BUILD_DIR)/loader.elf -install: - -clean: - rm -rf $(PKG_BUILD_DIR) - rm -f $(BUILD_DIR)/loader.gz diff --git a/openwrt/target/linux/image/brcm/lzma-loader/src/LzmaDecode.c b/openwrt/target/linux/image/brcm/lzma-loader/src/LzmaDecode.c deleted file mode 100644 index 951700bdd..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/LzmaDecode.c +++ /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/openwrt/target/linux/image/brcm/lzma-loader/src/LzmaDecode.h b/openwrt/target/linux/image/brcm/lzma-loader/src/LzmaDecode.h deleted file mode 100644 index f58944e3c..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/LzmaDecode.h +++ /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/openwrt/target/linux/image/brcm/lzma-loader/src/Makefile b/openwrt/target/linux/image/brcm/lzma-loader/src/Makefile deleted file mode 100644 index 92916d8cb..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/Makefile +++ /dev/null @@ -1,74 +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 - -# Don't build dependencies, this may die if $(CC) isn't gcc -dep: - -install: - -loader.gz: loader - gzip -nc9 $< > $@ - -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/openwrt/target/linux/image/brcm/lzma-loader/src/README b/openwrt/target/linux/image/brcm/lzma-loader/src/README deleted file mode 100644 index 16649e950..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/README +++ /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/openwrt/target/linux/image/brcm/lzma-loader/src/decompress.c b/openwrt/target/linux/image/brcm/lzma-loader/src/decompress.c deleted file mode 100644 index ec510e21e..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/decompress.c +++ /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/openwrt/target/linux/image/brcm/lzma-loader/src/decompress.lds.in b/openwrt/target/linux/image/brcm/lzma-loader/src/decompress.lds.in deleted file mode 100644 index 33f56f8a0..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/decompress.lds.in +++ /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/openwrt/target/linux/image/brcm/lzma-loader/src/head.S b/openwrt/target/linux/image/brcm/lzma-loader/src/head.S deleted file mode 100644 index 9bfbd53d5..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/head.S +++ /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/openwrt/target/linux/image/brcm/lzma-loader/src/loader.lds.in b/openwrt/target/linux/image/brcm/lzma-loader/src/loader.lds.in deleted file mode 100644 index 20f2ea98e..000000000 --- a/openwrt/target/linux/image/brcm/lzma-loader/src/loader.lds.in +++ /dev/null @@ -1,17 +0,0 @@ -OUTPUT_ARCH(mips) -ENTRY(startup) -SECTIONS { - . = TEXT_START; - .text : { - *(.text) - *(.rodata) - } - - .data : { - *(.data) - } - - .bss : { - *(.bss) - } -} diff --git a/openwrt/target/linux/image/generic/lzma-loader/Makefile b/openwrt/target/linux/image/generic/lzma-loader/Makefile deleted file mode 100644 index 089254bba..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/Makefile +++ /dev/null @@ -1,36 +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) - - -$(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/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.c b/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.c deleted file mode 100644 index aac5f60c0..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.c +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.h b/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.h deleted file mode 100644 index 35e37ed0d..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.h +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/Makefile b/openwrt/target/linux/image/generic/lzma-loader/src/Makefile deleted file mode 100644 index 8dfd76a6a..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -LOADADDR = 0x80400000 # RAM start + 4M -KERNEL_ENTRY = 0x80001000 -RAMSIZE = 0x00100000 # 1MB - -CROSS_COMPILE = mips-linux- - -.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 -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump - -CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} -D_LZMA_IN_CB -# CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE} - -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' $< >$@ - -kernel.o: vmlinux.lzma lzma.lds - $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $< - -lzma.elf: start.o decompress.o LzmaDecode.o kernel.o - $(LD) -s -Tlzma.lds -o $@ $^ - -clean: - rm -f *.o lzma.elf diff --git a/openwrt/target/linux/image/generic/lzma-loader/src/decompress.c b/openwrt/target/linux/image/generic/lzma-loader/src/decompress.c deleted file mode 100644 index f602276dd..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/decompress.c +++ /dev/null @@ -1,147 +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 */ - - 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 (*)(void)) KERNEL_ENTRY)(); - } -} diff --git a/openwrt/target/linux/image/generic/lzma-loader/src/lzma.lds.in b/openwrt/target/linux/image/generic/lzma-loader/src/lzma.lds.in deleted file mode 100644 index 5ac555bf7..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/lzma.lds.in +++ /dev/null @@ -1,23 +0,0 @@ -OUTPUT_ARCH(mips) -ENTRY(_start) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = @LOADADDR@; - .text : - { - _ftext = . ; - *(.text) - *(.rodata) - lzma_start = .; - kernel.o - lzma_end = .; - } =0 - - .reginfo : { *(.reginfo) } - - .bss : - { - *(.bss) - } -} diff --git a/openwrt/target/linux/image/generic/lzma-loader/src/print.c b/openwrt/target/linux/image/generic/lzma-loader/src/print.c deleted file mode 100644 index 950687bef..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/print.c +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/print.h b/openwrt/target/linux/image/generic/lzma-loader/src/print.h deleted file mode 100644 index b05146390..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/print.h +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/printf.c b/openwrt/target/linux/image/generic/lzma-loader/src/printf.c deleted file mode 100644 index 49bd50d7c..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/printf.c +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/printf.h b/openwrt/target/linux/image/generic/lzma-loader/src/printf.h deleted file mode 100644 index 9b1c1df23..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/printf.h +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/start.S b/openwrt/target/linux/image/generic/lzma-loader/src/start.S deleted file mode 100644 index 37c7ca36d..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/start.S +++ /dev/null @@ -1,136 +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 - - /* set up stack */ - li sp, 0xa0000000 + RAMSIZE - 16 - - - /* 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 */ - jal entry - move a3,s2 /* dcache size */ - - .set reorder -END(_start) - diff --git a/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.c b/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.c deleted file mode 100644 index 7df572760..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.c +++ /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/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.h b/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.h deleted file mode 100644 index b3fd6fdd7..000000000 --- a/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.h +++ /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/openwrt/target/linux/image/jffs2.mk b/openwrt/target/linux/image/jffs2.mk deleted file mode 100644 index 281db0192..000000000 --- a/openwrt/target/linux/image/jffs2.mk +++ /dev/null @@ -1,46 +0,0 @@ -ifneq ($(BR2_BIG_ENDIAN),y) -JFFS2OPTS := --pad --little-endian --squash -else -JFFS2OPTS := --pad --big-endian --squash -endif - -#JFFS2OPTS += -Xlzo -msize -Xlzari - -jffs2-prepare: - $(MAKE) -C jffs2 prepare $(MAKE_TRACE) - -jffs2-compile: prepare-targets - $(MAKE) -C jffs2 compile $(MAKE_TRACE) - -jffs2-clean: - $(MAKE) -C jffs2 clean $(MAKE_TRACE) - rm -f $(KDIR)/root.jffs2* - -$(KDIR)/root.jffs2-4MB: install-prepare - @rm -rf $(KDIR)/root/jffs - $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $@ -d $(KDIR)/root $(MAKE_TRACE) - -$(KDIR)/root.jffs2-8MB: install-prepare - @rm -rf $(KDIR)/root/jffs - $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $@ -d $(KDIR)/root $(MAKE_TRACE) - -ifeq ($(IB),) -jffs2-install: compile-targets $(BOARD)-compile -endif - -jffs2-install: $(KDIR)/root.jffs2-4MB $(KDIR)/root.jffs2-8MB - $(TRACE) target/linux/image/$(BOARD)/install - $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-4MB" - $(TRACE) target/linux/image/$(BOARD)/install - $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-8MB" - -jffs2-install-ib: compile-targets - mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin - $(CP) $(STAGING_DIR)/bin/mkfs.jffs2 $(IB_DIR)/staging_dir_$(ARCH)/bin - -prepare-targets: jffs2-prepare -compile-targets: jffs2-compile -install-targets: jffs2-install -install-ib: jffs2-install-ib -clean-targets: jffs2-clean - diff --git a/openwrt/target/linux/image/jffs2/Makefile b/openwrt/target/linux/image/jffs2/Makefile deleted file mode 100644 index 071bacdd4..000000000 --- a/openwrt/target/linux/image/jffs2/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include $(TOPDIR)/rules.mk - -MTD_DIR:=$(BUILD_DIR)/mtd-20050122.orig -MTD_SOURCE=mtd_20050122.orig.tar.gz -MTD_SITE=http://ftp.debian.org/debian/pool/main/m/mtd -MTD_MD5SUM:=1f42c2cae08eb9e7b52d0c188f8d6338 -MKFS_JFFS2=$(MTD_DIR)/util/mkfs.jffs2 - -$(DL_DIR)/$(MTD_SOURCE): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(MTD_SOURCE) $(MTD_MD5SUM) $(MTD_SITE) - -$(MTD_DIR)/.unpacked: $(DL_DIR)/$(MTD_SOURCE) - zcat $(DL_DIR)/$(MTD_SOURCE) | tar -C $(BUILD_DIR) -xvf - - $(PATCH) $(MTD_DIR) ./patches - touch $(MTD_DIR)/.unpacked - -$(MTD_DIR)/util/mkfs.jffs2: $(MTD_DIR)/.unpacked - $(MAKE) LINUXDIR=$(LINUX_DIR) -C $(MTD_DIR)/util - -$(STAGING_DIR)/bin/mkfs.jffs2: $(MTD_DIR)/util/mkfs.jffs2 - $(CP) $< $@ - -source: $(DL_DIR)/$(MTD_SOURCE) -prepare: $(MTD_DIR)/.unpacked -compile: $(MTD_DIR)/util/mkfs.jffs2 $(STAGING_DIR)/bin/mkfs.jffs2 -install: -clean: - rm -rf $(MTD_DIR) - diff --git a/openwrt/target/linux/image/jffs2/patches/gcc4-fix.patch b/openwrt/target/linux/image/jffs2/patches/gcc4-fix.patch deleted file mode 100644 index 50c8edb47..000000000 --- a/openwrt/target/linux/image/jffs2/patches/gcc4-fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -urN mtd-20050122.orig.old/include/mtd/jffs2-user.h mtd-20050122.orig.dev/include/mtd/jffs2-user.h ---- mtd-20050122.orig.old/include/mtd/jffs2-user.h 2004-05-05 13:57:54.000000000 +0200 -+++ mtd-20050122.orig.dev/include/mtd/jffs2-user.h 2005-07-02 10:03:09.000000000 +0200 -@@ -19,8 +19,6 @@ - #undef je32_to_cpu - #undef jemode_to_cpu - --extern int target_endian; -- - #define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) - #define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) - -diff -urN mtd.old/util/jffs3.h mtd.dev/util/jffs3.h ---- mtd.old/util/jffs3.h 2005-01-22 00:00:13.000000000 +0100 -+++ mtd.dev/util/jffs3.h 2005-07-17 17:48:24.000000000 +0200 -@@ -177,8 +177,6 @@ - #undef je32_to_cpu - #undef jemode_to_cpu - --extern int target_endian; -- - #define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) - #define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) - diff --git a/openwrt/target/linux/image/squashfs.mk b/openwrt/target/linux/image/squashfs.mk deleted file mode 100644 index 9d344ba5f..000000000 --- a/openwrt/target/linux/image/squashfs.mk +++ /dev/null @@ -1,37 +0,0 @@ -ifneq ($(BR2_BIG_ENDIAN),y) -endian := le -else -endian := be -endif - -squashfs-prepare: - $(MAKE) -C squashfs prepare $(MAKE_TRACE) - -squashfs-compile: prepare-targets - $(MAKE) -C squashfs compile $(MAKE_TRACE) - -squashfs-clean: - $(MAKE) -C squashfs clean $(MAKE_TRACE) - rm -f $(KDIR)/root.squashfs - -$(KDIR)/root.squashfs: install-prepare - @mkdir -p $(KDIR)/root/jffs - $(STAGING_DIR)/bin/mksquashfs-lzma $(KDIR)/root $@ -nopad -noappend -root-owned -$(endian) $(MAKE_TRACE) - -ifeq ($(IB),) -squashfs-install: compile-targets $(BOARD)-compile -endif - -squashfs-install: $(KDIR)/root.squashfs - $(TRACE) target/linux/image/$(BOARD)/install - $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="squashfs" - -squashfs-install-ib: compile-targets - mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin - $(CP) $(STAGING_DIR)/bin/mksquashfs-lzma $(IB_DIR)/staging_dir_$(ARCH)/bin - -prepare-targets: squashfs-prepare -compile-targets: squashfs-compile -install-targets: squashfs-install -install-ib: squashfs-install-ib -clean: squashfs-clean diff --git a/openwrt/target/linux/image/squashfs/Makefile b/openwrt/target/linux/image/squashfs/Makefile deleted file mode 100644 index b5a51f8a3..000000000 --- a/openwrt/target/linux/image/squashfs/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include $(TOPDIR)/rules.mk - -SQUASHFSLZMA_DIR=$(BUILD_DIR)/squashfs3.0 -SQUASHFSLZMA_SOURCE=squashfs3.0.tar.gz -SQUASHFSLZMA_SITE=@SF/squashfs -SQUASHFSLZMA_MD5SUM=9fd05d0bfbb712f5fb95edafea5bc733 - -$(DL_DIR)/$(SQUASHFSLZMA_SOURCE): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(SQUASHFSLZMA_SOURCE) $(SQUASHFSLZMA_MD5SUM) $(SQUASHFSLZMA_SITE) - -$(SQUASHFSLZMA_DIR)/.unpacked: $(DL_DIR)/$(SQUASHFSLZMA_SOURCE) - zcat $(DL_DIR)/$(SQUASHFSLZMA_SOURCE) | tar -C $(BUILD_DIR) -xvf - - $(PATCH) $(SQUASHFSLZMA_DIR) ./patches - touch $(SQUASHFSLZMA_DIR)/.unpacked - -$(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma: $(SQUASHFSLZMA_DIR)/.unpacked - $(MAKE) -C $(SQUASHFSLZMA_DIR)/squashfs-tools mksquashfs-lzma LZMAPATH=$(BUILD_DIR)/lzma - -$(STAGING_DIR)/bin/mksquashfs-lzma: $(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma - $(CP) $< $@ - -source: $(DL_DIR)/$(SQUASHFSLZMA_SOURCE) -prepare: $(SQUASHFSLZMA_DIR)/.unpacked -compile: $(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma $(STAGING_DIR)/bin/mksquashfs-lzma -install: -clean: - rm -rf $(SQUASHFSLZMA_DIR) diff --git a/openwrt/target/linux/image/squashfs/patches/100-lzma.patch b/openwrt/target/linux/image/squashfs/patches/100-lzma.patch deleted file mode 100644 index 85aa21fb9..000000000 --- a/openwrt/target/linux/image/squashfs/patches/100-lzma.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Nur squashfs3.0/squashfs-tools/Makefile squashfs3.0-owrt/squashfs-tools/Makefile ---- squashfs3.0/squashfs-tools/Makefile 2006-03-15 22:36:20.000000000 +0100 -+++ squashfs3.0-owrt/squashfs-tools/Makefile 2006-03-21 11:14:08.000000000 +0100 -@@ -1,4 +1,5 @@ - INCLUDEDIR = . -+#LZMAPATH = ../lzma/SRC/7zip/Compress/LZMA_Lib - - CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 - -@@ -7,6 +8,9 @@ - mksquashfs: mksquashfs.o read_fs.o sort.o - $(CC) mksquashfs.o read_fs.o sort.o -lz -o $@ - -+mksquashfs-lzma: mksquashfs.o read_fs.o sort.o -+ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma -o $@ -+ - mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h - - read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h -@@ -17,3 +21,5 @@ - $(CC) unsquashfs.o -lz -o $@ - - unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h -+ -+clean: diff --git a/openwrt/target/linux/image/tgz.mk b/openwrt/target/linux/image/tgz.mk deleted file mode 100644 index 3839eb6b4..000000000 --- a/openwrt/target/linux/image/tgz.mk +++ /dev/null @@ -1,14 +0,0 @@ -$(KDIR)/root.tar.gz: - tar -zcf $@ --owner=root --group=root -C $(KDIR)/root/ . - -ifeq ($(BOARD),x86) -install: tgz-install - -tgz-install: $(KDIR)/root.tar.gz - $(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="tgz" -endif - -prepare-targets: -compile-targets: -install-targets: $(KDIR)/root.tar.gz - diff --git a/openwrt/target/linux/image/x86/Makefile b/openwrt/target/linux/image/x86/Makefile deleted file mode 100644 index 5820d022b..000000000 --- a/openwrt/target/linux/image/x86/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include $(TOPDIR)/rules.mk - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - - -ifeq ($(FS),jffs2-8MB) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img: $(KDIR)/root.$(FS) - $(CP) $^ $@ - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img - -endif - - -ifeq ($(FS),tgz) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz - $(CP) $^ $@ - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz - -endif - - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/bzImage - $(CP) $^ $@ - - -clean: -prepare: -compile: -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz -install-ib: - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(KDIR)/bzImage $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ diff --git a/openwrt/target/linux/image/xscale/Makefile b/openwrt/target/linux/image/xscale/Makefile deleted file mode 100644 index 04a89f9b1..000000000 --- a/openwrt/target/linux/image/xscale/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include $(TOPDIR)/rules.mk - -KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) - - -ifeq ($(FS),jffs2-8MB) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img: $(KDIR)/root.$(FS) - $(CP) $^ $@ - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img - -endif - - -ifeq ($(FS),tgz) - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz - $(CP) $^ $@ - -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz - -endif - - -$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/vmlinux - $(CP) $^ $@ - - -clean: -prepare: -compile: -install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz -install-ib: - mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) - $(CP) $(KDIR)/bzImage $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/ |