All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] qemu: allow to build statically
@ 2016-11-09 10:03 Jérôme Pouiller
  2017-04-01 14:09 ` Thomas Petazzoni
  2017-04-02 12:37 ` Thomas Petazzoni
  0 siblings, 2 replies; 7+ messages in thread
From: Jérôme Pouiller @ 2016-11-09 10:03 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] qemu: allow to build statically
  2016-11-09 10:03 [Buildroot] [PATCH] qemu: allow to build statically Jérôme Pouiller
@ 2017-04-01 14:09 ` Thomas Petazzoni
  2017-04-02 12:37 ` Thomas Petazzoni
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2017-04-01 14:09 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  9 Nov 2016 11:03:05 +0100, J?r?me Pouiller wrote:
> 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(+)

Applied to master after tweaking a bit the Config.in help text. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] qemu: allow to build statically
  2016-11-09 10:03 [Buildroot] [PATCH] qemu: allow to build statically Jérôme Pouiller
  2017-04-01 14:09 ` Thomas Petazzoni
@ 2017-04-02 12:37 ` Thomas Petazzoni
  2017-04-02 21:14   ` Yann E. MORIN
  2017-04-03 20:52   ` Thomas Petazzoni
  1 sibling, 2 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2017-04-02 12:37 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  9 Nov 2016 11:03:05 +0100, J?r?me Pouiller wrote:
> 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(+)

Now that this patch is committed, we are seeing some build failures on
host-qemu when linked statically:

  http://autobuild.buildroot.net/results/6bc/6bcfabc020fede51adcfafc9a570df5884d95696/build-end.log
  http://autobuild.buildroot.net/results/4d0/4d0182da77cf386e57acf0565a18fc4628abbdc8/build-end.log

Could you have a look?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] qemu: allow to build statically
  2017-04-02 12:37 ` Thomas Petazzoni
@ 2017-04-02 21:14   ` Yann E. MORIN
  2017-04-02 21:42     ` Thomas Petazzoni
  2017-04-03 20:52   ` Thomas Petazzoni
  1 sibling, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2017-04-02 21:14 UTC (permalink / raw)
  To: buildroot

J?r?me, All,

On 2017-04-02 14:37 +0200, Thomas Petazzoni spake thusly:
> On Wed,  9 Nov 2016 11:03:05 +0100, J?r?me Pouiller wrote:
> > 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(+)
> 
> Now that this patch is committed, we are seeing some build failures on
> host-qemu when linked statically:
> 
>   http://autobuild.buildroot.net/results/6bc/6bcfabc020fede51adcfafc9a570df5884d95696/build-end.log
>   http://autobuild.buildroot.net/results/4d0/4d0182da77cf386e57acf0565a18fc4628abbdc8/build-end.log
> 
> Could you have a look?

Feel free to grab patches from my okd series (which I lost intetrest in
sometime ago):

    https://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/target-qemu

At the time, I had full and complete static-link support with a lot of
additional dependencies...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] qemu: allow to build statically
  2017-04-02 21:14   ` Yann E. MORIN
@ 2017-04-02 21:42     ` Thomas Petazzoni
  2017-04-02 21:48       ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2017-04-02 21:42 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 2 Apr 2017 23:14:29 +0200, Yann E. MORIN wrote:

> Feel free to grab patches from my okd series (which I lost intetrest in
> sometime ago):
> 
>     https://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/target-qemu
> 
> At the time, I had full and complete static-link support with a lot of
> additional dependencies...

Thanks for pointing out those patches. However, to be honest, I myself
have no interest in having host qemu built statically, so if J?r?me
doesn't send patches to fix the breakage, I'll simply revert his patch.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] qemu: allow to build statically
  2017-04-02 21:42     ` Thomas Petazzoni
@ 2017-04-02 21:48       ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2017-04-02 21:48 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2017-04-02 23:42 +0200, Thomas Petazzoni spake thusly:
> Hello,
> 
> On Sun, 2 Apr 2017 23:14:29 +0200, Yann E. MORIN wrote:
> 
> > Feel free to grab patches from my okd series (which I lost intetrest in
> > sometime ago):
> > 
> >     https://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/target-qemu
> > 
> > At the time, I had full and complete static-link support with a lot of
> > additional dependencies...
> 
> Thanks for pointing out those patches. However, to be honest, I myself
> have no interest in having host qemu built statically, so if J?r?me
> doesn't send patches to fix the breakage, I'll simply revert his patch.

Yes, my message was mostly aimed at J?r?me. ;-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] qemu: allow to build statically
  2017-04-02 12:37 ` Thomas Petazzoni
  2017-04-02 21:14   ` Yann E. MORIN
@ 2017-04-03 20:52   ` Thomas Petazzoni
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2017-04-03 20:52 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 2 Apr 2017 14:37:17 +0200, Thomas Petazzoni wrote:

> On Wed,  9 Nov 2016 11:03:05 +0100, J?r?me Pouiller wrote:
> > 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(+)  
> 
> Now that this patch is committed, we are seeing some build failures on
> host-qemu when linked statically:
> 
>   http://autobuild.buildroot.net/results/6bc/6bcfabc020fede51adcfafc9a570df5884d95696/build-end.log
>   http://autobuild.buildroot.net/results/4d0/4d0182da77cf386e57acf0565a18fc4628abbdc8/build-end.log
> 
> Could you have a look?

FWIW, I've reverted this patch. It's a feature that already wasn't seen
as very essential, and it's causing some build failures.

I don't think it's really easy to provide a functionality that allows
to build a host executable as a static binary, because most host
systems use glibc, and glibc doesn't officially support static linking.

Feel free to investigate those build failures (see the commit log for
the three different build failures) and send an updated version that
makes sure those build failures are fixed.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-03 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-09 10:03 [Buildroot] [PATCH] qemu: allow to build statically Jérôme Pouiller
2017-04-01 14:09 ` 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

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.