[PATCH 4/5] ARM: rpi: add machine-id support

Daniel Brát danek.brat at gmail.com
Mon Feb 6 17:05:24 PST 2023


Pass board's serial number as hashable for machine-id generation and
enable machine-id support for rpi platform by default.

Signed-off-by: Daniel Brát <danek.brat at gmail.com>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 4 ++++
 arch/arm/configs/rpi_defconfig            | 1 +
 arch/arm/configs/rpi_v8a_defconfig        | 1 +
 3 files changed, 6 insertions(+)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 9bf6e0334d..7ddbe1c289 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -24,6 +24,7 @@
 #include <globalvar.h>
 #include <asm/system_info.h>
 #include <reset_source.h>
+#include <machine_id.h>
 #include <dt-bindings/gpio/gpio.h>
 
 #include <mach/core.h>
@@ -74,6 +75,9 @@ static void rpi_set_serial_number(void)
 	serial_str = basprintf("%016llx", serial);
 	barebox_set_serial_number(serial_str);
 	free(serial_str);
+
+	if (IS_ENABLED(CONFIG_MACHINE_ID))
+		machine_id_set_hashable(&serial, sizeof(serial));
 }
 
 static void rpi_set_ethaddr(void)
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 500c92a821..6019584d48 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -24,6 +24,7 @@ CONFIG_BOOTM_OFTREE=y
 CONFIG_BLSPEC=y
 CONFIG_CONSOLE_ALLOW_COLOR=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_MACHINE_ID=y
 CONFIG_CMD_DMESG=y
 CONFIG_LONGHELP=y
 CONFIG_CMD_IOMEM=y
diff --git a/arch/arm/configs/rpi_v8a_defconfig b/arch/arm/configs/rpi_v8a_defconfig
index 75f62ddb65..1ea86c5893 100644
--- a/arch/arm/configs/rpi_v8a_defconfig
+++ b/arch/arm/configs/rpi_v8a_defconfig
@@ -23,6 +23,7 @@ CONFIG_CONSOLE_ACTIVATE_ALL=y
 CONFIG_CONSOLE_ALLOW_COLOR=y
 CONFIG_PBL_CONSOLE=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_MACHINE_ID=y
 CONFIG_CMD_DMESG=y
 CONFIG_LONGHELP=y
 CONFIG_CMD_IOMEM=y
-- 
2.34.1




More information about the barebox mailing list