summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2018-12-14 10:27:19 +0100
committerRoland Hieber <rhi@pengutronix.de>2019-02-07 12:50:56 +0100
commitaf85ab844b1dfdbf4276a57384ef5594266db0cd (patch)
treef779199cf513a20c399e9a7c80ee837db5591855
parent5588a6c32d54bc4a1ef0b9f72807c46dd00bc20e (diff)
downloaddt-utils-af85ab844b1dfdbf4276a57384ef5594266db0cd.tar.gz
dt-utils-af85ab844b1dfdbf4276a57384ef5594266db0cd.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 8ae9978..bdfd409 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2417,6 +2417,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.