Subject: Introduction of a small, persistent "cfg" partition in OpenWRT's MTD partitioning
Hello openwrt community,
I hope this message finds you all well. Recently, during my work on a project, I found the need for a small, persistent data partition alongside the rootfs_data
when working with mtd partitions. This partition, which I named "cfg", has proven to be beneficial in several ways, especially when working with persistent data requirements, and I believe it might be a useful addition to the wrt ecosystem.
The "cfg" partition is particularly useful when there are essential parameters that need to be preserved even if we erase the entire overlay file system or when dealing with a ramfs rootfs. For instance, during an EasyMesh certification process, this partition was essential for preserving persistent data.
Creating this small partition is fairly simple, and involves just a bit of adjustment in the mtd partitioning structure. Here's how it can be done:
-
Define the size of the "cfg" partition. For example, we can set it to 1MB. This size could be made configurable via a kernel configuration option or directly from optional kernel arguments.
-
Subtract the size of the "cfg" partition from the
rootfs_data
partition, essentially carving out a small portion of it. -
Label this new partition as "cfg".
To enable this "cfg" partition, a new kernel configuration option needs to be added. The size of the partition could either be set using another configuration option, or directly from optional kernel arguments. Once enabled, the partition can be used by any applications or processes that require a small amount of persistent storage.
I believe that adding this feature to openwrt could be a significant enhancement, especially for those working with persistent data requirements.
If the community finds this idea beneficial, I am more than happy to share the work I have done so far, and contribute to making this a feature in openwrt. Please share your thoughts on this idea