From nobody Tue Nov 11 08:45:25 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1569574952; cv=none; d=zoho.com; s=zohoarc; b=kKHwlYS0+R24abf3EaNZnX/dWZfVcn/DD2/3cBoQvcBoLRoSFwoXWXFuLduLa86E/0CAbEb+jWJW45fYL3cE67QWpseqCNmqdd9p8yUtso6eLL6aeH3PQIus68nQbCot+MZfPLm5VqgjCdHzcmOEhTQXg4CxWjpiIZgDMQ25rr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569574952; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TNIRlkAgI4MsC5dlMEB9k39mo0b9o9Vwiq15OpOVAIY=; b=kqVxZY0Qph1+n7ijq1HNFg3pQ/i9S6f++kQkjCVPGEzS5/QDL+Pp6sDYDQACJt8wPPvfk4lPRJeKrJqpjJr09ehSzLUL8juYRHvrQcFx7wMTl/lc9PRygbvfJe93GvoOJd/T/0/c6kFrioAGLMrBr8vmDBYeMgVK6wQU8q0NrTk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1569574952990351.1298829830107; Fri, 27 Sep 2019 02:02:32 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDm7d-0005UJ-Op; Fri, 27 Sep 2019 09:01:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDm7b-0005SW-Vv for xen-devel@lists.xenproject.org; Fri, 27 Sep 2019 09:01:04 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 4ec16aa4-e105-11e9-9671-12813bfff9fa; Fri, 27 Sep 2019 09:00:52 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D716CAFE8; Fri, 27 Sep 2019 09:00:51 +0000 (UTC) X-Inumbo-ID: 4ec16aa4-e105-11e9-9671-12813bfff9fa X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 27 Sep 2019 11:00:47 +0200 Message-Id: <20190927090048.28872-6-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190927090048.28872-1-jgross@suse.com> References: <20190927090048.28872-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v1 5/6] xen: add /buildinfo/config entry to hypervisor filesystem X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 --- .gitignore | 2 ++ docs/misc/hypfs-paths.pandoc | 9 +++++++++ xen/common/Makefile | 9 +++++++++ xen/common/hypfs.c | 17 +++++++++++++++++ xen/include/xen/kernel.h | 2 ++ xen/tools/Makefile | 9 +++++++-- xen/tools/bin2c.c | 28 ++++++++++++++++++++++++++++ 7 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 xen/tools/bin2c.c diff --git a/.gitignore b/.gitignore index 954c1da2cb..16dfbb8302 100644 --- a/.gitignore +++ b/.gitignore @@ -295,6 +295,7 @@ xen/arch/*/efi/boot.c xen/arch/*/efi/compat.c xen/arch/*/efi/efi.h xen/arch/*/efi/runtime.c +xen/common/config_data.c xen/include/headers*.chk xen/include/asm xen/include/asm-*/asm-offsets.h @@ -312,6 +313,7 @@ xen/test/livepatch/xen_bye_world.livepatch xen/test/livepatch/xen_hello_world.livepatch xen/test/livepatch/xen_nop.livepatch xen/test/livepatch/xen_replace_world.livepatch +xen/tools/bin2c xen/tools/kconfig/.tmp_gtkcheck xen/tools/kconfig/.tmp_qtcheck xen/tools/symbols diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc index 2fe5455e6f..56ebdcd8be 100644 --- a/docs/misc/hypfs-paths.pandoc +++ b/docs/misc/hypfs-paths.pandoc @@ -53,3 +53,12 @@ tags enclosed in square brackets. #### / =20 The root of the hypervisor file system. + +#### /buildinfo/ + +A directory containing static information generated while building the +hypervisor. + +#### /buildinfo/config =3D STRING + +The contents of the `xen/.config` file at the time of the hypervisor build. diff --git a/xen/common/Makefile b/xen/common/Makefile index a3f66aa0c0..de7e0fa645 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -1,6 +1,7 @@ obj-$(CONFIG_ARGO) +=3D argo.o obj-y +=3D bitmap.o obj-y +=3D bsearch.o +obj-y +=3D config_data.o obj-$(CONFIG_CORE_PARKING) +=3D core_parking.o obj-y +=3D cpu.o obj-y +=3D cpupool.o @@ -79,3 +80,11 @@ subdir-$(CONFIG_UBSAN) +=3D ubsan =20 subdir-$(CONFIG_NEEDS_LIBELF) +=3D libelf subdir-$(CONFIG_HAS_DEVICE_TREE) +=3D libfdt + +config_data.c: ../.config + ( echo "char xen_config_data[] =3D"; \ + ../tools/bin2c <$<; \ + echo ";" ) > $@ + +clean:: + rm config_data.c 2>/dev/null || true diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c index 7d9595dfa7..11b7b36e56 100644 --- a/xen/common/hypfs.c +++ b/xen/common/hypfs.c @@ -25,6 +25,10 @@ static struct hypfs_entry hypfs_root_entry =3D { .dir =3D &hypfs_root, }; =20 +static struct hypfs_dir hypfs_buildinfo =3D { + .list =3D LIST_HEAD_INIT(hypfs_buildinfo.list), +}; + static int hypfs_add_entry(struct hypfs_dir *parent, struct hypfs_entry *n= ew) { int ret =3D -ENOENT; @@ -312,3 +316,16 @@ long do_hypfs_op(unsigned int cmd, =20 return ret; } + +static int __init hypfs_init(void) +{ + int ret; + + ret =3D hypfs_new_dir(&hypfs_root, "buildinfo", &hypfs_buildinfo); + BUG_ON(ret); + ret =3D hypfs_new_entry_string(&hypfs_buildinfo, "config", xen_config_= data); + BUG_ON(ret); + + return 0; +} +__initcall(hypfs_init); diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h index 548b64da9f..5ff2280b0f 100644 --- a/xen/include/xen/kernel.h +++ b/xen/include/xen/kernel.h @@ -100,5 +100,7 @@ extern enum system_state { =20 bool_t is_active_kernel_text(unsigned long addr); =20 +extern char xen_config_data[]; + #endif /* _LINUX_KERNEL_H */ =20 diff --git a/xen/tools/Makefile b/xen/tools/Makefile index e940939d61..cd2bbbf647 100644 --- a/xen/tools/Makefile +++ b/xen/tools/Makefile @@ -1,13 +1,18 @@ =20 include $(XEN_ROOT)/Config.mk =20 +PROGS =3D symbols bin2c + .PHONY: default default: - $(MAKE) symbols + $(MAKE) $(PROGS) =20 .PHONY: clean clean: - rm -f *.o symbols + rm -f *.o $(PROGS) =20 symbols: symbols.c $(HOSTCC) $(HOSTCFLAGS) -o $@ $< + +bin2c: bin2c.c + $(HOSTCC) $(HOSTCFLAGS) -o $@ $< diff --git a/xen/tools/bin2c.c b/xen/tools/bin2c.c new file mode 100644 index 0000000000..c332399b70 --- /dev/null +++ b/xen/tools/bin2c.c @@ -0,0 +1,28 @@ +/* + * Unloved program to convert a binary on stdin to a C include on stdout + * + * Jan 1999 Matt Mackall + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#include + +int main(int argc, char *argv[]) +{ + int ch, total =3D 0; + + do { + printf("\t\""); + while ((ch =3D getchar()) !=3D EOF) { + total++; + printf("\\x%02x", ch); + if (total % 16 =3D=3D 0) + break; + } + printf("\"\n"); + } while (ch !=3D EOF); + + return 0; +} --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel