R7800 -> Flashing openwrt causes bootloop (bad block in kernel area)

Likely this part in mtdpart.c (based on grepping for "correct location of partition":
R7800-V1.0.2.44_gpl_src\git_home\linux.git\sourcecode\drivers\mtd\mtdpart.c

static void correct_rootfs_partition(struct mtd_part *slave)
{
	uint64_t rootfs_offset = 0;
	int bad_blocks = 0;

	/* Search rootfs header and reset the offset and size of rootfs partition */
	if (slave->mtd.name && !strcmp(slave->mtd.name, "rootfs") &&
	    !(find_rootfs_header(slave->master, &slave->mtd, &rootfs_offset, &bad_blocks))) {
		slave->offset += rootfs_offset;
		slave->mtd.size -= rootfs_offset;
		if (slave->master->_block_isbad)
			slave->mtd.ecc_stats.badblocks -= bad_blocks;

		printk(KERN_INFO "the correct location of partition \"%s\": 0x%012llx-0x%012llx\n", slave->mtd.name,
		       (unsigned long long)slave->offset, (unsigned long long)(slave->offset + slave->mtd.size));

		/* Build partition mapping for rootfs partition */
		create_partition_mapping(&slave->mtd);
	}
}
#endif

EDIT:
It seems to be a larger code block inside ifdef DNI_PARTITION_MAPPING, so something that Netgear has added for their mtd version.

2 Likes