Patchwork [11/36] package/qemu: new package

login
register
mail settings
Submitter Yann E. MORIN
Date Aug. 12, 2012, 11:53 p.m.
Message ID <1344815664-28138-11-git-send-email-yann.morin.1998@free.fr>
Download mbox | patch
Permalink /patch/176821/
State RFC
Headers show

Comments

Yann E. MORIN - Aug. 12, 2012, 11:53 p.m.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/Config.in      |    1 +
 package/qemu/Config.in |   24 ++++++++++++
 package/qemu/qemu.mk   |   98 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 package/qemu/Config.in
 create mode 100644 package/qemu/qemu.mk
Yann E. MORIN - Aug. 13, 2012, 6:52 a.m.
Thomas, All,

On Monday 13 August 2012 01:53:59 Yann E. MORIN wrote:
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  package/Config.in      |    1 +
>  package/qemu/Config.in |   24 ++++++++++++
>  package/qemu/qemu.mk   |   98 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 123 insertions(+), 0 deletions(-)
>  create mode 100644 package/qemu/Config.in
>  create mode 100644 package/qemu/qemu.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 3109591..eb02983 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -504,6 +504,7 @@ menu "Miscellaneous"
>  source "package/collectd/Config.in"
>  source "package/empty/Config.in"
>  source "package/mobile-broadband-provider-info/Config.in"
> +source "package/qemu/Config.in"
>  source "package/shared-mime-info/Config.in"
>  source "package/sound-theme-borealis/Config.in"
>  source "package/sound-theme-freedesktop/Config.in"
> diff --git a/package/qemu/Config.in b/package/qemu/Config.in
> new file mode 100644
> index 0000000..a77d863
> --- /dev/null
> +++ b/package/qemu/Config.in
> @@ -0,0 +1,24 @@
> +config BR2_PACKAGE_QEMU
> +	bool "QEMU"
> +	depends on BR2_PACKAGE_PYTHON       # We only need host-python,
> +	                                    # but there's no way to say so.

And I forgot to add this dependency in the .mk. I'll repush this series
later with this change.

Regards,
Yann E. MORIN.
Diego Iastrubni - Aug. 13, 2012, 7:22 a.m.
Let me understand this: you are trying to build QEMU for the host ?

If you can also hook up some magic woodo to execute the image as well
("make qemu-run" for example) that would really be great.

I was thinking of adding this my self, by setting some new vars depending
on the CPU arch chosen, and other tricks. I am still unsure about the
details, as this is an idea I toyed with late night.

On Mon, Aug 13, 2012 at 2:53 AM, Yann E. MORIN <yann.morin.1998@free.fr>wrote:

> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  package/Config.in      |    1 +
>  package/qemu/Config.in |   24 ++++++++++++
>  package/qemu/qemu.mk   |   98
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 123 insertions(+), 0 deletions(-)
>  create mode 100644 package/qemu/Config.in
>  create mode 100644 package/qemu/qemu.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 3109591..eb02983 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -504,6 +504,7 @@ menu "Miscellaneous"
>  source "package/collectd/Config.in"
>  source "package/empty/Config.in"
>  source "package/mobile-broadband-provider-info/Config.in"
> +source "package/qemu/Config.in"
>  source "package/shared-mime-info/Config.in"
>  source "package/sound-theme-borealis/Config.in"
>  source "package/sound-theme-freedesktop/Config.in"
> diff --git a/package/qemu/Config.in b/package/qemu/Config.in
> new file mode 100644
> index 0000000..a77d863
> --- /dev/null
> +++ b/package/qemu/Config.in
> @@ -0,0 +1,24 @@
> +config BR2_PACKAGE_QEMU
> +       bool "QEMU"
> +       depends on BR2_PACKAGE_PYTHON       # We only need host-python,
> +                                           # but there's no way to say so.
> +       select BR2_PACKAGE_ZLIB
> +       select BR2_PACKAGE_LIBGLIB2
> +       help
> +         QEMU is a generic and open source machine emulator and
> virtualizer.
> +
> +         When used as a machine emulator, QEMU can run OSes and programs
> made
> +         for one machine (e.g. an ARM board) on a different machine (e.g.
> +         your own PC). By using dynamic translation, it achieves very good
> +         performance.
> +
> +         When used as a virtualizer, QEMU achieves near native
> performances
> +         by executing the guest code directly on the host CPU. QEMU
> supports
> +         virtualization when executing under the Xen hypervisor or using
> the
> +         KVM kernel module in Linux. When using KVM, QEMU can virtualize
> x86,
> +         server and embedded PowerPC, and S390 guests.
> +
> +         http://qemu.org/
> +
> +comment "QEMU requires python"
> +       depends on !BR2_PACKAGE_PYTHON
> diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
> new file mode 100644
> index 0000000..3825731
> --- /dev/null
> +++ b/package/qemu/qemu.mk
> @@ -0,0 +1,98 @@
>
> +#-----------------------------------------------------------------------------
> +# Package description
> +
> +QEMU_VERSION = 1.1.1-1
> +QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2
> +QEMU_SITE = http://wiki.qemu.org/download
> +QEMU_LICENSE = GPLv2 LGPLv2.1 MIT BSD-3c BSD-2c Others/BSD-1c
> +QEMU_LICENSE_FILES = COPYING COPYING.LIB
> +# NOTE: there is no top-level license file for non-(L)GPL licenses;
> +#       the non-(L)GPL license texts are specified in the affected
> +#       individual source files.
> +
>
> +#-----------------------------------------------------------------------------
> +# Package unconditional configuration
> +
> +QEMU_DEPENDENCIES = zlib libglib2
> +
>
> +#-----------------------------------------------------------------------------
> +# Package conditional configuration
> +
> +# Need the LIBS variable because librt and libm are
> +# not automatically pulled. :-(
> +QEMU_LIBS = -lrt -lm
> +
> +QEMU_OPTS =
> +QEMU_VARS =
> +
>
> +#----------------------------------------------------------------------------
> +# Package build process
> +
> +# Note: although QEMU uses a ./configure script, it is not compatible with
> +#       the traditional autotools options (eg. --target et al.), so we can
> +#       not use the autotools-package infrastructure. So we have to use
> the
> +#       generic-package infra instead. Sigh... :-(
> +
> +define QEMU_CONFIGURE_CMDS
> +       ( cd $(@D);                                 \
> +           LIBS='$(QEMU_LIBS)'                     \
> +           $(TARGET_CONFIGURE_OPTS)                \
> +           $(TARGET_CONFIGURE_ARGS)                \
> +           $(QEMU_VARS)                            \
> +           ./configure                             \
> +               --prefix=/usr                       \
> +               --cross-prefix=$(TARGET_CROSS)      \
> +               --audio-drv-list=                   \
> +               --audio-card-list=                  \
> +               --enable-kvm                        \
> +               --enable-nptl                       \
> +               --enable-attr                       \
> +               --enable-vhost-net                  \
> +               --enable-system                     \
> +               --enable-linux-user                 \
> +               --disable-bsd-user                  \
> +               --disable-xen                       \
> +               --disable-slirp                     \
> +               --disable-sdl                       \
> +               --disable-vnc                       \
> +               --disable-virtfs                    \
> +               --disable-brlapi                    \
> +               --disable-curses                    \
> +               --disable-curl                      \
> +               --disable-fdt                       \
> +               --disable-bluez                     \
> +               --disable-guest-base                \
> +               --disable-uuid                      \
> +               --disable-vde                       \
> +               --disable-linux-aio                 \
> +               --disable-cap-ng                    \
> +               --disable-docs                      \
> +               --disable-spice                     \
> +               --disable-rbd                       \
> +               --disable-libiscsi                  \
> +               --disable-usb-redir                 \
> +               --disable-guest-agent               \
> +               --disable-smartcard                 \
> +               --disable-strip                     \
> +               $(QEMU_OPTS)                        \
> +       )
> +endef
> +
> +define QEMU_BUILD_CMDS
> +       $(MAKE) -C $(@D)
> +endef
> +
> +define QEMU_INSTALL_TARGET_CMDS
> +       $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> +endef
> +
> +define QEMU_UNINSTALL_TARGET_CMDS
> +       @echo 'QEMU has no uninstall rule.'
> +       @false
> +endef
> +
> +define QEMU_CLEAN_CMDS
> +       $(MAKE) -C $(@D) clean
> +endef
> +
> +$(eval $(generic-package))
> --
> 1.7.2.5
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Yann E. MORIN - Aug. 13, 2012, 7:46 a.m.
Diego, All,

On Monday 13 August 2012 09:22:32 Diego Iastrubni wrote:
> Let me understand this: you are trying to build QEMU for the host ?

Nope, it's meant to run on the target.

A long-term goal of this is to try to build a libvirt-based system to run
a "VM-farm" rather than use a complete distro. Most probably, it will be
a proof-of-concept rather than a real solution, but hey, one never knows
before trying.

Of course, the QEMu package could be extended to run on host, so you
can run your images, but that would mean that a lot of packages would
need their host- counterparts, which is currently not the case.

Besides, it does not really make sense. Just create a new BR config which
targets your host, chroot into that (or build static). That's actually
what I'm doing, in fact! ;-)

Regards,
Yann E. MORIN.
Thomas Petazzoni - Aug. 14, 2012, 1:34 p.m.
Le Mon, 13 Aug 2012 01:53:59 +0200,
"Yann E. MORIN" <yann.morin.1998@free.fr> a écrit :

> new file mode 100644
> index 0000000..a77d863
> --- /dev/null
> +++ b/package/qemu/Config.in
> @@ -0,0 +1,24 @@
> +config BR2_PACKAGE_QEMU
> +	bool "QEMU"

Just curious, what's the use case for Qemu on the target? I would have
seen Qemu as something useful on the host, but on the target?

> +	depends on BR2_PACKAGE_PYTHON       # We only need host-python,
> +	                                    # but there's no way to say so.

Doh? You just need to do:

QEMU_DEPENDENCIES += host-python

and that's it.

> +	select BR2_PACKAGE_ZLIB
> +	select BR2_PACKAGE_LIBGLIB2
> +	help
> +	  QEMU is a generic and open source machine emulator and virtualizer.
> +	  
> +	  When used as a machine emulator, QEMU can run OSes and programs made
> +	  for one machine (e.g. an ARM board) on a different machine (e.g.
> +	  your own PC). By using dynamic translation, it achieves very good
> +	  performance.
> +	  
> +	  When used as a virtualizer, QEMU achieves near native performances
> +	  by executing the guest code directly on the host CPU. QEMU supports
> +	  virtualization when executing under the Xen hypervisor or using the
> +	  KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
> +	  server and embedded PowerPC, and S390 guests. 
> +	  
> +	  http://qemu.org/
> +
> +comment "QEMU requires python"
> +	depends on !BR2_PACKAGE_PYTHON

You can drop this.

> diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
> new file mode 100644
> index 0000000..3825731
> --- /dev/null
> +++ b/package/qemu/qemu.mk
> @@ -0,0 +1,98 @@
> +#-----------------------------------------------------------------------------
> +# Package description
> +
> +QEMU_VERSION = 1.1.1-1
> +QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2
> +QEMU_SITE = http://wiki.qemu.org/download
> +QEMU_LICENSE = GPLv2 LGPLv2.1 MIT BSD-3c BSD-2c Others/BSD-1c
> +QEMU_LICENSE_FILES = COPYING COPYING.LIB
> +# NOTE: there is no top-level license file for non-(L)GPL licenses;
> +#       the non-(L)GPL license texts are specified in the affected
> +#       individual source files.
> +
> +#-----------------------------------------------------------------------------
> +# Package unconditional configuration
> +
> +QEMU_DEPENDENCIES = zlib libglib2
> +
> +#-----------------------------------------------------------------------------
> +# Package conditional configuration
> +
> +# Need the LIBS variable because librt and libm are
> +# not automatically pulled. :-(
> +QEMU_LIBS = -lrt -lm
> +
> +QEMU_OPTS =
> +QEMU_VARS =
> +
> +#----------------------------------------------------------------------------
> +# Package build process
> +
> +# Note: although QEMU uses a ./configure script, it is not compatible with
> +#       the traditional autotools options (eg. --target et al.), so we can
> +#       not use the autotools-package infrastructure. So we have to use the
> +#       generic-package infra instead. Sigh... :-(
> +
> +define QEMU_CONFIGURE_CMDS
> +	( cd $(@D);                                 \
> +	    LIBS='$(QEMU_LIBS)'                     \
> +	    $(TARGET_CONFIGURE_OPTS)                \
> +	    $(TARGET_CONFIGURE_ARGS)                \
> +	    $(QEMU_VARS)                            \
> +	    ./configure                             \
> +	        --prefix=/usr                       \
> +	        --cross-prefix=$(TARGET_CROSS)      \
> +	        --audio-drv-list=                   \
> +	        --audio-card-list=                  \
> +	        --enable-kvm                        \
> +	        --enable-nptl                       \
> +	        --enable-attr                       \
> +	        --enable-vhost-net                  \
> +	        --enable-system                     \
> +	        --enable-linux-user                 \
> +	        --disable-bsd-user                  \
> +	        --disable-xen                       \
> +	        --disable-slirp                     \
> +	        --disable-sdl                       \
> +	        --disable-vnc                       \
> +	        --disable-virtfs                    \
> +	        --disable-brlapi                    \
> +	        --disable-curses                    \
> +	        --disable-curl                      \
> +	        --disable-fdt                       \
> +	        --disable-bluez                     \
> +	        --disable-guest-base                \
> +	        --disable-uuid                      \
> +	        --disable-vde                       \
> +	        --disable-linux-aio                 \
> +	        --disable-cap-ng                    \
> +	        --disable-docs                      \
> +	        --disable-spice                     \
> +	        --disable-rbd                       \
> +	        --disable-libiscsi                  \
> +	        --disable-usb-redir                 \
> +	        --disable-guest-agent               \
> +	        --disable-smartcard                 \
> +	        --disable-strip                     \
> +	        $(QEMU_OPTS)                        \
> +	)
> +endef
> +
> +define QEMU_BUILD_CMDS
> +	$(MAKE) -C $(@D)
> +endef
> +
> +define QEMU_INSTALL_TARGET_CMDS
> +	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> +endef
> +
> +define QEMU_UNINSTALL_TARGET_CMDS
> +	@echo 'QEMU has no uninstall rule.'
> +	@false
> +endef

