[RFC 5/7] internal: add big/little endian to boot print

Ben Dooks ben.dooks at codethink.co.uk
Fri Dec 20 08:02:04 PST 2024


Make a nice new banner for our big endian system.
---
 lib/sbi/sbi_init.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index 8a2cfae..9009f78 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -32,6 +32,17 @@
 #include <sbi/sbi_version.h>
 #include <sbi/sbi_unit_test.h>
 
+#ifdef CONFIG_OPENSBI_BE
+#define ENDIAN "big-endian "
+#define BANNER	\
+        "   ___                   ____  ____ ___    ____  _____ \n"	\
+        "  / _ \\ _ __   ___ _ __ / ___|| __ )_ _|  | __ )| ____|\n"	\
+        " | | | | '_ \\ / _ \\ '_ \\ \\ ___ \\|  _ \\| |   |  _ \\|  _|  \n"	\
+        " | |_| | |_) |  __/ | | |___) | |_) | |   | |_) | |___ \n"	\
+        "  \\___/| .__/ \\___|_| |_|____/|____/___|  |____/|_____|\n"	\
+        "       |_|                                             \n\n"
+#else
+#define ENDIAN "little-endian "
 #define BANNER                                              \
 	"   ____                    _____ ____ _____\n"     \
 	"  / __ \\                  / ____|  _ \\_   _|\n"  \
@@ -41,6 +52,8 @@
 	"  \\____/| .__/ \\___|_| |_|_____/|____/_____|\n"  \
 	"        | |\n"                                     \
 	"        |_|\n\n"
+#endif
+
 
 static void sbi_boot_print_banner(struct sbi_scratch *scratch)
 {
@@ -48,9 +61,9 @@ static void sbi_boot_print_banner(struct sbi_scratch *scratch)
 		return;
 
 #ifdef OPENSBI_VERSION_GIT
-	sbi_printf("\nOpenSBI %s\n", OPENSBI_VERSION_GIT);
+	sbi_printf("\nOpenSBI %s%s\n", ENDIAN, OPENSBI_VERSION_GIT);
 #else
-	sbi_printf("\nOpenSBI v%d.%d\n", OPENSBI_VERSION_MAJOR,
+	sbi_printf("\nOpenSBI %sv%d.%d\n", ENDIAN, OPENSBI_VERSION_MAJOR,
 		   OPENSBI_VERSION_MINOR);
 #endif
 
-- 
2.37.2.352.g3c44437643




More information about the opensbi mailing list