[PATCH] base-files: fix sysupgrade with ubi and kernel sharing partition

Lanchon lanchon at gmail.com
Wed May 4 12:53:49 PDT 2022


On 5/4/22 12:09, Sungbo Eo wrote:
> On 2022-05-02 17:10, Bjørn Mork wrote:
>>
>> I can understand that. I have not been able to find any other examples,
>> so I have to take full responsibility for this unexpected configuration.
>> I guess I thought it would make sense to have a "Kernel" partition large
>> enough to allow reverting to OEM firmware.
>>
>> But I recently found out that the bootloader can be configured to boot
>> from "Kernel2", which means that we can document a "revert to OEM"
>> procedure using that partition instead.  Will fail if/when we add dual
>> image support to OpenWrt though.
>>
>> Another alternative is of course to add another partition for the
>> OpenWrt kernel (pointed to by $CI_KERNPART), keeping the "Kernel" as an
>> unused container only.  Maybe the safest solution?
> How about using partition nesting here? I've started to use it for NAND
> devices recently. One example:
> https://github.com/openwrt/openwrt/blob/65258f5d6093/target/linux/ramips/dts/mt7621_iptime_t5004.dts#L62-L79
>
> Sungbo

that's interesting, i didn't know that was possible.

in my extensive experience modding the partitioning of devices, which
encompasses exactly *one* device, this is what i take home:

in order to facilitate return to stock, i prefer keeping the complete set
of OEM partitions and add new, overlapping partitions. the deprecated OEM
partitions (those with their space repurposed) are renamed to
"stock_<OEM-name>" and marked read-write. also the new partitions are
added at the end of the list, so that OEM partition numbering is not
affected and scripts designed to work on them work under OEM and custom
kernels. this was important on my device which included a partition with
MACs and stuff that had to be relocated to consolidate reusable space.

nested partitioning is interesting but does not generalize: it can't
coalesce partitions. it would also not conserve the partition numbering.

it seems partition nesting is a great mechanism to support reading and
writing a set of related partitions in one go, and applies to NOR. for
NAND, where bad block skipping occurs, this doesn't work. and nesting
doesn't appear to offer any advantage over plain overlapping partitions,
which is a more general solution.


PS. the original concern of this thread has been worked around by
patching the code (merged into master).


More information about the openwrt-devel mailing list