|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH 4/5] lib/ukboot: Additional Unikraft banners
Adds additional Unikraft banners to choose from. The "Powered by" banners are
intended to be the text-version of the official Unikraft project logo. The most
compatible variant (non-UTF8, non-extended ASCII) is set as the new default.
Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
lib/ukboot/Config.uk | 30 +++++++++++++--
lib/ukboot/Makefile.uk | 3 ++
lib/ukboot/banner.c | 84 ++++++++++++++++++++++++++++++++++++++++++
lib/ukboot/banner.h | 50 +++++++++++++++++++++++++
lib/ukboot/boot.c | 11 ++----
5 files changed, 167 insertions(+), 11 deletions(-)
create mode 100644 lib/ukboot/banner.c
create mode 100644 lib/ukboot/banner.h
diff --git a/lib/ukboot/Config.uk b/lib/ukboot/Config.uk
index 07139e2b..55550fe3 100644
--- a/lib/ukboot/Config.uk
+++ b/lib/ukboot/Config.uk
@@ -9,9 +9,33 @@ menuconfig LIBUKBOOT
# FIXME: binary buddy allocator is hard-coded for now
if LIBUKBOOT
- config LIBUKBOOT_BANNER
- bool "Show Unikraft banner"
- default y
+ choice LIBUKBOOT_BANNER
+ prompt "Unikraft banner"
+ default LIBUKBOOT_BANNER_POWEREDBY
+ config LIBUKBOOT_BANNER_NONE
+ bool "None"
+
+ config LIBUKBOOT_BANNER_MINIMAL
+ bool "One liner"
+
+ config LIBUKBOOT_BANNER_CLASSIC
+ bool "Classic banner"
+
+ config LIBUKBOOT_BANNER_POWEREDBY
+ bool "Powered by Unikraft"
+
+ config LIBUKBOOT_BANNER_POWEREDBY_EA
+ bool "Powered by Unikraft (ASCII)"
+ help
+ Please make sure that your console display supports
+ extended ASCII characters
+
+ config LIBUKBOOT_BANNER_POWEREDBY_U8
+ bool "Powered by Unikraft (UTF-8)"
+ help
+ Please make sure that your console display supports
+ UTF-8
+ endchoice
config LIBUKBOOT_MAXNBARGS
int "Maximum number of arguments (max. size of argv)"
diff --git a/lib/ukboot/Makefile.uk b/lib/ukboot/Makefile.uk
index ea052019..9c10e5e4 100644
--- a/lib/ukboot/Makefile.uk
+++ b/lib/ukboot/Makefile.uk
@@ -5,6 +5,9 @@ CXXINCLUDES-$(CONFIG_LIBUKBOOT) += -I$(LIBUKBOOT_BASE)/include
LIBUKBOOT_SRCS-y += $(LIBUKBOOT_BASE)/boot.c
LIBUKBOOT_SRCS-y += $(LIBUKBOOT_BASE)/version.c
+ifneq ($(CONFIG_LIBUKBOOT_BANNER_NONE),y)
+LIBUKBOOT_SRCS-y += $(LIBUKBOOT_BASE)/banner.c
+endif
# The main() is in the separate library to fool the LTO. Which is
# trying to resolve the main() function call to whatever is available
diff --git a/lib/ukboot/banner.c b/lib/ukboot/banner.c
new file mode 100644
index 00000000..bc45b6aa
--- /dev/null
+++ b/lib/ukboot/banner.c
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Unikraft Banner
+ *
+ * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ *
+ * Copyright (c) 2020, NEC Laboratories Europe GmbH, NEC Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <uk/config.h>
+#include <stdio.h>
+
+
+void print_banner(FILE *out) {
+#if CONFIG_LIBUKBOOT_BANNER_POWEREDBY
+ fprintf(out, "Powered by\n");
+ fprintf(out, "o. .o _ _ __ _\n");
+ fprintf(out, "Oo Oo ___ (_) | __ __ __ _ ' _) :_\n");
+ fprintf(out, "oO oO ' _ `| | |/ / _)' _` | |_| _)\n");
+ fprintf(out, "oOo oOO| | | | | (| | | (_) | _) :_\n");
+ fprintf(out, " OoOoO ._, ._:_:_,\\_._, .__,_:_, \\___)\n");
+ fprintf(out, "%39s\n",
+ STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+
+#elif CONFIG_LIBUKBOOT_BANNER_POWEREDBY_EA
+ fprintf(out, "Powered by\n");
+ fprintf(out, "\xDF\xFE \xFE\xDC _ _ __ _\n");
+ fprintf(out, "\xDF\xFE \xDF\xDC ___ (_) | __ __ __ _ ' _) :_\n");
+ fprintf(out, "\xDC\xDF \xDC\xFE ' _ `| | |/ / _)' _` | |_| _)\n");
+ fprintf(out, "\xFE\xDF\xFE \xFE\xDC\xDF| | | | | (| | | (_) | _)
:_\n");
+ fprintf(out, " \xFE\xDC\xDF\xDC\xFE ._, ._:_:_,\\_._, .__,_:_,
\\___)\n");
+ fprintf(out, "%39s\n",
+ STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+
+#elif CONFIG_LIBUKBOOT_BANNER_POWEREDBY_U8
+ fprintf(out, "Powered by\n");
+ fprintf(out, "■▖ ▖■ _ _ __ _\n");
+ fprintf(out, "■▚ ■▞ ___ (_) | __ __ __ _ ´ _) :_\n");
+ fprintf(out, "▀■ ■▄ ´ _ `| | |/ / _)´ _` | |_| _)\n");
+ fprintf(out, "▄▀▄ ▗▀▄| | | | | (| | | (_) | _) :_\n");
+ fprintf(out, " ▚▄■▄▞ ._, ._:_:_,\\_._, .__,_:_, \\___)\n");
+ fprintf(out, "%39s\n",
+ STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+
+#elif CONFIG_LIBUKBOOT_BANNER_CLASSIC
+ fprintf(out, "Welcome to _ __ _____\n");
+ fprintf(out, " __ _____ (_) /__ _______ _/ _/ /_\n");
+ fprintf(out, "/ // / _ \\/ / '_// __/ _ `/ _/ __/\n");
+ fprintf(out, "\\_,_/_//_/_/_/\\_\\/_/ \\_,_/_/ \\__/\n");
+ fprintf(out, "%35s\n",
+ STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+
+#else /* CONFIG_LIBUKBOOT_BANNER_MINIMAL */
+ fprintf(out, "Powered by Unikraft " STRINGIFY(UK_CODENAME)
+ " (" STRINGIFY(UK_FULLVERSION) ")\n");
+#endif
+}
diff --git a/lib/ukboot/banner.h b/lib/ukboot/banner.h
new file mode 100644
index 00000000..906a4acb
--- /dev/null
+++ b/lib/ukboot/banner.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Unikraft Banner
+ *
+ * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ *
+ * Copyright (c) 2020, NEC Laboratories Europe GmbH, NEC Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LIBUKBOOT_BANNER_H_
+#define _LIBUKBOOT_BANNER_H_
+
+#include <uk/config.h>
+#include <uk/essentials.h>
+#include <stdio.h>
+
+#if CONFIG_LIBUKBOOT_BANNER_NONE
+static inline void print_banner(FILE *out __unused) { }
+#else
+void print_banner(FILE *out);
+#endif
+
+#endif /* _LIBUKBOOT_BANNER_H_ */
diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 3e92812d..a4e12bf7 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -66,6 +66,7 @@
#if CONFIG_LIBUKSP
#include <uk/sp.h>
#endif
+#include "banner.h"
int main(int argc, char *argv[]) __weak;
@@ -101,15 +102,9 @@ static void main_thread_func(void *arg)
}
}
-#if CONFIG_LIBUKBOOT_BANNER
- printf("Welcome to _ __ _____\n");
- printf(" __ _____ (_) /__ _______ _/ _/ /_\n");
- printf("/ // / _ \\/ / '_// __/ _ `/ _/ __/\n");
- printf("\\_,_/_//_/_/_/\\_\\/_/ \\_,_/_/ \\__/\n");
- printf("%35s\n",
- STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+ print_banner(stdout);
fflush(stdout);
-#endif
+
/*
* Application
*
--
2.20.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |