[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: Some scripts to create linux contai
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: Some scripts to create linux container using qemu-linux-user. |
Date: |
Mon, 14 Jan 2013 22:54:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 |
Am 14.01.2013 22:36, schrieb Laurent Vivier:
> * sudo qemu-update-binfmt.sh <target>
>
> Call update-binfmts to install /bin/qemu-<target> as the binfmt interpreter.
>
> * sudo qemu-create-lxc.sh <target>
>
> This script mixes linux container, binfmt and qemu to create hybrid linux
> container : <target> container on an host kernel.
>
> It will create "light" emulated virtual machine with several steps :
> - create a linux-user qemu-<target>
> - define it as the binfmt interpreter (using qemu-update-binfmt.sh).
> - install a base debian system under /containers/<target> using debootstrap.
> and set a minimal configuration.
> - define a linux container
>
> Then you can start the container using : sudo lxc-start -n virt<target>
>
> TARGETS STATUS:
>
> 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: (=armhf+raspbian) works*
>
> * needs patches I sent to the mailing-list previously
>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
> 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="$1"
> +
> +# probe cpu type
> +cpu=`uname -m`
> +case "$cpu" in
> + i386|i486|i586|i686|i86pc|BePC|x86_64)
> + cpu="i386"
> + ;;
> + mips*)
> + cpu="mips"
> + ;;
> + "Power Macintosh"|ppc64)
> + cpu="ppc"
> + ;;
> + armv[4-9]*)
> + cpu="arm"
> + ;;
> +esac
> +
> +if [ "$name" = "$cpu" ]
> +then
> + exit 0
> +fi
> +
> +case $name
> +in
> + m68k)
> +
> magic="\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04"
> +
> mask="\xff\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"
> + ;;
[snip]
Déjà 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
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg