[PATCH 4/5] sandbox: dts: populate $global.machine_id

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Jun 27 23:40:35 PDT 2021


/etc/machine-id is 0444 by default, so it makes sense to use it for
sandbox machine ID. Do so.

Note that the machine ID will be constant, but not equal as barebox
will hash the ASCII representation.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/sandbox/dts/sandbox.dts | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 5b2cab219e2a..cd0022f777ed 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -13,6 +13,7 @@
 	};
 
 	chosen {
+		barebox,machine-id-path = &machine_id;
 		environment {
 			compatible = "barebox,environment";
 			device-path = &part_env;
@@ -101,6 +102,33 @@
 		};
 	};
 
+	machine-id {
+		compatible = "barebox,hostfile";
+		barebox,filename = "/etc/machine-id";
+		barebox,read-only;
+		reg = <0 0 0 0>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				compatible = "nvmem-cells";
+				reg = <0x0 0x20>;
+				label = "nvmem";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				machine_id: machine-id at 0 {
+					reg = <0x0 0x20>;
+				};
+			};
+		};
+	};
+
 	power {
 		compatible = "barebox,sandbox-power";
 		nvmem-cell-names = "reset-source";
-- 
2.30.2




More information about the barebox mailing list