From: "Jérôme Pouiller" <jezz@sysmic.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] qemu: allow to build statically
Date: Wed, 9 Nov 2016 11:03:05 +0100 [thread overview]
Message-ID: <20161109100305.6261-1-jezz@sysmic.org> (raw)
Compiling Qemu statically allows to use it to chroot into target/. It is a
nice feature, so add an option for it.
Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
---
package/qemu/Config.in.host | 26 ++++++++++++++++++++++++++
package/qemu/qemu.mk | 4 ++++
2 files changed, 30 insertions(+)
diff --git a/package/qemu/Config.in.host b/package/qemu/Config.in.host
index b3eb590..c61b787 100644
--- a/package/qemu/Config.in.host
+++ b/package/qemu/Config.in.host
@@ -17,6 +17,32 @@ config BR2_PACKAGE_HOST_QEMU
if BR2_PACKAGE_HOST_QEMU
+config BR2_PACKAGE_HOST_QEMU_STATIC
+ bool "Build statically"
+ help
+ Build static qemu executable(s). Use this option if you want to
+ 'chroot' in your target directory. An example to do this for an ARM
+ target:
+
+ 1. copy qemu binary on your target directory:
+
+ cp host/usr/bin/qemu-arm target/usr/bin
+
+ 2. Make sure binfmt_misc is mounted on /proc/sys/fs/binfmt_misc:
+
+ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
+
+ 3. Register /usr/bin/qemu-arm is interpreter for arm binaries. See
+ linux/Documentation/binfmt_misc.txt for more information:
+
+ MAGIC='\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00'
+ MASK='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
+ echo ":qemu-arm:M:0:$MAGIC:$MASK:/usr/bin/qemu-arm:OC" > /proc/sys/fs/binfmt_misc/register
+
+ 4. Chroot to your target:
+
+ chroot target /bin/sh
+
comment "Emulators selection"
config BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index cf23f16..d33106c 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -110,6 +110,10 @@ HOST_QEMU_OPTS += --enable-vde
HOST_QEMU_DEPENDENCIES += host-vde2
endif
+ifeq ($(BR2_PACKAGE_HOST_QEMU_STATIC),y)
+HOST_QEMU_OPTS += --static
+endif
+
# Override CPP, as it expects to be able to call it like it'd
# call the compiler.
define HOST_QEMU_CONFIGURE_CMDS
--
2.9.3
next reply other threads:[~2016-11-09 10:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 10:03 Jérôme Pouiller [this message]
2017-04-01 14:09 ` [Buildroot] [PATCH] qemu: allow to build statically Thomas Petazzoni
2017-04-02 12:37 ` Thomas Petazzoni
2017-04-02 21:14 ` Yann E. MORIN
2017-04-02 21:42 ` Thomas Petazzoni
2017-04-02 21:48 ` Yann E. MORIN
2017-04-03 20:52 ` Thomas Petazzoni
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=20161109100305.6261-1-jezz@sysmic.org \
--to=jezz@sysmic.org \
--cc=buildroot@busybox.net \
/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.