kernel: use add_mtd_partitions() helper when using OpenWrt parsers
authorRafał Miłecki <rafal@milecki.pl>
Mon, 3 Dec 2018 10:16:03 +0000 (11:16 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 16:48:21 +0000 (17:48 +0100)
commite1f173e23458881cdccc996131abf4e5239b30c7
tree57cf96c1931558eb901a5ac56b908cdff9616173
parent7a6c833479873918d7fccfdc0f895d8ad2e23e33
kernel: use add_mtd_partitions() helper when using OpenWrt parsers

This helper uses hierarchical partitions layout following the way
upstream parsers work. It's closer to what we should use when mainlining
our solutions. It also doesn't require hacky casting of struct
mtd_partition to the const.

THIS WILL AFFECT KERNEL PRINTING PARTITIONS IN THE LOG

Something like:
[    3.930158] 0x0000004e0000-0x000001fb0000 : "rootfs_data"
will get replaced by:
[    3.907338] Creating 1 MTD partitions on "rootfs":
[    3.912142] 0x00000031d400-0x000001ded400 : "rootfs_data"

It's important to understand that "rootfs_data" in above example is a
*subpartition* of the "rootfs" now. To get absolute addresses (e.g. for
some debugging purposes) one has to add them to the "rootfs", e.g.
[    3.912548] 0x0000001c2c00-0x000001fb0000 : "rootfs"

(0x1c2c00 + 0x31d400 = 0x4e0000)

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(backported from 7e88753ace0022bd56f77a7a647894f2936cf17b)
target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch