mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>, barebox@lists.infradead.org
Cc: "Leonard Göhrs" <lgo@pengutronix.de>
Subject: Re: [PATCH 4/4] bootm: add global.bootm.provide_hostname option
Date: Thu, 14 Mar 2024 07:15:12 +0100	[thread overview]
Message-ID: <d899c758-8527-4c3b-854c-4014e8fdbc2f@pengutronix.de> (raw)
In-Reply-To: <20240313194547.3725723-4-m.felsch@pengutronix.de>

Hello Marco,

Cc += Leonard

On 13.03.24 20:45, Marco Felsch wrote:
> +		if (!barebox_hostname_is_valid(hostname)) {
> +			pr_err("Provided hostname is not compatible to systemd hostname requirements\n");
> +			ret = -EINVAL;
> +			goto err_out;
> +		}
> +
> +		hostname_bootarg = basprintf("systemd.hostname=%s", hostname);

Linux >= v6.0 supports a hostname= parameter and there's a discussion to decide what
the semantics should be and if it should differ to systemd.hostname=:
https://github.com/systemd/systemd/pull/25158

I am not fully sure, whether we should go with hostname or systemd.hostname= here.
@Leonard, what do you think?

Cheers,
Ahmad


> -static bool barebox_hostname_is_valid(const char *s)
> +bool barebox_hostname_is_valid(const char *s)
>  {
>  	unsigned int n_dots = 0;
>  	const char *p;
> diff --git a/include/bootm.h b/include/bootm.h
> index ee2b574521db..c69da85cdda1 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 b7b4d9e35094..d7b5261bc921 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 *);

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2024-03-14  6:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 19:45 [PATCH 1/4] string: add isempty helper Marco Felsch
2024-03-13 19:45 ` [PATCH 2/4] common: env: make use of isempty() Marco Felsch
2024-03-13 19:45 ` [PATCH 3/4] common: hostname: validate the provided hostname Marco Felsch
2024-03-13 19:45 ` [PATCH 4/4] bootm: add global.bootm.provide_hostname option Marco Felsch
2024-03-14  6:15   ` Ahmad Fatoum [this message]
2024-03-20 10:48     ` Marco Felsch
2024-04-04 13:40 ` [PATCH 1/4] string: add isempty helper Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d899c758-8527-4c3b-854c-4014e8fdbc2f@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lgo@pengutronix.de \
    --cc=m.felsch@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox