Changeset 24843


Ignore:
Timestamp:
2010-12-28T09:10:32+01:00 (7 years ago)
Author:
cshore
Message:

[brcm63xx] patches-2.6.35: mtd flashmap: Really fixed sparelen and rootfslen. The real rootfslen for OpenWRT images comes from a bigendian uint32_t in reserved1 of the bcm_tag, which is now used to correctly calculate the rootfslen (and thus the sparelen).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/brcm63xx/patches-2.6.35/040-bcm963xx_flashmap.patch

    r24842 r24843  
    7474--- /dev/null 
    7575+++ b/drivers/mtd/maps/bcm963xx-flash.c 
    76 @@ -0,0 +1,288 @@ 
     76@@ -0,0 +1,276 @@ 
    7777+/* 
    7878+ * Copyright (C) 2006-2008  Florian Fainelli <florian@openwrt.org> 
     
    137137+       size_t retlen; 
    138138+       unsigned int rootfsaddr, kerneladdr, spareaddr; 
    139 +       unsigned int rootfslen, kernellen, sparelen, totallen; 
     139+       unsigned int rootfslen, kernellen, sparelen; 
    140140+       int namelen = 0; 
    141141+       int i, offset; 
    142142+       char *boardid; 
    143 +    char *tagversion; 
    144 +       struct squashfs_super_block sb; 
     143+       char *tagversion; 
    145144+ 
    146145+       /* Allocate memory for buffer */ 
     
    158157+       sscanf(buf->kernelAddress, "%u", &kerneladdr); 
    159158+       sscanf(buf->kernelLength, "%u", &kernellen); 
    160 +       sscanf(buf->totalLength, "%u", &totallen); 
    161 +       sscanf(buf->rootLength, "%u", &rootfslen); 
     159+       rootfslen = *(uint32_t *)(&(buf->rootLength[0])); 
    162160+       tagversion = &(buf->tagVersion[0]); 
    163161+       boardid = &(buf->boardid[0]); 
     
    168166+       rootfsaddr = kerneladdr + kernellen; 
    169167+ 
    170 +       //      offset = master->erasesize + sizeof(struct bcm_tag) + kernellen; 
    171 +       offset = rootfsaddr; 
    172 +       ret = master->read(master, offset, sizeof(sb), &retlen, (void *) &sb); 
    173 +       if (ret || (retlen != sizeof(sb))) { 
    174 +         printk(KERN_ALERT PFX "parse_cfe_partitions: error occured while reading " 
    175 +                        "from \"%s\"\n", master->name); 
    176 +         return -EINVAL; 
    177 +       } 
    178 + 
    179168+       rootfslen = ( ( rootfslen % master->erasesize ) > 0 ? (((rootfslen / master->erasesize) + 1 ) * master->erasesize) : rootfslen); 
    180 +       totallen = rootfslen + kernellen + sizeof(struct bcm_tag); 
    181169+ 
    182170+       spareaddr = rootfsaddr + rootfslen; 
    183 +       sparelen = master->size - totallen - master->erasesize; 
     171+       sparelen = master->size - spareaddr - master->erasesize; 
    184172+ 
    185173+       /* Determine number of partitions */ 
Note: See TracChangeset for help on using the changeset viewer.