Commit 024629fd authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Brian Norris

mtd: bcm47xxpart: find NVRAM partitions in middle blocks

Old devices used to have NVRAM at the very end of flash and they could
be unaligned (starting at some offset in a block).
In new devices NVRAM can be located quite randomly, however it seems to
always start at the beginning of a block. For example Netgear R6250 has
NVRAM located right after the bootloader, before the kernel partition.
Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 022a478c
......@@ -199,6 +199,17 @@ static int bcm47xxpart_parse(struct mtd_info *master,
continue;
}
/*
* New (ARM?) devices may have NVRAM in some middle block. Last
* block will be checked later, so skip it.
*/
if (offset != master->size - blocksize &&
buf[0x000 / 4] == NVRAM_HEADER) {
bcm47xxpart_add_part(&parts[curr_part++], "nvram",
offset, 0);
continue;
}
/* Read middle of the block */
if (mtd_read(master, offset + 0x8000, 0x4,
&bytes_read, (uint8_t *)buf) < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment