Display Debian package version in hypervisor log
authorBastian Blank <waldi@debian.org>
Sat, 5 Jul 2014 09:46:43 +0000 (11:46 +0200)
committerMaximilian Engelhardt <maxi@daemonizer.de>
Wed, 21 Dec 2022 21:40:24 +0000 (22:40 +0100)
During hypervisor boot, disable the banner and nicely display the xen
version as well as the Maintainer address from debian/control.

For this to work the SOURCE_BASE_DIR variable needs to be set by the
build system to the top directory, i.e. where the debian folder is.

Original patch by Bastian Blank <waldi@debian.org>
Modified by
Hans van Kranenburg <hans@knorrie.org>
Maximilian Engelhardt <maxi@daemonizer.de>

xen/build.mk
xen/common/kernel.c
xen/common/version.c
xen/drivers/char/console.c
xen/include/xen/compile.h.in
xen/include/xen/version.h

index 758590c68eab9b5f42a691efcb5a9165f9f0c358..8ee1fc9054dccf601138b97060ee1e1899deaede 100644 (file)
@@ -17,7 +17,6 @@ targets += .banner
 quiet_cmd_compile.h = UPD     $@
 define cmd_compile.h
     if [ ! -r $@ -o -O $@ ]; then \
-       cat .banner; \
        sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
            -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
            -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
@@ -28,13 +27,16 @@ define cmd_compile.h
            -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
            -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
            -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
+           -e 's/@@system_distribution@@/$(shell lsb_release -is)/g' \
+           -e 's/@@system_maintainer_domain@@/$(shell grep Maintainer ${SOURCE_BASE_DIR}/debian/control | sed -ne 's,^Maintainer: .[^<]*<[^@>]*@\([^>]*\)>,\1,p')/g' \
+           -e 's/@@system_maintainer_local@@/$(shell grep Maintainer ${SOURCE_BASE_DIR}/debian/control | sed -ne 's,^Maintainer: .[^<]*<\([^@>]*\)@.*>,\1,p')/g' \
+           -e 's/@@system_version@@/$(shell cd ${SOURCE_BASE_DIR}; dpkg-parsechangelog | awk '/^Version:/ {print $$2}')/g' \
            < $< > $(dot-target).tmp; \
-       sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tmp; \
        mv -f $(dot-target).tmp $@; \
     fi
 endef
 
-include/xen/compile.h: include/xen/compile.h.in .banner FORCE
+include/xen/compile.h: include/xen/compile.h.in FORCE
        $(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
        $(call if_changed,compile.h)
 
index f8134d3e7a9d3a867623eb7dce8525e6a5d2ec43..4ac3ba70f22ebca5da8050e4ce2d6330773b4651 100644 (file)
@@ -414,9 +414,9 @@ static int __init cf_check buildinfo_init(void)
 
     hypfs_add_dir(&buildinfo, &compileinfo, true);
     hypfs_string_set_reference(&compiler, xen_compiler());
-    hypfs_string_set_reference(&compile_by, xen_compile_by());
+    hypfs_string_set_reference(&compile_by, xen_compile_system_maintainer_local());
     hypfs_string_set_reference(&compile_date, xen_compile_date());
-    hypfs_string_set_reference(&compile_domain, xen_compile_domain());
+    hypfs_string_set_reference(&compile_domain, xen_compile_system_maintainer_domain());
     hypfs_add_leaf(&compileinfo, &compiler, true);
     hypfs_add_leaf(&compileinfo, &compile_by, true);
     hypfs_add_leaf(&compileinfo, &compile_date, true);
@@ -497,8 +497,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         memset(&info, 0, sizeof(info));
         safe_strcpy(info.compiler,       deny ? xen_deny() : xen_compiler());
-        safe_strcpy(info.compile_by,     deny ? xen_deny() : xen_compile_by());
-        safe_strcpy(info.compile_domain, deny ? xen_deny() : xen_compile_domain());
+        safe_strcpy(info.compile_by,     deny ? xen_deny() : xen_compile_system_maintainer_local());
+        safe_strcpy(info.compile_domain, deny ? xen_deny() : xen_compile_system_maintainer_domain());
         safe_strcpy(info.compile_date,   deny ? xen_deny() : xen_compile_date());
         if ( copy_to_guest(arg, &info, 1) )
             return -EFAULT;
index d32013520863dd01626f991f2bcada5741d980fc..b44d41175ec078186d99ca2e4b64a20c880e8fac 100644 (file)
@@ -20,19 +20,24 @@ const char *xen_compile_time(void)
     return XEN_COMPILE_TIME;
 }
 
