All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
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	[thread overview]
Message-ID: <50F47EA5.5050302@suse.de> (raw)
In-Reply-To: <1358199410-19033-1-git-send-email-laurent@vivier.eu>

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 <laurent@vivier.eu>
> ---
>  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

  reply	other threads:[~2013-01-14 21:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 21:36 [Qemu-devel] [PATCH] linux-user: Some scripts to create linux container using qemu-linux-user Laurent Vivier
2013-01-14 21:54 ` Andreas Färber [this message]
2013-01-19 23:20 ` [Qemu-devel] [PATCH 1/3] scripts: extract ELF magics from qemu-binfmt-conf.sh Laurent Vivier
2013-01-19 23:20   ` [Qemu-devel] [PATCH 2/3] scripts: define qemu-update-binfmt Laurent Vivier
2013-01-19 23:21   ` [Qemu-devel] [PATCH 3/3] scripts: A script to create linux container using qemu-linux-user Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F47EA5.5050302@suse.de \
    --to=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.