From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TurzY-0000wc-O4 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 16:54:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TurzX-0002qc-J0 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 16:54:52 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48550 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TurzX-0002qQ-B1 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 16:54:51 -0500 Message-ID: <50F47EA5.5050302@suse.de> Date: Mon, 14 Jan 2013 22:54:45 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1358199410-19033-1-git-send-email-laurent@vivier.eu> In-Reply-To: <1358199410-19033-1-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] linux-user: Some scripts to create linux container using qemu-linux-user. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: Riku Voipio , qemu-devel@nongnu.org, Alexander Graf Am 14.01.2013 22:36, schrieb Laurent Vivier: > * sudo qemu-update-binfmt.sh >=20 > Call update-binfmts to install /bin/qemu- as the binfmt interpr= eter. >=20 > * sudo qemu-create-lxc.sh >=20 > This script mixes linux container, binfmt and qemu to create hybrid lin= ux > container : container on an host kernel. >=20 > It will create "light" emulated virtual machine with several steps : > - create a linux-user qemu- > - define it as the binfmt interpreter (using qemu-update-binfmt.sh). > - install a base debian system under /containers/ using deboots= trap. > and set a minimal configuration. > - define a linux container >=20 > Then you can start the container using : sudo lxc-start -n virt >=20 > TARGETS STATUS: >=20 > alpha: cannot run debootstrap --second stage*, but chroot is usable > m68k: need patches from qemu-m68k, after that, all is working fine. > mips: container can be started, but console login hangs. > ppc: works fine* > sparc: cannot run debootstrap --second stage (cannot fork) > raspberrypi: (=3Darmhf+raspbian) works* >=20 > * needs patches I sent to the mailing-list previously >=20 > Signed-off-by: Laurent Vivier > --- > scripts/qemu-create-lxc.sh | 280 ++++++++++++++++++++++++++++++++++++= ++++++++ > scripts/qemu-update-binfmt | 60 ++++++++++ > 2 files changed, 340 insertions(+) > create mode 100755 scripts/qemu-create-lxc.sh > create mode 100755 scripts/qemu-update-binfmt [...] > diff --git a/scripts/qemu-update-binfmt b/scripts/qemu-update-binfmt > new file mode 100755 > index 0000000..ebdd971 > --- /dev/null > +++ b/scripts/qemu-update-binfmt > @@ -0,0 +1,60 @@ > +#!/bin/bash > + > +name=3D"$1" > + > +# probe cpu type > +cpu=3D`uname -m` > +case "$cpu" in > + i386|i486|i586|i686|i86pc|BePC|x86_64) > + cpu=3D"i386" > + ;; > + mips*) > + cpu=3D"mips" > + ;; > + "Power Macintosh"|ppc64) > + cpu=3D"ppc" > + ;; > + armv[4-9]*) > + cpu=3D"arm" > + ;; > +esac > + > +if [ "$name" =3D "$cpu" ] > +then > + exit 0 > +fi > + > +case $name > +in > + m68k) > + magic=3D"\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x= 00\x00\x02\x00\x04" > + mask=3D"\xff\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\x= ff\xff\xff\xff\xfe\xff\xff" > + ;; [snip] D=E9j=E0 vu... qemu-binfmt-conf.sh already has the magics hardcoded and registers them via /proc. Please either reuse that script (with a new parameter if needed) or move the data to a shared script used by both so that not one is updated and the other forgotten. The one thing I dislike about the existing script is that it hardcodes each path to /usr/local/bin, which for openSUSE we need to override. Your script hardcodes /bin in only one place instead. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg