From c1bb8f33009e69f2c83d5963278bcf26d88cf819 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Wed, 13 Mar 2024 20:45:47 +0100 Subject: bootm: add global.bootm.provide_hostname option Add a new bootm option to automatically provide the $global.hostname via the kernel commandline parameter systemd.hostname. The logic is based on the provide_machine_id logic. To only provide valid hostnames the new barebox_hostname_is_valid() is used therefore we need to make this function public. Signed-off-by: Marco Felsch Link: https://lore.barebox.org/20240313194547.3725723-4-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer --- include/bootm.h | 5 +++++ include/common.h | 1 + 2 files changed, 6 insertions(+) (limited to 'include') diff --git a/include/bootm.h b/include/bootm.h index ee2b574521..c69da85cdd 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -34,6 +34,11 @@ struct bootm_data { * value of global.machine_id to Kernel. */ bool provide_machine_id; + /* + * provide_hostname - if true, try to add systemd.hostname= with value + * of global.hostname to Kernel. + */ + bool provide_hostname; unsigned long initrd_address; unsigned long os_address; unsigned long os_entry; diff --git a/include/common.h b/include/common.h index b7b4d9e350..d7b5261bc9 100644 --- a/include/common.h +++ b/include/common.h @@ -127,6 +127,7 @@ void barebox_set_model(const char *); const char *barebox_get_hostname(void); void barebox_set_hostname(const char *); void barebox_set_hostname_no_overwrite(const char *); +bool barebox_hostname_is_valid(const char *s); const char *barebox_get_serial_number(void); void barebox_set_serial_number(const char *); -- cgit v1.2.3