Just don't implement the UNINSTALL_TARGET_CMDS in this case.

Since quite some time, we're considering dropping the
UNINSTALL_TARGET_CMDS and CLEAN_CMDS altogether.

Best regards,

Thomas
Yann E. MORIN - Aug. 14, 2012, 5:03 p.m.
Thomas, All,

On Tuesday 14 August 2012 15:34:03 Thomas Petazzoni wrote:
> Le Mon, 13 Aug 2012 01:53:59 +0200,
> "Yann E. MORIN" <yann.morin.1998@free.fr> a écrit :
> 
> > new file mode 100644
> > index 0000000..a77d863
> > --- /dev/null
> > +++ b/package/qemu/Config.in
> > @@ -0,0 +1,24 @@
> > +config BR2_PACKAGE_QEMU
> > +	bool "QEMU"
> 
> Just curious, what's the use case for Qemu on the target? I would have
> seen Qemu as something useful on the host, but on the target?

I want to build a libvirt-based system to host VMs, and I do not want
to use a complete distro for that : I do not care about the handy-dandy
init stuff, I don't care about networking auto-managing stuff, no fscking
desktop stuff... I just want a basic system that just runs a libvirt daemon,
and manages the VMs.

I want to build a completly-static QEMU, and that's not possible on a
desktop/server distro that uses glibc, because static linking still pulls
the NSS libs. So, rather than creating a new 'framework', I just decided
to reuse something. ;-)

I want to play! ;-)

> > +	depends on BR2_PACKAGE_PYTHON       # We only need host-python,
> > +	                                    # but there's no way to say so.
> 
> Doh? You just need to do:
> QEMU_DEPENDENCIES += host-python
> and that's it.

Doh... :/
/me hides...

> > +	select BR2_PACKAGE_ZLIB
> > +	select BR2_PACKAGE_LIBGLIB2
> > +	help
> > +	  QEMU is a generic and open source machine emulator and virtualizer.
> > +	  
> > +	  When used as a machine emulator, QEMU can run OSes and programs made
> > +	  for one machine (e.g. an ARM board) on a different machine (e.g.
> > +	  your own PC). By using dynamic translation, it achieves very good
> > +	  performance.
> > +	  
> > +	  When used as a virtualizer, QEMU achieves near native performances
> > +	  by executing the guest code directly on the host CPU. QEMU supports
> > +	  virtualization when executing under the Xen hypervisor or using the
> > +	  KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
> > +	  server and embedded PowerPC, and S390 guests. 
> > +	  
> > +	  http://qemu.org/
> > +
> > +comment "QEMU requires python"
> > +	depends on !BR2_PACKAGE_PYTHON
> 
> You can drop this.

Of course! :-)

> > diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
> > new file mode 100644
> > index 0000000..3825731
> > --- /dev/null
> > +++ b/package/qemu/qemu.mk
> > @@ -0,0 +1,98 @@
> > +#-----------------------------------------------------------------------------
> > +# Package description
> > +
> > +QEMU_VERSION = 1.1.1-1
> > +QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2
> > +QEMU_SITE = http://wiki.qemu.org/download
> > +QEMU_LICENSE = GPLv2 LGPLv2.1 MIT BSD-3c BSD-2c Others/BSD-1c
> > +QEMU_LICENSE_FILES = COPYING COPYING.LIB
> > +# NOTE: there is no top-level license file for non-(L)GPL licenses;
> > +#       the non-(L)GPL license texts are specified in the affected
> > +#       individual source files.
> > +
> > +#-----------------------------------------------------------------------------
> > +# Package unconditional configuration
> > +
> > +QEMU_DEPENDENCIES = zlib libglib2
> > +
> > +#-----------------------------------------------------------------------------
> > +# Package conditional configuration
> > +
> > +# Need the LIBS variable because librt and libm are
> > +# not automatically pulled. :-(
> > +QEMU_LIBS = -lrt -lm
> > +
> > +QEMU_OPTS =
> > +QEMU_VARS =
> > +
> > +#----------------------------------------------------------------------------
> > +# Package build process
> > +
> > +# Note: although QEMU uses a ./configure script, it is not compatible with
> > +#       the traditional autotools options (eg. --target et al.), so we can
> > +#       not use the autotools-package infrastructure. So we have to use the
> > +#       generic-package infra instead. Sigh... :-(
> > +
> > +define QEMU_CONFIGURE_CMDS
> > +	( cd $(@D);                                 \
> > +	    LIBS='$(QEMU_LIBS)'                     \
> > +	    $(TARGET_CONFIGURE_OPTS)                \
> > +	    $(TARGET_CONFIGURE_ARGS)                \
> > +	    $(QEMU_VARS)                            \
> > +	    ./configure                             \
> > +	        --prefix=/usr                       \
> > +	        --cross-prefix=$(TARGET_CROSS)      \
> > +	        --audio-drv-list=                   \
> > +	        --audio-card-list=                  \
> > +	        --enable-kvm                        \
> > +	        --enable-nptl                       \
> > +	        --enable-attr                       \
> > +	        --enable-vhost-net                  \
> > +	        --enable-system                     \
> > +	        --enable-linux-user                 \
> > +	        --disable-bsd-user                  \
> > +	        --disable-xen                       \
> > +	        --disable-slirp                     \
> > +	        --disable-sdl                       \
> > +	        --disable-vnc                       \
> > +	        --disable-virtfs                    \
> > +	        --disable-brlapi                    \
> > +	        --disable-curses                    \
> > +	        --disable-curl                      \
> > +	        --disable-fdt                       \
> > +	        --disable-bluez                     \
> > +	        --disable-guest-base                \
> > +	        --disable-uuid                      \
> > +	        --disable-vde                       \
> > +	        --disable-linux-aio                 \
> > +	        --disable-cap-ng                    \
> > +	        --disable-docs                      \
> > +	        --disable-spice                     \
> > +	        --disable-rbd                       \
> > +	        --disable-libiscsi                  \
> > +	        --disable-usb-redir                 \
> > +	        --disable-guest-agent               \
> > +	        --disable-smartcard                 \
> > +	        --disable-strip                     \
> > +	        $(QEMU_OPTS)                        \
> > +	)
> > +endef
> > +
> > +define QEMU_BUILD_CMDS
> > +	$(MAKE) -C $(@D)
> > +endef
> > +
> > +define QEMU_INSTALL_TARGET_CMDS
> > +	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> > +endef
> > +
> > +define QEMU_UNINSTALL_TARGET_CMDS
> > +	@echo 'QEMU has no uninstall rule.'
> > +	@false
> > +endef
> 
> Just don't implement the UNINSTALL_TARGET_CMDS in this case.

Okydoky.

Thank you!

Regards,
Yann E. MORIN.
Thomas Petazzoni - Aug. 17, 2012, 11:26 a.m.
Le Tue, 14 Aug 2012 19:03:45 +0200,
"Yann E. MORIN" <yann.morin.1998@free.fr> a écrit :

> > Just curious, what's the use case for Qemu on the target? I would have
> > seen Qemu as something useful on the host, but on the target?
> 
> I want to build a libvirt-based system to host VMs, and I do not want
> to use a complete distro for that : I do not care about the handy-dandy
> init stuff, I don't care about networking auto-managing stuff, no fscking
> desktop stuff... I just want a basic system that just runs a libvirt daemon,
> and manages the VMs.
> 
> I want to build a completly-static QEMU, and that's not possible on a
> desktop/server distro that uses glibc, because static linking still pulls
> the NSS libs. So, rather than creating a new 'framework', I just decided
> to reuse something. ;-)
> 
> I want to play! ;-)

Ok, interesting. The only thing I'm a bit worried about is that this
brings Buildroot outside of its "environment to cross-compile Linux
systems for embedded platforms". Although it initially probably fits
the "minimal Linux system for VM hosting" use case, I'm worried that
down the road the needs may diverge (for example people using Buildroot
for VM hosting environments will want package management, etc.). But
maybe I simply shouldn't anticipate too much on this and just see how
things move.

However, on this patch set, I'd like to see at least a Ack from Peter
on the general idea of merging Qemu for the target and all the required
dependencies. If Peter is fine with the general idea, we can together
review the implementation details, but the general idea needs to be
Acked, me thinks.

Of course, other people in the community are invited to raise their
voice here as well.

Thanks!

Thomas
Yann E. MORIN - Aug. 17, 2012, 1:32 p.m.
Thomas, All,

On Friday 17 August 2012 13:26:06 Thomas Petazzoni wrote:
> Le Tue, 14 Aug 2012 19:03:45 +0200,
> "Yann E. MORIN" <yann.morin.1998@free.fr> a écrit :
> 
> > > Just curious, what's the use case for Qemu on the target? I would have
> > > seen Qemu as something useful on the host, but on the target?
> > 
> > I want to build a libvirt-based system to host VMs, and I do not want
> > to use a complete distro for that : I do not care about the handy-dandy
> > init stuff, I don't care about networking auto-managing stuff, no fscking
> > desktop stuff... I just want a basic system that just runs a libvirt daemon,
> > and manages the VMs.
> > 
> > I want to build a completly-static QEMU, and that's not possible on a
> > desktop/server distro that uses glibc, because static linking still pulls
> > the NSS libs. So, rather than creating a new 'framework', I just decided
> > to reuse something. ;-)
> > 
> > I want to play! ;-)
> 
> Ok, interesting. The only thing I'm a bit worried about is that this
> brings Buildroot outside of its "environment to cross-compile Linux
> systems for embedded platforms". Although it initially probably fits
> the "minimal Linux system for VM hosting" use case, I'm worried that
> down the road the needs may diverge (for example people using Buildroot
> for VM hosting environments will want package management, etc.). But
> maybe I simply shouldn't anticipate too much on this and just see how
> things move.
> 
> However, on this patch set, I'd like to see at least a Ack from Peter
> on the general idea of merging Qemu for the target and all the required
> dependencies. If Peter is fine with the general idea, we can together
> review the implementation details, but the general idea needs to be
> Acked, me thinks.
> 
> Of course, other people in the community are invited to raise their
> voice here as well.

Of course, it diverges from the original goal.

But using buildroot for this stuff is really dead-easy (besides all the
time it takes to test, and dependencies, re-test and so-on... ;-) ).

I can understand that we may not want qemu upstream, but as I have this
stuff here, better post them at least for review, and if people find it
interesting, for upstreaming.

And yes, I too want an Ack from Peter before this is pulled.

Which should *not* be done now, I have some changes down the road (fixes
from the reviews, plus local sound support (not spice)).

Regards,
Yann E. MORIN.

Patch

diff --git a/package/Config.in b/package/Config.in
index 3109591..eb02983 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -504,6 +504,7 @@  menu "Miscellaneous"
 source "package/collectd/Config.in"
 source "package/empty/Config.in"
 source "package/mobile-broadband-provider-info/Config.in"
+source "package/qemu/Config.in"
 source "package/shared-mime-info/Config.in"
 source "package/sound-theme-borealis/Config.in"
 source "package/sound-theme-freedesktop/Config.in"
