mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH V2] startup: introduce global.endianness variable
Date: Mon, 6 Apr 2020 15:44:04 +0300	[thread overview]
Message-ID: <20200406154404.6bbdb6564dc7db9c4e076e5f@gmail.com> (raw)
In-Reply-To: <20200406121325.1364-1-antonynpavlov@gmail.com>

On Mon,  6 Apr 2020 15:13:25 +0300
Antony Pavlov <antonynpavlov@gmail.com> wrote:

Hi Sascha,

The global.version (and global.endianness) variable can
be easely modified by user.
Can we make it immutable?

-- 
Best regards,
  Antony Pavlov

> The global.endianness variable make it possible
> to determine current endian mode from command
> line or from script on bi-endian capable system.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  common/globalvar.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/common/globalvar.c b/common/globalvar.c
> index c87f2c9339..264833f88c 100644
> --- a/common/globalvar.c
> +++ b/common/globalvar.c
> @@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)
>  
>  static int globalvar_init(void)
>  {
> +	const char *endianness;
> +
>  	register_device(&global_device);
>  
>  	if (IS_ENABLED(CONFIG_NVVAR))
> @@ -598,11 +600,19 @@ static int globalvar_init(void)
>  
>  	globalvar_add_simple("version", UTS_RELEASE);
>  
> +	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
> +		endianness = "big";
> +	else
> +		endianness = "little";
> +
> +	globalvar_add_simple("endianness", endianness);
> +
>  	return 0;
>  }
>  pure_initcall(globalvar_init);
>  
>  BAREBOX_MAGICVAR_NAMED(global_version, global.version, "The barebox version");
> +BAREBOX_MAGICVAR_NAMED(global_endianness, global.endianness, "The barebox endianness");
>  
>  /**
>   * nvvar_save - save NV variables to persistent environment
> -- 
> 2.25.0
> 

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-04-06 12:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 12:13 Antony Pavlov
2020-04-06 12:44 ` Antony Pavlov [this message]
2020-04-14  9:36   ` Sascha Hauer
2021-05-11  8:36 [PATCH v2] " Antony Pavlov
2021-05-12  5:36 ` 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=20200406154404.6bbdb6564dc7db9c4e076e5f@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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