summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2024-03-13 20:45:47 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-04-04 15:40:01 +0200
commitc1bb8f33009e69f2c83d5963278bcf26d88cf819 (patch)
tree51cac4e1f800385d4812ee95192a06de35d54a21 /include
parente0d5d8bf9a81b58660f19482a723342c7506ad95 (diff)
downloadbarebox-c1bb8f33009e69f2c83d5963278bcf26d88cf819.tar.gz
barebox-c1bb8f33009e69f2c83d5963278bcf26d88cf819.tar.xz
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 <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240313194547.3725723-4-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/bootm.h5
-rw-r--r--include/common.h1
2 files changed, 6 insertions, 0 deletions
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 *);