[OpenWrt-Devel] [PATCH v2] fstools: Add support to read-only MTD partitions (eg. recovery images)

Bruno Pena brunompena at gmail.com
Wed Jan 22 05:25:16 EST 2020

Hi Daniel,

I was looking at the code and I think it's possible to relax the
enforcement of the parent access mode.
We can switch from a strict enforcement of the resulting mtd access mode,
to only enforcing the configured access mode (from the DTS file).

This can be achieved by changing from using mtd.flags to mtd.orig_flags:
    parts[i].mask_flags = !(slave->mtd.orig_flags & MTD_WRITEABLE) ?

With this change we no longer impact builds that do not have a read-only
firmware partition, but we can still enforce it for those that need it.
One thing to keep in mind is that the padding is still a requirement for
those devices which are building a read-only firmware partition!

Also please note this is not tested, these conclusions are only based on
the analysis of the kernel source code.

Best regards,
Bruno Pena

On Wed, Jan 22, 2020, 10:40 Daniel Golle <daniel at makrotopia.org> wrote:

> Hi Bruno,
> On Wed, Jan 22, 2020 at 10:22:01AM +0100, Bruno Pena wrote:
> > I would also like to take the opportunity to ask if it's worth pursuing
> > this patch if it means that all devices (using mtd) will require their
> > partitions to be padded to the blocksize?
> Please try not to introduce that padding, it's quite a big impact on
> all devices while only very few (wifi-only device) really need that
> change. Instead of wasting flash space by additional padding I'd rather
> want to see an OpenWrt-specific kernel-patch to allow a rw subpartition
> sitting inside an ro partition or just flatten the mtd partitioning.
> What I mean by flatteing is this:
> yout current approach:
> +-----------------------------+
> |          firmware           |
> +--------+--------------------+
> |        $       rootfs       |
> | kernel +------+-------------+
> |        $ rom  | rootfs_data |
> +--------+------+-------------+
> here rootfs_data inherigs the read-only from rootfs not being block-
> aligned. a better/flat approach would be:
> +-----------------------------+
> |          firmware           |
> +--------+------+-------------+
> | kernel $ rom  | rootfs_data |
> +--------+------+-------------+
> Now this would require major changes to our mtd-splitting subsystem
> which is quite a big amount of work...
> Cheers
> Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200122/ddc5074a/attachment.htm>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list