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

Hi Ahmad,

On 24-03-14, Ahmad Fatoum wrote:
> 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

Thanks for the pointer, I think this discussion is still ongoing and
after skipping through the longly thread my impression is that the
semantics are the same.

> I am not fully sure, whether we should go with hostname or systemd.hostname= here.

As you have said, the hostname= param was added with v6.0 so by this
change distros using older kernels could benefit. Also I think that
hostname and systemd.hostname should be the same, to cite the GH
discussion:
8<-------------------------------------------------------------------
...

If there was already hostname= with those semantics on the kernel side
in place, I'm pretty sure we would've just reused it instead of defining
systemd.hostname=.

...
8<-------------------------------------------------------------------

Therefore I would keep the systemd.hostname as it was done by this
patch or we can supply both systemd.hostname= and hostname= but setting
it to the same value.

Regards,
  Marco

> @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-20 10:49 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
2024-03-20 10:48     ` Marco Felsch [this message]
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=20240320104859.g426mfwf4mrxmpu3@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lgo@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