[PATCH] startup: introduce global.endianness variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux