From: Andreas Reichel <[email protected]>

Signed-off-by: Andreas Reichel <[email protected]>
---
 Makefile.am     |  1 +
 color.c         | 21 +++++++++++++++++++++
 include/color.h | 24 ++++++++++++++++++++++++
 main.c          |  3 +++
 4 files changed, 49 insertions(+)
 create mode 100644 color.c
 create mode 100644 include/color.h

diff --git a/Makefile.am b/Makefile.am
index 74fa7f0..f8945a9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -131,6 +131,7 @@ efi_sources = \
        env/fatvars.c \
        utils.c \
        bootguard.c \
+       color.c \
        main.c
 
 efi_cppflags = \
diff --git a/color.c b/color.c
new file mode 100644
index 0000000..737bfd6
--- /dev/null
+++ b/color.c
@@ -0,0 +1,21 @@
+/*
+ * EFI Boot Guard
+ *
+ * Copyright (c) Siemens AG, 2017
+ *
+ * Authors:
+ *  Andreas Reichel <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+
+#include "color.h"
+
+void Color(EFI_SYSTEM_TABLE *system_table, char fgcolor, char bgcolor)
+{
+       EFI_SIMPLE_TEXT_OUT_PROTOCOL *con = system_table->ConOut;
+       (void)uefi_call_wrapper(con->SetAttribute, 3, con, (bgcolor << 8) | 
fgcolor);
+}
diff --git a/include/color.h b/include/color.h
new file mode 100644
index 0000000..3187156
--- /dev/null
+++ b/include/color.h
@@ -0,0 +1,24 @@
+/*
+ * EFI Boot Guard
+ *
+ * Copyright (c) Siemens AG, 2017
+ *
+ * Authors:
+ *  Andreas Reichel <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+
+#ifndef __COLOR_H__
+#define __COLOR_H__
+
+#include <efi.h>
+#include <efilib.h>
+#include <efiprot.h>
+
+void Color(EFI_SYSTEM_TABLE *system_table, char fgcolor, char bgcolor);
+
+#endif
diff --git a/main.c b/main.c
index 8c08df9..0d5f14b 100644
--- a/main.c
+++ b/main.c
@@ -21,6 +21,7 @@
 #include <bootguard.h>
 #include <configuration.h>
 #include "version.h"
+#include "color.h"
 
 extern const unsigned long init_array_start[];
 extern const unsigned long init_array_end[];
@@ -113,7 +114,9 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, 
EFI_SYSTEM_TABLE *system_table)
        this_image = image_handle;
        InitializeLib(this_image, system_table);
 
+       Color(system_table, 3, 0);
        Print(L"\nEFI Boot Guard %s\n", L""EFIBOOTGUARD_VERSION);
+       Color(system_table, 7, 0);
 
        status =
            uefi_call_wrapper(BS->OpenProtocol, 6, this_image,
-- 
2.19.1

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20181025134409.1446-2-andreas.reichel.ext%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to