startup: introduce global.endianity variable
PATCH 1/1 startup: introduce global.endianity variable
The global.endianity variable make it possible
to determine current endian mode from command
line or from script on bi-endian capable system.
--- common/globalvar.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
common/globalvar.c +10 -0
@@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)static int globalvar_init (void ) { +const char *endianity; +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 )) + endianity ="big" ; +else + endianity ="little" ; + +globalvar_add_simple ("endianity" , endianity); +return 0 ; }pure_initcall (globalvar_init);BAREBOX_MAGICVAR_NAMED (global_version, global.version,"The barebox version" ); +BAREBOX_MAGICVAR_NAMED (global_endianity, global.endianity,"The barebox endianity" );/** * nvvar_save - save NV variables to persistent environment
Signature · 7 lines
2.25.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi,
Quoted 1 line · Antony Pavlov
The global.endianity variable make it possible
I'd prefer you call it endianness, as that's the term we are using elsewhere in barebox.
(unless you've a good reason to introduce a new name,
if so that should be part of the commit message)
Cheers
Ahmad
Quoted 42 lines
to determine current endian mode from command
line or from script on bi-endian capable system.Signed-off-by Antony Pavlov <[email protected]>--- common/globalvar.c | 10 ++++++++++ 1 file changed, 10 insertions(+)common/globalvar.c +10
-0@@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)static int globalvar_init (void ) { +const char *endianity; +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 )) + endianity ="big" ; +else + endianity ="little" ; + +globalvar_add_simple ("endianity" , endianity); +return 0 ; }pure_initcall (globalvar_init);BAREBOX_MAGICVAR_NAMED (global_version, global.version,"The barebox version" ); +BAREBOX_MAGICVAR_NAMED (global_endianity, global.endianity,"The barebox endianity" );/** * nvvar_save - save NV variables to persistent environment
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
On Fri, 3 Apr 2020 14:39:27 +0200
Ahmad Fatoum <[email protected]> wrote:
Hi Ahmad,
You are right! There are several mentions of "endianness" in current barebox codebase and there is no "endianity" mention.
I'll resend fixed patch soon.
Signature · 2 lines
Best regards, Antony Pavlov
Quoted 50 lines
Hi,
Quoted 1 line · Antony Pavlov
The global.endianity variable make it possible
I'd prefer you call it endianness, as that's the term we are using elsewhere in barebox.
(unless you've a good reason to introduce a new name,
if so that should be part of the commit message)Cheers
AhmadQuoted 36 lines
to determine current endian mode from command
line or from script on bi-endian capable system.Signed-off-by Antony Pavlov <[email protected]>--- common/globalvar.c | 10 ++++++++++ 1 file changed, 10 insertions(+)common/globalvar.c +9
-0@@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)static int globalvar_init (void ) { +const char *endianity; +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 )) + endianity ="big" ; +else + endianity ="little" ; + +globalvar_add_simple ("endianity" , endianity); +return 0 ; }pure_initcall (globalvar_init);
Quoted 12 lines
Quoted 6 lines
common/globalvar.c +1
-0BAREBOX_MAGICVAR_NAMED (global_version, global.version,"The barebox version" ); +BAREBOX_MAGICVAR_NAMED (global_endianity, global.endianity,"The barebox endianity" );/** * nvvar_save - save NV variables to persistent environment Signature · 4 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox