reduce wasted flash space by ~56K on Edimax devices, thanks to Bernhard Held (closes...
authorGabor Juhos <juhosg@openwrt.org>
Fri, 26 Oct 2007 07:51:49 +0000 (07:51 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 26 Oct 2007 07:51:49 +0000 (07:51 +0000)
SVN-Revision: 9450

target/linux/adm5120/files/drivers/mtd/trxsplit.c
target/linux/adm5120/image/router_le.mk

index 19d1e9da97978c623ba658fb8c370cab9e93175b..748ad86d2d860ca08493c2c3f0ee9359cf36857d 100644 (file)
@@ -51,7 +51,7 @@ struct trx_header {
        u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */
 };
 
-#define BLOCK_LEN_MIN          0x10000
+#define TRX_ALIGN      0x1000
 
 static int trx_nr_parts;
 static unsigned long trx_offset;
@@ -104,17 +104,12 @@ err_out:
 static void trxsplit_findtrx(struct mtd_info *mtd)
 {
        unsigned long offset;
-       unsigned long blocklen;
        int err;
 
-       blocklen = mtd->erasesize;
-       if (blocklen < BLOCK_LEN_MIN)
-               blocklen = BLOCK_LEN_MIN;
-
        printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name);
 
        err = 0;
-       for (offset = 0; offset < mtd->size; offset += blocklen) {
+       for (offset = 0; offset < mtd->size; offset += TRX_ALIGN) {
                err = trxsplit_checktrx(mtd, offset);
                if (err == 0)
                        break;
index ec7673f6e36363899dee61650064e739bce7729c..0fc6309407ed757c3c96058978937fb590366a5b 100644 (file)
@@ -14,13 +14,14 @@ define Image/Build/Edimax
        $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
        $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
        $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d -w \
-               -r $(KDIR)/loader-$(2).gz \
+               -r $(KDIR)/loader-$(2).gz::8192 \
                -x $(call imgname,$(1),$(2)).trx \
                $(call imgname,$(1),$(2))-webui.bin
        $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \
-               -r $(KDIR)/loader-$(2).gz \
+               -r $(KDIR)/loader-$(2).gz::8192 \
                -x $(call imgname,$(1),$(2)).trx \
                $(call imgname,$(1),$(2))-xmodem.bin
+       rm -f $(call imgname,$(1),$(2)).trx
 endef
 
 define Image/Build/Infineon