diff options
author | Waldemar Brodkorb <mail@waldemar-brodkorb.de> | 2005-04-02 12:12:58 +0000 |
---|---|---|
committer | Waldemar Brodkorb <mail@waldemar-brodkorb.de> | 2005-04-02 12:12:58 +0000 |
commit | 8f80e98934c5bb973caad880bd17fddf709046a3 (patch) | |
tree | 055a93ec854a535cea0fb03637e40e82661918d7 /openwrt/package | |
parent | d2a31e404c9392a3f532a99e20ea65c96493748c (diff) | |
download | mtk-20170518-8f80e98934c5bb973caad880bd17fddf709046a3.zip mtk-20170518-8f80e98934c5bb973caad880bd17fddf709046a3.tar.gz mtk-20170518-8f80e98934c5bb973caad880bd17fddf709046a3.tar.bz2 |
lzma loader patch from oleg, great thanks good work, saves another 300 kb flashmemory
SVN-Revision: 513
Diffstat (limited to 'openwrt/package')
-rw-r--r-- | openwrt/package/Config.in | 1 | ||||
-rw-r--r-- | openwrt/package/Makefile | 1 | ||||
-rw-r--r-- | openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile | 71 | ||||
-rw-r--r-- | openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c | 3 | ||||
-rw-r--r-- | openwrt/package/linux/linux.mk | 2 | ||||
-rw-r--r-- | openwrt/package/openwrt/jffs2root.c | 11 |
6 files changed, 15 insertions, 74 deletions
diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index 3f5afce..8b46c15 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -3,6 +3,7 @@ menu "OpenWrt Package Selection" comment "The default set" +source "package/loader/Config.in" source "package/busybox/Config.in" source "package/dnsmasq/Config.in" source "package/iptables/Config.in" diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 66080a8..429741d 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -19,6 +19,7 @@ package-$(BR2_PACKAGE_IPTABLES) += iptables package-$(BR2_PACKAGE_IPROUTE2) += iproute2 package-$(BR2_PACKAGE_LCD4LINUX) += lcd4linux package-$(BR2_PACKAGE_LIBELF) += libelf +package-$(BR2_PACKAGE_LOADER) += loader package-$(BR2_PACKAGE_LZO) += lzo package-$(BR2_PACKAGE_MATRIXSSL) += matrixssl package-$(BR2_PACKAGE_MICROPERL) += microperl diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile index 4004653..ead9d07 100644 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile +++ b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile @@ -11,40 +11,11 @@ # # $Id$ # -# 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. -# - -# Link at 3 MB offset in RAM -#TEXT_START ?= 0x80300000 -TEXT_START ?= 0x80001000 -BZ_MEM_TOP := 0x81000000 -BZ_TEXT_START := BZ_MEM_TOP-0x4000 -BZ_STACK_TOP := BZ_TEXT_START-4 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S - -SRCBASE := $(TOPDIR)/../.. -VPATH := $(SRCBASE)/shared -ASFLAGS += -D__ASSEMBLY__ -I$(SRCBASE)/include -DLOADADDR=$(LOADADDR) -ASFLAGS += -DBZ_MEM_TOP=$(BZ_MEM_TOP) -ASFLAGS += -DBZ_TEXT_START=$(BZ_TEXT_START) -ASFLAGS += -DBZ_STACK_TOP=$(BZ_STACK_TOP) -CFLAGS += -I$(SRCBASE)/include -DLOADADDR=$(LOADADDR) -CFLAGS += -DBZ_MEM_TOP=$(BZ_MEM_TOP) -CFLAGS += -DBZ_TEXT_START=$(BZ_TEXT_START) -CFLAGS += -DBZ_STACK_TOP=$(BZ_STACK_TOP) -ifdef CONFIG_MCOUNT -CFLAGS := $(subst -pg,,$(CFLAGS)) -endif -CFLAGS += -ffunction-sections $(call check_gcc, -fvtable-gc, ) -SEDFLAGS := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/BZ_MEM_TOP/$(BZ_MEM_TOP)/;s/TEXT_START/$(TEXT_START)/ - SYSTEM ?= $(TOPDIR)/vmlinux -OBJECTS := head.o data.o -all: bzImage vmlinuz +all: vmlinuz # Don't build dependencies, this may die if $(CC) isn't gcc dep: @@ -53,48 +24,10 @@ dep: vmlinuz: piggy gzip -c9 $< > $@ -# Our bzImage is a gzip'd binary that decompresses and runs -# the appended bzip'd kernel. -bzImage: bzLoaderImage.gz piggz - cat bzLoaderImage.gz piggz > $@ - -bzLoaderImage.gz: bzLoaderImage - gzip -nc9 $< > $@ - -bzLoaderImage: bzLoader - $(OBJCOPY) $< $@ - -bzLoader: vmlinux.lds $(OBJECTS) - $(LD) -static --gc-sections -no-warn-mismatch -T vmlinux.lds -o $@ $(OBJECTS) - -vmlinux.lds: vmlinux.lds.in Makefile - @sed "$(SEDFLAGS)" < $< > $@ - -piggz: piggy - bzip2 -c9 $< > $@ - piggy: $(SYSTEM) $(OBJCOPY) $< $@ -data.o: data.lds data.image - $(LD) -no-warn-mismatch -T data.lds -r -o $@ -b binary data.image -b elf32-tradlittlemips - -data.lds: - @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > $@ - -data.image: decompress_bunzip2.image - $(OBJCOPY) $< $@ - -decompress_bunzip2.image: decompress_bunzip2.lds decompress_bunzip2.o - $(LD) -static --gc-sections -no-warn-mismatch -T decompress_bunzip2.lds -o $@ decompress_bunzip2.o - -decompress_bunzip2.lds: decompress_bunzip2.lds.in Makefile - @sed "$(SEDFLAGS)" < $< > $@ - mrproper: clean clean: - rm -f vmlinux vmlinuz piggz piggy *.lds *.o \ - bzLoader bzLoaderImage bzLoaderImage.gz bzImage \ - data.lds data.image \ - decompress_bunzip2.lds decompress_bunzip2.image + rm -f vmlinuz piggy diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c index e1b0050..2132c00 100644 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c +++ b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c @@ -195,7 +195,8 @@ find_root(struct mtd_info *mtd, size_t size, struct mtd_partition *part) /* found a TRX header */ if (le32_to_cpu(trx->magic) == TRX_MAGIC) { - part->offset = le32_to_cpu(trx->offsets[1]); + part->offset = le32_to_cpu(trx->offsets[2]) ? : + le32_to_cpu(trx->offsets[1]); part->size = le32_to_cpu(trx->len); part->size -= part->offset; diff --git a/openwrt/package/linux/linux.mk b/openwrt/package/linux/linux.mk index 02cc3bb..4284c38 100644 --- a/openwrt/package/linux/linux.mk +++ b/openwrt/package/linux/linux.mk @@ -25,7 +25,7 @@ LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2 LINUX_KCONFIG=./linux.config LINUX_PATCHES=./kernel-patches LINUX_KERNEL_SOURCE=./kernel-source -LINUX_BINLOC=arch/$(LINUX_KARCH)/brcm-boards/bcm947xx/compressed/vmlinuz +LINUX_BINLOC=arch/$(LINUX_KARCH)/brcm-boards/bcm947xx/compressed/piggy # Used by pcmcia-cs and others LINUX_SOURCE_DIR=$(LINUX_DIR)-$(LINUX_VERSION) diff --git a/openwrt/package/openwrt/jffs2root.c b/openwrt/package/openwrt/jffs2root.c index e0cbfb9..d79532e 100644 --- a/openwrt/package/openwrt/jffs2root.c +++ b/openwrt/package/openwrt/jffs2root.c @@ -73,6 +73,8 @@ int main(int argc, char **argv) int fd; unsigned long len; struct trx_header *ptr; + unsigned offset; + if (((fd = open(FILENAME, O_RDWR)) < 0) || ((len = lseek(fd, 0, SEEK_END)) < 0) || ((ptr = (struct trx_header *) mmap(0, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *) (-1)) @@ -81,17 +83,20 @@ int main(int argc, char **argv) exit(-1); } + /* treat last partition as rootfs offset */ + offset = ptr->offsets[2] ? : ptr->offsets[1]; + if (argc > 1 && !strcmp(argv[1],"--move")) { - if (ptr->offsets[1] >= ptr->len) { + if (offset >= ptr->len) { printf("Partition already moved outside trx\n"); #if 0 - } else if (ptr->offsets[1] & 0x0001ffff) { + } else if (offset & 0x0001ffff) { printf("Partition does not start on a block boundary\n"); #endif } else { init_crc32(); //bzero((void *)((int)ptr + ptr->len), (size_t)(len - ptr->len)); - ptr->len = ptr->offsets[1]; + ptr->len = offset; ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version)); msync(ptr,len,MS_SYNC|MS_INVALIDATE); printf("Partition moved; please reboot\n"); |