<div dir="auto">Hi Steve,<div dir="auto"><br></div><div dir="auto">Don't waste your time with the previous test request.</div><div dir="auto">I'll try to test either today/tomorrow the "mtd.orig_flags" approach on my device and - if successful - I'll then ask if you can try it on your TP-Link.</div><div dir="auto"><br></div><div dir="auto">Thank you and best regards,</div><div dir="auto">Bruno Pena</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 22, 2020, 11:34 Bruno Pena <<a href="mailto:brunompena@gmail.com">brunompena@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Just a small correction on the previous email, there's actually no padding requirement since everything will be read-only!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 22, 2020, 11:25 Bruno Pena <<a href="mailto:brunompena@gmail.com" target="_blank" rel="noreferrer">brunompena@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto">Hi Daniel,</div><div dir="auto"><br></div><div dir="auto">I was looking at the code and I think it's possible to relax the enforcement of the parent access mode.</div><div dir="auto">We can switch from a strict enforcement of the resulting mtd access mode, to only enforcing the configured access mode (from the DTS file).</div><div dir="auto"><br></div><div dir="auto">This can be achieved by changing from using mtd.flags to mtd.orig_flags:</div><div dir="auto"> parts[i].mask_flags = !(slave->mtd.orig_flags & MTD_WRITEABLE) ? MTD_WRITEABLE : 0;</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto">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!</div><div dir="auto"><br></div><div dir="auto">Also please note this is not tested, these conclusions are only based on the analysis of the kernel source code.</div><div dir="auto"><br></div><div dir="auto">Best regards,</div><div dir="auto">Bruno Pena</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 22, 2020, 10:40 Daniel Golle <<a href="mailto:daniel@makrotopia.org" rel="noreferrer noreferrer" target="_blank">daniel@makrotopia.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Bruno,<br>
<br>
On Wed, Jan 22, 2020 at 10:22:01AM +0100, Bruno Pena wrote:<br>
> I would also like to take the opportunity to ask if it's worth pursuing<br>
> this patch if it means that all devices (using mtd) will require their<br>
> partitions to be padded to the blocksize?<br>
<br>
Please try not to introduce that padding, it's quite a big impact on<br>
all devices while only very few (wifi-only device) really need that<br>
change. Instead of wasting flash space by additional padding I'd rather<br>
want to see an OpenWrt-specific kernel-patch to allow a rw subpartition<br>
sitting inside an ro partition or just flatten the mtd partitioning.<br>
What I mean by flatteing is this:<br>
<br>
yout current approach:<br>
+-----------------------------+<br>
| firmware |<br>
+--------+--------------------+ <br>
| $ rootfs |<br>
| kernel +------+-------------+<br>
| $ rom | rootfs_data |<br>
+--------+------+-------------+<br>
<br>
here rootfs_data inherigs the read-only from rootfs not being block-<br>
aligned. a better/flat approach would be:<br>
+-----------------------------+<br>
| firmware |<br>
+--------+------+-------------+ <br>
| kernel $ rom | rootfs_data |<br>
+--------+------+-------------+<br>
<br>
Now this would require major changes to our mtd-splitting subsystem<br>
which is quite a big amount of work...<br>
<br>
<br>
Cheers<br>
<br>
<br>
Daniel<br>
</blockquote></div>
</blockquote></div>
</blockquote></div>