third_party/linux: expose PARTUUID through uevent
The kernel was patched to expose partition UUIDs.
This was inspired by a change [1] that didn't make it into mainline.
The patch is meant for internal use and would need to be adapted for
mainlining due to recent changes in the part of codebase involved.
[1] https://lkml.org/lkml/2017/10/10/1130
Change-Id: Ie34bf6f46ba95e39c5d8589414f98f06435aaae2
Reviewed-on: https://review.monogon.dev/c/monogon/+/407
Reviewed-by: Leopold Schabel <leo@nexantic.com>
diff --git a/third_party/linux/external.bzl b/third_party/linux/external.bzl
index ccad4b5..c74d387 100644
--- a/third_party/linux/external.bzl
+++ b/third_party/linux/external.bzl
@@ -31,6 +31,7 @@
"//third_party/linux/external:0001-fsinfo-Introduce-a-non-repeating-system-unique-super.patch",
"//third_party/linux/external:0002-fsinfo-Add-fsinfo-syscall-to-query-filesystem-inform.patch",
"//third_party/linux/external:0003-fsinfo-Allow-retrieval-of-superblock-devname-options.patch",
+ "//third_party/linux/external:0001-block-partition-expose-PARTUUID-through-uevent.patch",
],
sha256 = sums[version],
strip_prefix = "linux-" + version,
diff --git a/third_party/linux/external/0001-block-partition-expose-PARTUUID-through-uevent.patch b/third_party/linux/external/0001-block-partition-expose-PARTUUID-through-uevent.patch
new file mode 100644
index 0000000..f9e14dd
--- /dev/null
+++ b/third_party/linux/external/0001-block-partition-expose-PARTUUID-through-uevent.patch
@@ -0,0 +1,26 @@
+From 360fb82dc695dbddc31be40ed86c1d3105ca8edf Mon Sep 17 00:00:00 2001
+From: Mateusz Zalega <mateusz@monogon.tech>
+Date: Tue, 19 Oct 2021 18:18:14 +0200
+Subject: [PATCH] block: partition: expose PARTUUID through uevent
+
+Signed-off-by: Mateusz Zalega <mateusz@monogon.tech>
+---
+ block/partitions/core.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/block/partitions/core.c b/block/partitions/core.c
+index a02e22411594..5c66aae379e7 100644
+--- a/block/partitions/core.c
++++ b/block/partitions/core.c
+@@ -270,6 +270,8 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env)
+ add_uevent_var(env, "PARTN=%u", part->partno);
+ if (part->info && part->info->volname[0])
+ add_uevent_var(env, "PARTNAME=%s", part->info->volname);
++ if (part->info && part->info->uuid[0])
++ add_uevent_var(env, "PARTUUID=%s", part->info->uuid);
+ return 0;
+ }
+
+--
+2.31.1
+