-const char *xen_compile_by(void)
+const char *xen_compile_system_distribution(void)
 {
-    return XEN_COMPILE_BY;
+    return XEN_COMPILE_SYSTEM_DISTRIBUTION;
 }
 
-const char *xen_compile_domain(void)
+const char *xen_compile_system_maintainer_local(void)
 {
-    return XEN_COMPILE_DOMAIN;
+    return XEN_COMPILE_SYSTEM_MAINTAINER_LOCAL;
 }
 
-const char *xen_compile_host(void)
+const char *xen_compile_system_maintainer_domain(void)
 {
-    return XEN_COMPILE_HOST;
+    return XEN_COMPILE_SYSTEM_MAINTAINER_DOMAIN;
+}
+
+const char *xen_compile_system_version(void)
+{
+    return XEN_COMPILE_SYSTEM_VERSION;
 }
 
 const char *xen_compiler(void)
@@ -60,11 +65,6 @@ const char *xen_changeset(void)
     return XEN_CHANGESET;
 }
 
-const char *xen_banner(void)
-{
-    return XEN_BANNER;
-}
-
 const char *xen_deny(void)
 {
     return "<denied>";
index e8468c121ad057dd4ac6ff5ee1849e630ebbb094..0a5bf924c403ffdb9d2bcfc53d586e1feae9e909 100644 (file)
@@ -1000,14 +1000,11 @@ void __init console_init_preirq(void)
     pv_console_set_rx_handler(serial_rx);
 
     /* HELLO WORLD --- start-of-day banner text. */
-    spin_lock(&console_lock);
-    __putstr(xen_banner());
-    spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) %s %s\n",
+    printk("Xen version %d.%d%s (%s %s) (%s@%s) (%s) %s %s\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
-           xen_compile_by(), xen_compile_domain(), xen_compiler(),
-           xen_build_info(), xen_compile_date());
-    printk("Latest ChangeSet: %s\n", xen_changeset());
+           xen_compile_system_distribution(), xen_compile_system_version(),
+           xen_compile_system_maintainer_local(), xen_compile_system_maintainer_domain(),
+           xen_compiler(), xen_build_info(), xen_compile_date());
 
     /* Locate and print the buildid, if applicable. */
     xen_build_init();
index 3151d1e7d1bfd861abab3dabd6a883b6a7515707..b4f7c98951d1e7e1add8386b5b3939cecc334617 100644 (file)
@@ -1,8 +1,9 @@
 #define XEN_COMPILE_DATE       "@@date@@"
 #define XEN_COMPILE_TIME       "@@time@@"
-#define XEN_COMPILE_BY         "@@whoami@@"
-#define XEN_COMPILE_DOMAIN     "@@domain@@"
-#define XEN_COMPILE_HOST       "@@hostname@@"
+#define XEN_COMPILE_SYSTEM_DISTRIBUTION                "@@system_distribution@@"
+#define XEN_COMPILE_SYSTEM_MAINTAINER_DOMAIN   "@@system_maintainer_domain@@"
+#define XEN_COMPILE_SYSTEM_MAINTAINER_LOCAL    "@@system_maintainer_local@@"
+#define XEN_COMPILE_SYSTEM_VERSION             "@@system_version@@"
 #define XEN_COMPILER           "@@compiler@@"
 
 #define XEN_VERSION            @@version@@
@@ -11,4 +12,3 @@
 #define XEN_EXTRAVERSION       "@@extraversion@@"
 
 #define XEN_CHANGESET          "@@changeset@@"
-#define XEN_BANNER             \
index 93c58773630ccadb9b4325a6d07bcb4d2c75e5eb..9d98d6ea276b3554da7f113f5e06c3bd5b848569 100644 (file)
@@ -6,9 +6,10 @@
 
 const char *xen_compile_date(void);
 const char *xen_compile_time(void);
-const char *xen_compile_by(void);
-const char *xen_compile_domain(void);
-const char *xen_compile_host(void);
+const char *xen_compile_system_distribution(void);
+const char *xen_compile_system_maintainer_domain(void);
+const char *xen_compile_system_maintainer_local(void);
+const char *xen_compile_system_version(void);
 const char *xen_compiler(void);
 unsigned int xen_major_version(void);
 unsigned int xen_minor_version(void);