]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen: add /buildinfo/config entry to hypervisor filesystem
authorJuergen Gross <jgross@suse.com>
Fri, 29 May 2020 10:15:54 +0000 (12:15 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 29 May 2020 10:15:54 +0000 (12:15 +0200)
Add the /buildinfo/config entry to the hypervisor filesystem. This
entry contains the .config file used to build the hypervisor.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
.gitignore
docs/misc/hypfs-paths.pandoc
xen/common/Kconfig
xen/common/Makefile
xen/common/kernel.c
xen/include/xen/kernel.h

index f5f9770de90da560442f46aa84e912e83fda69a5..36ce2ea104acea298778082afabc5a3ca15d6d36 100644 (file)
@@ -298,6 +298,8 @@ xen/arch/*/efi/boot.c
 xen/arch/*/efi/compat.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/runtime.c
+xen/common/config_data.S
+xen/common/config.gz
 xen/include/headers*.chk
 xen/include/asm
 xen/include/asm-*/asm-offsets.h
index d730caf3942b99c56508651ba305064f4c0721c1..9a76bc383bc3bc5c149c8bdf5a355bda3351c0c9 100644 (file)
@@ -135,6 +135,10 @@ Information about the compile domain.
 
 The compiler used to build Xen.
 
+#### /buildinfo/config = STRING [CONFIG_HYPFS_CONFIG]
+
+The contents of the `xen/.config` file at the time of the hypervisor build.
+
 #### /buildinfo/version/
 
 A directory containing version information of the hypervisor.
index e768ea36b2f3c271b2aa78d3a7898a7860fcbdd4..065f2ee454c1f4f665937985acb5ea0369b466c9 100644 (file)
@@ -127,6 +127,17 @@ config HYPFS
 
          If unsure, say Y.
 
+config HYPFS_CONFIG
+       bool "Provide hypervisor .config via hypfs entry"
+       default y
+       depends on HYPFS
+       ---help---
+         When enabled the contents of the .config file used to build the
+         hypervisor are provided via the hypfs entry /buildinfo/config.
+
+         Disable this option in case you want to spare some memory or you
+         want to hide the .config contents from dom0.
+
 config KEXEC
        bool "kexec support"
        default y
index bf7d0e25a3069b3419fbf3c544f8868087b5bb2d..91581e18157cd7f7ddd275ef0b5c6abca6e4b6a5 100644 (file)
@@ -1,6 +1,7 @@
 obj-$(CONFIG_ARGO) += argo.o
 obj-y += bitmap.o
 obj-y += bsearch.o
+obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
@@ -73,3 +74,14 @@ obj-$(CONFIG_UBSAN) += ubsan/
 
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
+
+config.gz: ../.config
+       gzip -c $< >$@
+
+config_data.o: config.gz
+
+config_data.S: $(XEN_ROOT)/xen/tools/binfile
+       $(SHELL) $(XEN_ROOT)/xen/tools/binfile $@ config.gz xen_config_data
+
+clean::
+       rm -f config_data.S config.gz 2>/dev/null
index db7bd23fcb728c4e19c55a306cf2b7fca5ed065b..0fb5b50b458a0c46d55ce7e23c17faa166ee6877 100644 (file)
@@ -390,6 +390,10 @@ static HYPFS_STRING_INIT(compile_date, "compile_date");
 static HYPFS_STRING_INIT(compile_domain, "compile_domain");
 static HYPFS_STRING_INIT(extra, "extra");
 
+#ifdef CONFIG_HYPFS_CONFIG
+static HYPFS_STRING_INIT(config, "config");
+#endif
+
 static int __init buildinfo_init(void)
 {
     hypfs_add_dir(&hypfs_root, &buildinfo, true);
@@ -415,6 +419,13 @@ static int __init buildinfo_init(void)
     hypfs_add_leaf(&version, &major, true);
     hypfs_add_leaf(&version, &minor, true);
 
+#ifdef CONFIG_HYPFS_CONFIG
+    config.e.encoding = XEN_HYPFS_ENC_GZIP;
+    config.e.size = xen_config_data_size;
+    config.u.content = xen_config_data;
+    hypfs_add_leaf(&buildinfo, &config, true);
+#endif
+
     return 0;
 }
 __initcall(buildinfo_init);
index 548b64da9ffee906bfe7de78fcfe4d0abb35bdd0..8cd142032d3bfa5d7c6c5e3568237f5e4cfd1553 100644 (file)
@@ -100,5 +100,8 @@ extern enum system_state {
 
 bool_t is_active_kernel_text(unsigned long addr);
 
+extern const char xen_config_data[];
+extern const unsigned int xen_config_data_size;
+
 #endif /* _LINUX_KERNEL_H */