On 03.02.20 14:39, Jan Beulich wrote:
On 21.01.2020 09:43, Juergen Gross wrote:
--- /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
I'd prefer if you used .Lend here as well.
Okay.
I wonder whether, right from the beginning, there wouldn't better
be a way to also request better than byte alignment for such a
blob.
I can add that. What about "-a <n>" for 2^n alignment?
--- 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
Doesn't objcopy provide a means to convert a binary blob into
an ELF object containing the binary data from the input file?
If so, why involve the assembler and an intermediate file here?
I can see how to add a symbol for that purpose using a dedicated section
for each blob, but how to add the size information of the blob?
In the end I just followed commit 8d5671eb31e4bf for the inclusion of
the blob.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel