[SeaBIOS] [PATCH] enable_vga_console(): print machine UUID under seabios version message

Laszlo Ersek lersek at redhat.com
Mon Dec 10 18:11:08 CET 2012


There are users who would like to see the UUID at startup, and it probably
won't bother others.

Related RHBZ: 876250.

Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 src/util.h       |    1 +
 src/bootsplash.c |   15 ++++++++++++++-
 src/output.c     |   15 +++++++++++++++
 3 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/util.h b/src/util.h
index 7723bb1..aafa9b0 100644
--- a/src/util.h
+++ b/src/util.h
@@ -227,6 +227,7 @@ void __set_code_invalid(struct bregs *regs, u32 linecode, const char *fname);
 void __set_code_unimplemented(struct bregs *regs, u32 linecode
                               , const char *fname);
 void hexdump(const void *d, int len);
+void format_uuid(char buf[37], const u8 uuid[16]);
 
 #define dprintf(lvl, fmt, args...) do {                         \
         if (CONFIG_DEBUG_LEVEL && (lvl) <= CONFIG_DEBUG_LEVEL)  \
diff --git a/src/bootsplash.c b/src/bootsplash.c
index 78023a5..622d86e 100644
--- a/src/bootsplash.c
+++ b/src/bootsplash.c
@@ -12,6 +12,7 @@
 #include "jpeg.h" // splash
 #include "vbe.h" // struct vbe_info
 #include "bmp.h" // bmp_alloc
+#include "paravirt.h" // qemu_cfg_get_uuid
 
 
 /****************************************************************
@@ -33,6 +34,18 @@ call16_int10(struct bregs *br)
  * VGA text / graphics console
  ****************************************************************/
 
+static void
+print_hello(void)
+{
+    u8 uuid[16] = { 0 };
+    char uuid_str[37];
+
+    qemu_cfg_get_uuid(uuid);
+    format_uuid(uuid_str, uuid);
+
+    printf("SeaBIOS (version %s)\nMachine UUID %s\n\n", VERSION, uuid_str);
+}
+
 void
 enable_vga_console(void)
 {
@@ -45,7 +58,7 @@ enable_vga_console(void)
     call16_int10(&br);
 
     // Write to screen.
-    printf("SeaBIOS (version %s)\n\n", VERSION);
+    print_hello();
 }
 
 static int
diff --git a/src/output.c b/src/output.c
index 83de7f4..f4cdbc0 100644
--- a/src/output.c
+++ b/src/output.c
@@ -474,6 +474,21 @@ hexdump(const void *d, int len)
     debug_serial_flush();
 }
 
+void format_uuid(char buf[37], const u8 uuid[16])
+{
+    snprintf(buf, 37
+             , "%02x%02x%02x%02x"
+               "-%02x%02x"
+               "-%02x%02x"
+               "-%02x%02x"
+               "-%02x%02x%02x%02x%02x%02x"
+             , uuid[ 0], uuid[ 1], uuid[ 2], uuid[ 3]
+             , uuid[ 4], uuid[ 5]
+             , uuid[ 6], uuid[ 7]
+             , uuid[ 8], uuid[ 9]
+             , uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
+}
+
 static void
 dump_regs(struct bregs *regs)
 {
-- 
1.7.1




More information about the SeaBIOS mailing list