[OpenWrt-Devel] Issues with MTD parsing in absence of rootfs - Proposed patch, advice please

Stephen G. Parry sgparry at mainscreen.com
Tue Oct 28 21:17:30 EDT 2014


Hi All,
As some of you will be aware I have been working on an initramfs only
image with no lzma-loader, used to kexec main kernel from external
storage on a bcrm47xx based router (Netgear WNR3500L v1). I have
encountered two unpleasant issues:

1. The parsing routines in bcm47xxpart.c do not currently cope with a
non-existent rootfs, i.e. one where the trx header shows zero relative
offset after the main linux image. the result is thus:

[    1.040000] 7 bcm47xxpart partitions found on MTD device bcm47xxsflash
[    1.050000] Creating 7 MTD partitions on "bcm47xxsflash":
[    1.060000] 0x000000000000-0x000000040000 : "boot"
[    1.060000] 0x000000040000-0x0000007d0000 : "firmware"
[    1.070000] 0x00000004001c-0x000000040000 : "linux"
[    1.080000] mtd: partition "linux" must either start or end on erase
block boundary or be smaller than an erase block -- forcing read-only
[    1.090000] 0x000000040000-0x0000007d0000 : "rootfs"
[    1.100000] mtd: device 3 (rootfs) set to be root filesystem
[    1.110000] mtdsplit: no squashfs found in "rootfs"
[    1.110000] mtdsplit: no squashfs found in "bcm47xxsflash"
[    1.120000] 0x0000007d0000-0x0000007e0000 : "POT"
[    1.130000] 0x0000007e0000-0x0000007f0000 : "board_data"
[    1.130000] 0x0000007f0000-0x000000800000 : "nvram"

root at MiniWrt:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "boot"
mtd1: 00790000 00010000 "firmware"
mtd2: ffffffffffffffe4 00010000 "linux"    <---- OUCH! My kernel
currently occupies negative space???....
mtd3: 00790000 00010000 "rootfs"
mtd4: 00010000 00010000 "POT"
mtd5: 00010000 00010000 "board_data"
mtd6: 00010000 00010000 "nvram"

2. The current trunk build includes a first run script
(/etc/uci-defaults/09_fix_crc) that indiscriminately calls mtd fixtrx.
With my type of set up mtd fixtrx completely screws over the partition
table bricking the router.

I have not investigated far enough yet to determine if (2) is caused
purely by (1), but it's certainly not going to help.

My question is, should I:
a) patch bcm47xxpart.c to not add a rootfs partition if the offset is zero
b) patch bcm47xxpart.c to not add a 'fake' rootfs partition after the
linux partition
c) munge the build process to add an empty rootfs partition to my
initramfs image.

Any thoughts please? I'd like to avoid wasting too much of everybody's
valuable time generating bad patches.

Stephen Parry
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list