From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] startup: introduce global.endianness variable
Date: Wed, 12 May 2021 07:36:56 +0200 [thread overview]
Message-ID: <20210512053656.GL19819@pengutronix.de> (raw)
In-Reply-To: <20210511083648.134890-1-antonynpavlov@gmail.com>
On Tue, May 11, 2021 at 11:36:48AM +0300, Antony Pavlov wrote:
> The global.endianness variable makes 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 | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/common/globalvar.c b/common/globalvar.c
> index a55b38b00f..8bb5015ce4 100644
> --- a/common/globalvar.c
> +++ b/common/globalvar.c
> @@ -641,6 +641,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))
> @@ -651,6 +653,16 @@ static int globalvar_init(void)
> if (strlen(buildsystem_version_string) > 0)
> globalvar_add_simple("buildsystem.version", buildsystem_version_string);
>
> +#ifdef __BIG_ENDIAN
> + endianness = "big";
> +#elif defined(__LITTLE_ENDIAN)
> + endianness = "little";
> +#else
> +#error "could not determine byte order"
> +#endif
> +
> + globalvar_add_simple("endianness", endianness);
> +
> return 0;
> }
> pure_initcall(globalvar_init);
> @@ -658,6 +670,7 @@ pure_initcall(globalvar_init);
> BAREBOX_MAGICVAR(global.version, "The barebox version");
> BAREBOX_MAGICVAR(global.buildsystem.version,
> "version of buildsystem barebox was built with");
> +BAREBOX_MAGICVAR(global.endianness, "The barebox endianness");
>
> /**
> * nvvar_save - save NV variables to persistent environment
> --
> 2.31.1
>
>
--
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-05-12 5:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 8:36 Antony Pavlov
2021-05-12 5:36 ` Sascha Hauer [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-06 12:13 [PATCH V2] " Antony Pavlov
2020-04-06 12:44 ` Antony Pavlov
2020-04-14 9: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=20210512053656.GL19819@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
/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