From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] startup: introduce global.endianness variable
Date: Mon, 26 Apr 2021 17:30:25 +0300 [thread overview]
Message-ID: <20210426143025.149717-1-antonynpavlov@gmail.com> (raw)
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 | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/common/globalvar.c b/common/globalvar.c
index a55b38b00f..75ce6331b7 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,13 @@ static int globalvar_init(void)
if (strlen(buildsystem_version_string) > 0)
globalvar_add_simple("buildsystem.version", buildsystem_version_string);
+ if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
+ endianness = "big";
+ else
+ endianness = "little";
+
+ globalvar_add_simple("endianness", endianness);
+
return 0;
}
pure_initcall(globalvar_init);
@@ -658,6 +667,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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2021-04-26 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 14:30 Antony Pavlov [this message]
2021-04-28 4:39 ` Antony Pavlov
2021-05-03 11:16 ` Sascha Hauer
2021-05-11 6:58 ` Antony Pavlov
2021-05-11 7:52 ` 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=20210426143025.149717-1-antonynpavlov@gmail.com \
--to=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