summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2018-12-14 10:27:19 +0100
committerEnrico Jorns <ejo@pengutronix.de>2019-10-21 11:06:38 +0200
commit28ac0503b161bc99108580c4996210f7bec498d7 (patch)
treea646b616988ae8e2fac73a4152ca1f238f15a974
parent93aacefb15de520e14a7a6972577c94d36b44933 (diff)
downloaddt-utils-28ac0503b161bc99108580c4996210f7bec498d7.tar.gz
dt-utils-28ac0503b161bc99108580c4996210f7bec498d7.tar.xz
libdt: support finding devices by partuuid
This allows specifying partitions in devicetree that are actually not described in the devicetree to allow referencing them: partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; state_part: state { partuuid = "21367da7-c51f-499f-9aad-e1f366992365"; }; }; Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
-rw-r--r--src/libdt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libdt.c b/src/libdt.c
index 4638678..b52f80c 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2416,6 +2416,18 @@ int of_get_devicepath(struct device_node *partition_node, char **devpath, off_t
*/
node = partition_node->parent;
+ if (of_device_is_compatible(node, "fixed-partitions")) {
+ const char *uuid;
+
+ /* when partuuid is specified short-circuit the search for the cdev */
+ ret = of_property_read_string(partition_node, "partuuid", &uuid);
+ if (!ret) {
+ *devpath = basprintf("/dev/disk/by-partuuid/%s", uuid);
+
+ return 0;
+ }
+ }
+
/*
* Respect flash "partitions" subnode. Use parent of parent in this
* case.