diff options
author | Jérôme Pouiller <jezz@sysmic.org> | 2016-11-09 11:03:05 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-04-01 16:08:38 +0200 |
commit | a6afa968fc9080080b943885b8599475df9e36c4 (patch) | |
tree | da791912f294b39353bdabccd1b9ad3292ae2b07 | |
parent | ef9e1d0e4b4e6032f8945a00de7c41308db64719 (diff) | |
download | buildroot-a6afa968fc9080080b943885b8599475df9e36c4.tar.gz buildroot-a6afa968fc9080080b943885b8599475df9e36c4.zip |
qemu: allow to build host variant statically
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>
[Thomas: slightly tweak Config.in help text.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r-- | package/qemu/Config.in.host | 28 | ||||
-rw-r--r-- | package/qemu/qemu.mk | 4 |
2 files changed, 32 insertions, 0 deletions
diff --git a/package/qemu/Config.in.host b/package/qemu/Config.in.host index b3eb5906cc..fbe27bddd2 100644 --- a/package/qemu/Config.in.host +++ b/package/qemu/Config.in.host @@ -17,6 +17,34 @@ config BR2_PACKAGE_HOST_QEMU if BR2_PACKAGE_HOST_QEMU +config BR2_PACKAGE_HOST_QEMU_STATIC + bool "Build statically" + help + Build qemu as a statically linked executable. Use this + option if you want to 'chroot' in your target directory. The + following steps detail how to achieve this with an ARM + target: + + 1. Copy the qemu binary in 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 into 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 2b6aafbae8..4eea982630 100644 --- a/package/qemu/qemu.mk +++ b/package/qemu/qemu.mk @@ -120,6 +120,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 |