xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: [Xen-devel] [PATCH v3 1/9] xen: add a generic way to include binary files as variables
Date: Tue, 21 Jan 2020 09:43:22 +0100	[thread overview]
Message-ID: <20200121084330.18309-2-jgross@suse.com> (raw)
In-Reply-To: <20200121084330.18309-1-jgross@suse.com>

Add a new script xen/tools/binfile for including a binary file at build
time being usable via a pointer and a size variable in the hypervisor.

Make use of that generic tool in xsm.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V3:
- new patch
---
 .gitignore                   |  1 +
 xen/tools/binfile            | 29 +++++++++++++++++++++++++++++
 xen/xsm/flask/Makefile       |  5 ++++-
 xen/xsm/flask/flask-policy.S | 16 ----------------
 4 files changed, 34 insertions(+), 17 deletions(-)
 create mode 100755 xen/tools/binfile
 delete mode 100644 xen/xsm/flask/flask-policy.S

diff --git a/.gitignore b/.gitignore
index 4ca679ddbc..b2624df79a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -313,6 +313,7 @@ xen/test/livepatch/*.livepatch
 xen/tools/kconfig/.tmp_gtkcheck
 xen/tools/kconfig/.tmp_qtcheck
 xen/tools/symbols
+xen/xsm/flask/flask-policy.S
 xen/xsm/flask/include/av_perm_to_string.h
 xen/xsm/flask/include/av_permissions.h
 xen/xsm/flask/include/class_to_string.h
diff --git a/xen/tools/binfile b/xen/tools/binfile
new file mode 100755
index 0000000000..122111ff6d
--- /dev/null
+++ b/xen/tools/binfile
@@ -0,0 +1,29 @@
+#!/bin/sh
+# usage: binfile [-i] <target-src.S> <binary-file> <varname>
+# -i     add to .init.rodata (default: .rodata) section
+
+[ "$1" = "-i" ] && {
+    shift
+    section=".init"
+}
+
+target=$1
+binsource=$2
+varname=$3
+
+cat <<EOF >$target
+#include <asm/asm_defns.h>
+
+        .section $section.rodata, "a", %progbits
+
+        .global $varname
+$varname:
+        .incbin "$binsource"
+.Lend:
+
+        .type $varname, %object
+        .size $varname, . - $varname
+
+        .global ${varname}_size
+        ASM_INT(${varname}_size, .Lend - $varname)
+EOF
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 7c3f381287..a807521235 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -30,6 +30,9 @@ $(AV_H_FILES): $(AV_H_DEPEND)
 obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
 flask-policy.o: policy.bin
 
+flask-policy.S: $(XEN_ROOT)/xen/tools/binfile
+	$(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy
+
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
 
@@ -39,4 +42,4 @@ policy.bin: FORCE
 
 .PHONY: clean
 clean::
-	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC)
+	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC) flask-policy.S
diff --git a/xen/xsm/flask/flask-policy.S b/xen/xsm/flask/flask-policy.S
deleted file mode 100644
index d38aa39964..0000000000
--- a/xen/xsm/flask/flask-policy.S
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <asm/asm_defns.h>
-
-        .section .init.rodata, "a", %progbits
-
-/* const unsigned char xsm_flask_init_policy[] __initconst */
-        .global xsm_flask_init_policy
-xsm_flask_init_policy:
-        .incbin "policy.bin"
-.Lend:
-
-        .type xsm_flask_init_policy, %object
-        .size xsm_flask_init_policy, . - xsm_flask_init_policy
-
-/* const unsigned int __initconst xsm_flask_init_policy_size */
-        .global xsm_flask_init_policy_size
-        ASM_INT(xsm_flask_init_policy_size, .Lend - xsm_flask_init_policy)
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-01-21  8:44 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21  8:43 [Xen-devel] [PATCH v3 0/9] Add hypervisor sysfs-like support Juergen Gross
2020-01-21  8:43 ` Juergen Gross [this message]
2020-02-03 13:39   ` [Xen-devel] [PATCH v3 1/9] xen: add a generic way to include binary files as variables Jan Beulich
2020-02-03 14:02     ` Jürgen Groß
2020-02-03 15:18       ` Jan Beulich
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 2/9] xen: split parameter related definitions in own header file Juergen Gross
2020-01-21 13:00   ` Julien Grall
2020-01-21 13:28     ` Jürgen Groß
2020-01-21 13:31       ` Julien Grall
2020-01-22  1:34   ` Dario Faggioli
2020-01-22 11:28   ` Durrant, Paul
2020-01-22 16:49   ` Jan Beulich
2020-02-03  5:37   ` Tian, Kevin
2020-02-03 12:13   ` Jan Beulich
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 3/9] docs: add feature document for Xen hypervisor sysfs-like support Juergen Gross
2020-01-21 13:14   ` Julien Grall
2020-01-21 14:17     ` Jürgen Groß
2020-02-03 10:29       ` Julien Grall
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 4/9] xen: add basic hypervisor filesystem support Juergen Gross
2020-01-31 15:50   ` Wei Liu
2020-02-03  9:12     ` Jürgen Groß
2020-02-03 15:07   ` Jan Beulich
2020-02-04  6:43     ` Jürgen Groß
2020-02-04  8:48       ` Jan Beulich
2020-02-04  9:21         ` Jürgen Groß
2020-02-04  9:58           ` Jan Beulich
2020-02-04 10:48             ` Jürgen Groß
2020-02-04 11:28               ` Jan Beulich
2020-02-04 11:38                 ` Jürgen Groß
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 5/9] libs: add libxenhypfs Juergen Gross
2020-01-31 15:57   ` Wei Liu
2020-02-03  9:14     ` Jürgen Groß
2020-06-03  6:10       ` Olaf Hering
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 6/9] tools: add xenfs tool Juergen Gross
2020-01-31 15:59   ` Wei Liu
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 7/9] xen: provide version information in hypfs Juergen Gross
2020-02-03 17:02   ` Jan Beulich
2020-02-04  6:44     ` Jürgen Groß
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 8/9] xen: add /buildinfo/config entry to hypervisor filesystem Juergen Gross
2020-01-21  8:43 ` [Xen-devel] [PATCH v3 9/9] xen: add runtime parameter access support to hypfs Juergen Gross
2020-01-26 22:05 ` [Xen-devel] [PATCH v3 0/9] Add hypervisor sysfs-like support Rich Persaud
2020-01-27  5:37   ` Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200121084330.18309-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).