From 76759ec94eb3a32d71c32550b6b50965125afd92 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Thu, 30 Nov 2017 11:56:20 +0100 Subject: of: base: use root_node compatible as suggestion for a hostname on some SoCs we can use generic PLL and RAM initialization. In this cases we create board file only to provide a host name. With this patch host name will be created from device tree compatible. For example: compatible = "board_vendor,board", "chip_vendor,soc" the host name will be: "board" This function will not overwrite a host name which is already set by board or machine code. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- common/misc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'common/misc.c') diff --git a/common/misc.c b/common/misc.c index c5d3704c82..0888f1f4f6 100644 --- a/common/misc.c +++ b/common/misc.c @@ -187,6 +187,13 @@ const char *barebox_get_hostname(void) } EXPORT_SYMBOL(barebox_get_hostname); +void barebox_set_hostname_no_overwrite(const char *__hostname) +{ + if (!barebox_get_hostname()) + barebox_set_hostname(__hostname); +} +EXPORT_SYMBOL(barebox_set_hostname_no_overwrite); + BAREBOX_MAGICVAR_NAMED(global_hostname, global.hostname, "shortname of the board. Also used as hostname for DHCP requests"); -- cgit v1.2.3