diff options
author | cshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-12-28 08:10:32 +0000 |
---|---|---|
committer | cshore <cshore@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-12-28 08:10:32 +0000 |
commit | 64e304feb6fcc945c1506d8b42ea13ef1aeb97d5 (patch) | |
tree | e78c3c74d74b98da455f5bd587b8b0dcd11befdb /target/linux/brcm63xx | |
parent | 8688d050d645b166a6b0857690c2f0903b95461a (diff) |
[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).
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24843 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx')
-rw-r--r-- | target/linux/brcm63xx/patches-2.6.35/040-bcm963xx_flashmap.patch | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/target/linux/brcm63xx/patches-2.6.35/040-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-2.6.35/040-bcm963xx_flashmap.patch index 5a5ba1283..29c4f8582 100644 --- a/target/linux/brcm63xx/patches-2.6.35/040-bcm963xx_flashmap.patch +++ b/target/linux/brcm63xx/patches-2.6.35/040-bcm963xx_flashmap.patch @@ -73,7 +73,7 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org> +obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o --- /dev/null +++ b/drivers/mtd/maps/bcm963xx-flash.c -@@ -0,0 +1,288 @@ +@@ -0,0 +1,276 @@ +/* + * Copyright (C) 2006-2008 Florian Fainelli <florian@openwrt.org> + * Mike Albon <malbon@openwrt.org> @@ -136,12 +136,11 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org> + int ret; + size_t retlen; + unsigned int rootfsaddr, kerneladdr, spareaddr; -+ unsigned int rootfslen, kernellen, sparelen, totallen; ++ unsigned int rootfslen, kernellen, sparelen; + int namelen = 0; + int i, offset; + char *boardid; -+ char *tagversion; -+ struct squashfs_super_block sb; ++ char *tagversion; + + /* Allocate memory for buffer */ + buf = vmalloc(sizeof(struct bcm_tag)); @@ -157,8 +156,7 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org> + + sscanf(buf->kernelAddress, "%u", &kerneladdr); + sscanf(buf->kernelLength, "%u", &kernellen); -+ sscanf(buf->totalLength, "%u", &totallen); -+ sscanf(buf->rootLength, "%u", &rootfslen); ++ rootfslen = *(uint32_t *)(&(buf->rootLength[0])); + tagversion = &(buf->tagVersion[0]); + boardid = &(buf->boardid[0]); + @@ -167,20 +165,10 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org> + kerneladdr = kerneladdr - EXTENDED_SIZE; + rootfsaddr = kerneladdr + kernellen; + -+ // offset = master->erasesize + sizeof(struct bcm_tag) + kernellen; -+ offset = rootfsaddr; -+ ret = master->read(master, offset, sizeof(sb), &retlen, (void *) &sb); -+ if (ret || (retlen != sizeof(sb))) { -+ printk(KERN_ALERT PFX "parse_cfe_partitions: error occured while reading " -+ "from \"%s\"\n", master->name); -+ return -EINVAL; -+ } -+ + rootfslen = ( ( rootfslen % master->erasesize ) > 0 ? (((rootfslen / master->erasesize) + 1 ) * master->erasesize) : rootfslen); -+ totallen = rootfslen + kernellen + sizeof(struct bcm_tag); + + spareaddr = rootfsaddr + rootfslen; -+ sparelen = master->size - totallen - master->erasesize; ++ sparelen = master->size - spareaddr - master->erasesize; + + /* Determine number of partitions */ + namelen = 8; |