1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
From: Bastian Blank <waldi@debian.org>
Date: Sat, 5 Jul 2014 11:46:43 +0200
Subject: Display Debian package version in hypervisor log
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 DEB_VERSION and DEB_MAINTAINER variables needs to
be set by debian/rules.
Original patch by Bastian Blank <waldi@debian.org>
Modified by
Hans van Kranenburg <hans@knorrie.org>
Maximilian Engelhardt <maxi@daemonizer.de>
---
xen/build.mk | 8 +++++---
xen/common/kernel.c | 8 ++++----
xen/common/version.c | 22 +++++++++++-----------
xen/drivers/char/console.c | 11 ++++-------
xen/include/xen/compile.h.in | 8 ++++----
xen/include/xen/version.h | 8 ++++----
6 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/xen/build.mk b/xen/build.mk
index 942ff38..872b529 100644
--- a/xen/build.mk
+++ b/xen/build.mk
@@ -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 echo "${DEB_MAINTAINER}" | sed -ne 's,^.[^<]*<[^@>]*@\([^>]*\)>,\1,p')/g' \
+ -e 's/@@system_maintainer_local@@/$(shell echo "${DEB_MAINTAINER}" | sed -ne 's,^.[^<]*<\([^@>]*\)@.*>,\1,p')/g' \
+ -e 's/@@system_version@@/$(shell echo "${DEB_VERSION}")/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)
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 8b63ca5..3381a70 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -455,9 +455,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);
@@ -594,8 +594,8 @@ long 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;
diff --git a/xen/common/version.c b/xen/common/version.c
index bc3714b..a275e38 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -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>";
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2926c97..9050552 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1035,14 +1035,11 @@ void __init console_init_preirq(void)
pv_console_set_rx_handler(serial_rx);
/* HELLO WORLD --- start-of-day banner text. */
- nrspin_lock(&console_lock);
- __putstr(xen_banner());
- nrspin_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();
diff --git a/xen/include/xen/compile.h.in b/xen/include/xen/compile.h.in
index 3151d1e..b4f7c98 100644
--- a/xen/include/xen/compile.h.in
+++ b/xen/include/xen/compile.h.in
@@ -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 \
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 4856ad1..4373de90 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -6,15 +6,15 @@
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);
const char *xen_extra_version(void);
const char *xen_changeset(void);
-const char *xen_banner(void);
const char *xen_deny(void);
const char *xen_build_info(void);
int xen_build_id(const void **p, unsigned int *len);
|