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

[Minios-devel] [UNIKRAFT PATCH v2 02/10] lib/ukboot: Use printf() for banner and weak main()



Instead of using libukdebug's kernel console we print directly to
stdout with printf(). This makes the libukboot banner independent of
any print level configuration from libukdebug.  To make sure that the
corresponding libc had the chance to initialize its printf(), we move
the banner right before calling main.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 lib/ukboot/boot.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 93f3371..1aaa683 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -38,6 +38,7 @@
 #include <uk/config.h>
 
 #include <stddef.h>
+#include <stdio.h>
 #include <errno.h>
 
 #if CONFIG_LIBUKALLOC && CONFIG_LIBUKALLOCBBUDDY && CONFIG_LIBUKBOOT_INITALLOC
@@ -103,6 +104,15 @@ static void main_thread_func(void *arg)
        liblwip_init();
 #endif /* CONFIG_LIBLWIP */
 
+#if CONFIG_LIBUKBOOT_BANNER
+       printf("Welcome to  _ __             _____\n");
+       printf(" __ _____  (_) /__ _______ _/ _/ /_\n");
+       printf("/ // / _ \\/ /  '_// __/ _ `/ _/ __/\n");
+       printf("\\_,_/_//_/_/_/\\_\\/_/  \\_,_/_/ \\__/\n");
+       printf("%35s\n",
+              STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+#endif
+
        /* call main */
        ret = main(tma->argc, tma->argv);
        uk_printd(DLVL_INFO, "main returned %d, halting system\n", ret);
@@ -145,15 +155,6 @@ void ukplat_entry(int argc, char *argv[])
        struct uk_thread *main_thread = NULL;
 #endif
 
-#if CONFIG_LIBUKBOOT_BANNER
-       uk_printk("Welcome to  _ __             _____\n");
-       uk_printk(" __ _____  (_) /__ _______ _/ _/ /_\n");
-       uk_printk("/ // / _ \\/ /  '_// __/ _ `/ _/ __/\n");
-       uk_printk("\\_,_/_//_/_/_/\\_\\/_/  \\_,_/_/ \\__/\n");
-       uk_printk("%35s\n",
-                 STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
-#endif
-
        uk_printd(DLVL_INFO, "Pre-init table at %p - %p\n",
                  __preinit_array_start, &__preinit_array_end);
        ukplat_ctor_foreach(__preinit_array_start, __preinit_array_end, i) {
@@ -270,6 +271,6 @@ void ukplat_entry(int argc, char *argv[])
 /* Internal main */
 int main(int argc __unused, char *argv[] __unused)
 {
-       uk_printkd(DLVL_ERR, "weak main() called. Symbol was not replaced!\n");
+       printf("weak main() called. Symbol was not replaced!\n");
        return -EINVAL;
 }
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.