diff --git a/package/qemu/Config.in b/package/qemu/Config.in
new file mode 100644
index 0000000..a77d863
--- /dev/null
+++ b/package/qemu/Config.in
@@ -0,0 +1,24 @@ 
+config BR2_PACKAGE_QEMU
+	bool "QEMU"
+	depends on BR2_PACKAGE_PYTHON       # We only need host-python,
+	                                    # but there's no way to say so.
+	select BR2_PACKAGE_ZLIB
+	select BR2_PACKAGE_LIBGLIB2
+	help
+	  QEMU is a generic and open source machine emulator and virtualizer.
+	  
+	  When used as a machine emulator, QEMU can run OSes and programs made
+	  for one machine (e.g. an ARM board) on a different machine (e.g.
+	  your own PC). By using dynamic translation, it achieves very good
+	  performance.
+	  
+	  When used as a virtualizer, QEMU achieves near native performances
+	  by executing the guest code directly on the host CPU. QEMU supports
+	  virtualization when executing under the Xen hypervisor or using the
+	  KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
+	  server and embedded PowerPC, and S390 guests. 
+	  
+	  http://qemu.org/
+
+comment "QEMU requires python"
+	depends on !BR2_PACKAGE_PYTHON
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
new file mode 100644
index 0000000..3825731
--- /dev/null
+++ b/package/qemu/qemu.mk
@@ -0,0 +1,98 @@ 
+#-----------------------------------------------------------------------------
+# Package description
+
+QEMU_VERSION = 1.1.1-1
+QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2
+QEMU_SITE = http://wiki.qemu.org/download
+QEMU_LICENSE = GPLv2 LGPLv2.1 MIT BSD-3c BSD-2c Others/BSD-1c
+QEMU_LICENSE_FILES = COPYING COPYING.LIB
+# NOTE: there is no top-level license file for non-(L)GPL licenses;
+#       the non-(L)GPL license texts are specified in the affected
+#       individual source files.
+
+#-----------------------------------------------------------------------------
+# Package unconditional configuration
+
+QEMU_DEPENDENCIES = zlib libglib2
+
+#-----------------------------------------------------------------------------
+# Package conditional configuration
+
+# Need the LIBS variable because librt and libm are
+# not automatically pulled. :-(
+QEMU_LIBS = -lrt -lm
+
+QEMU_OPTS =
+QEMU_VARS =
+
+#----------------------------------------------------------------------------
+# Package build process
+
+# Note: although QEMU uses a ./configure script, it is not compatible with
+#       the traditional autotools options (eg. --target et al.), so we can
+#       not use the autotools-package infrastructure. So we have to use the
+#       generic-package infra instead. Sigh... :-(
+
+define QEMU_CONFIGURE_CMDS
+	( cd $(@D);                                 \
+	    LIBS='$(QEMU_LIBS)'                     \
+	    $(TARGET_CONFIGURE_OPTS)                \
+	    $(TARGET_CONFIGURE_ARGS)                \
+	    $(QEMU_VARS)                            \
+	    ./configure                             \
+	        --prefix=/usr                       \
+	        --cross-prefix=$(TARGET_CROSS)      \
+	        --audio-drv-list=                   \
+	        --audio-card-list=                  \
+	        --enable-kvm                        \
+	        --enable-nptl                       \
+	        --enable-attr                       \
+	        --enable-vhost-net                  \
+	        --enable-system                     \
+	        --enable-linux-user                 \
+	        --disable-bsd-user                  \
+	        --disable-xen                       \
+	        --disable-slirp                     \
+	        --disable-sdl                       \
+	        --disable-vnc                       \
+	        --disable-virtfs                    \
+	        --disable-brlapi                    \
+	        --disable-curses                    \
+	        --disable-curl                      \
+	        --disable-fdt                       \
+	        --disable-bluez                     \
+	        --disable-guest-base                \
+	        --disable-uuid                      \
+	        --disable-vde                       \
+	        --disable-linux-aio                 \
+	        --disable-cap-ng                    \
+	        --disable-docs                      \
+	        --disable-spice                     \
+	        --disable-rbd                       \
+	        --disable-libiscsi                  \
+	        --disable-usb-redir                 \
+	        --disable-guest-agent               \
+	        --disable-smartcard                 \
+	        --disable-strip                     \
+	        $(QEMU_OPTS)                        \
+	)
+endef
+
+define QEMU_BUILD_CMDS
+	$(MAKE) -C $(@D)
+endef
+
+define QEMU_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+define QEMU_UNINSTALL_TARGET_CMDS
+	@echo 'QEMU has no uninstall rule.'
+	@false
+endef
+
+define QEMU_CLEAN_CMDS
+	$(MAKE) -C $(@D) clean
+endef
+
+$(eval $(generic-package))