[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 1/9] xen: add a generic way to include binary files as variables

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 @@
+# usage: binfile [-i] <target-src.S> <binary-file> <varname>
+# -i     add to .init.rodata (default: .rodata) section
+[ "$1" = "-i" ] && {
+    shift
+    section=".init"
+cat <<EOF >$target
+#include <asm/asm_defns.h>
+        .section $section.rodata, "a", %progbits
+        .global $varname
+        .incbin "$binsource"
+        .type $varname, %object
+        .size $varname, . - $varname

I'd prefer if you used .Lend here as well.


I wonder whether, right from the beginning, there wouldn't better
be a way to also request better than byte alignment for such a

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.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.