All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v3 3/3] x86: check for multiboot{1, 2} header presence
Date: Thu, 27 Jun 2019 11:33:35 +0200	[thread overview]
Message-ID: <20190627093335.56355-3-roger.pau@citrix.com> (raw)
In-Reply-To: <20190627093335.56355-1-roger.pau@citrix.com>

After building the hypervisor binary. Note that the check is performed
by searching for the magic header value at the start of the binary.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>
---
Changes since v2:
 - Use a variable to store the intermediate file name.
 - Remove the intermediate file in the clean target.
 - Add intermediate file to gitignore.

Changes since v1:
 - Use an intermediate file to perform the header checks.
---
 .gitignore            | 1 +
 xen/arch/x86/Makefile | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index a77cbff02c..56bcb64837 100644
--- a/.gitignore
+++ b/.gitignore
@@ -278,6 +278,7 @@ tools/xentrace/xentrace
 xen/.banner
 xen/.config
 xen/.config.old
+xen/.xen
 xen/System.map
 xen/arch/x86/asm-macros.i
 xen/arch/x86/boot/mkelf32
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 8a8d8f060f..94e6c9aee3 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -99,9 +99,14 @@ endif
 syms-warn-dup-y := --warn-dup
 syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
 
+$(TARGET): TMP = $(@D)/.$(@F)
 $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
-	./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) $(XEN_IMG_OFFSET) \
+	./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
 	               `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
+	# Check for multiboot{1,2} headers
+	od -t x4 -N 8192 $(TMP) | grep 1badb002 > /dev/null
+	od -t x4 -N 32768 $(TMP) | grep e85250d6 > /dev/null
+	mv $(TMP) $(TARGET)
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
@@ -249,7 +254,7 @@ efi/mkreloc: efi/mkreloc.c
 clean::
 	rm -f asm-offsets.s *.lds boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f asm-macros.i $(BASEDIR)/include/asm-x86/asm-macros.*
-	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
+	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
 	rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
 	rm -f note.o
-- 
2.20.1 (Apple Git-117)


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

  parent reply	other threads:[~2019-06-27  9:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27  9:33 [Xen-devel] [PATCH v3 1/3] x86/linker: add a reloc section to ELF linker script Roger Pau Monne
2019-06-27  9:33 ` [Xen-devel] [PATCH v3 2/3] xen/link: handle .init.rodata.cst* sections in the " Roger Pau Monne
2019-06-27 10:53   ` Andrew Cooper
2019-06-27 11:25     ` Jan Beulich
2019-06-27 13:26       ` Roger Pau Monné
2019-06-27  9:33 ` Roger Pau Monne [this message]
2019-06-27 11:26   ` [Xen-devel] [PATCH v3 3/3] x86: check for multiboot{1, 2} header presence Jan Beulich
2019-06-27 11:51   ` Andrew Cooper
2019-06-27 12:10     ` Jan Beulich
2019-06-27 12:36       ` Andrew Cooper
2019-06-27 13:08     ` Roger Pau Monné
2019-06-27 10:59 ` [Xen-devel] [PATCH v3 1/3] x86/linker: add a reloc section to ELF linker script Andrew Cooper
2019-06-27 11:07   ` Roger Pau Monné
2019-06-27 11:27     ` Andrew Cooper
2019-06-27 11:23 ` Jan Beulich

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=20190627093335.56355-3-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.