Package: qemu
Version: 0.8.2-1
Severity: normal
Tags: patch

New patch version, using a new approach: the binfmt support comes now
in a separate "qemu-binfmt" package which does not affect the main
qemu package in any way. Enabling "transparent" user emulation is as
simple as "apt-get install qemu-binfmt".

Changelog:

 * Add binfmt-support hooks, allowing "transparent" user emulation. Idea
   borrowed from qemu-binfmt-conf.sh.
   - New package: qemu-binfmt.

--
Anderson Lizardo
Index: qemu-0.8.2/debian/rules
===================================================================
--- qemu-0.8.2.orig/debian/rules	2006-10-29 20:58:17.000000000 -0400
+++ qemu-0.8.2/debian/rules	2006-10-29 20:58:39.000000000 -0400
@@ -7,6 +7,8 @@
 # WARNING: Removing no-strict-aliasing will make qemu insta-segfault.
 CFLAGS = -Wall -g -fno-strict-aliasing
 
+DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -O0
 else
@@ -81,7 +83,8 @@
 binary-arch: install
 	dh_testdir
 	dh_testroot
-	dh_install -a
+	dh_install -a -Nqemu-binfmt
+	dh_install -a -pqemu-binfmt -Xbinfmts/$(DEB_HOST_ARCH_CPU)
 	dh_installdebconf -a
 	dh_installdocs -a
 	dh_installexamples -a
@@ -94,6 +97,7 @@
 	dh_compress -a
 	dh_fixperms -a
 	chmod a+x $(D)/etc/qemu-ifup
+	chmod a+x $(CURDIR)/debian/qemu-binfmt/usr/lib/qemu-binfmt/qemu-run-binfmt
 	dh_installdeb -a
 	dh_shlibdeps -a
 	dh_gencontrol -a
Index: qemu-0.8.2/debian/qemu-binfmt.prerm
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/qemu-binfmt.prerm	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,43 @@
+#! /bin/sh
+# prerm script for qemu
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+    remove|upgrade|deconfigure)
+        if [ -x /usr/sbin/update-binfmts ]; then
+            for i in `cd /usr/share/binfmts; ls qemu-*`; do
+                qemu_bin=$i
+                if [ "$i" = "i486" ]; then qemu_bin=i386; fi
+                update-binfmts --package qemu --remove $i \
+                  /usr/bin/$qemu_bin || true
+            done
+        fi
+    ;;
+    failed-upgrade)
+    ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
Index: qemu-0.8.2/debian/qemu-binfmt.postinst
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/qemu-binfmt.postinst	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,44 @@
+#! /bin/sh
+# postinst script for qemu
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+
+case "$1" in
+    configure)
+        if [ -x /usr/sbin/update-binfmts ]; then
+            for i in `cd /usr/share/binfmts; ls qemu-*`; do
+                update-binfmts --import $i || true
+            done
+        fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
Index: qemu-0.8.2/debian/binfmts/i386/qemu-i486
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/i386/qemu-i486	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/i386
+magic \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00
+mask \xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
Index: qemu-0.8.2/debian/binfmts/i386/qemu-i386
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/i386/qemu-i386	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/i386
+magic \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00
+mask \xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
Index: qemu-0.8.2/debian/binfmts/arm/qemu-armeb
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/arm/qemu-armeb	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/armeb
+magic \x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28
+mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff
Index: qemu-0.8.2/debian/binfmts/arm/qemu-arm
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/arm/qemu-arm	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/arm
+magic \x7fELF\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
Index: qemu-0.8.2/debian/binfmts/sparc/qemu-sparc
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/sparc/qemu-sparc	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/sparc
+magic \x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02
+mask \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff
Index: qemu-0.8.2/debian/binfmts/powerpc/qemu-powerpc
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/powerpc/qemu-powerpc	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/powerpc
+magic \x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14
+mask \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff
Index: qemu-0.8.2/debian/binfmts/mips/qemu-mipsel
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/mips/qemu-mipsel	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/mipsel
+magic \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00
+mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
Index: qemu-0.8.2/debian/binfmts/mips/qemu-mips
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/binfmts/mips/qemu-mips	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,4 @@
+package qemu
+interpreter /usr/lib/qemu-binfmt/mips
+magic \x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08
+mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff
Index: qemu-0.8.2/debian/control
===================================================================
--- qemu-0.8.2.orig/debian/control	2006-10-29 20:55:43.000000000 -0400
+++ qemu-0.8.2/debian/control	2006-10-29 20:58:39.000000000 -0400
@@ -34,3 +34,24 @@
  As QEMU requires no host kernel patches to run, it is very safe and
  easy to use.
 
+Package: qemu-binfmt
+Architecture: amd64 i386 powerpc alpha sparc arm s390
+Depends: qemu, binfmt-support, dpkg-dev
+Description: fast processor emulator (binfmt-support files)
+ QEMU is a FAST! processor emulator: currently the package supports
+ arm, powerpc, sparc and x86 emulation. By using dynamic translation
+ it achieves reasonable speed while being easy to port on new host
+ CPUs. QEMU has two operating modes:
+ .
+  * User mode emulation: QEMU can launch Linux processes compiled for
+    one CPU on another CPU.
+  * Full system emulation: QEMU emulates a full system, including a
+    processor and various peripherals. It enables easier testing and
+    debugging of system code. It can also be used to provide virtual
+    hosting of several virtual PC on a single server.
+ .
+ As QEMU requires no host kernel patches to run, it is very safe and
+ easy to use.
+ .
+ This package contains the files for binfmt-support that allow "transparent"
+ user emulation.
Index: qemu-0.8.2/debian/qemu-binfmt.install
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/qemu-binfmt.install	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,9 @@
+debian/qemu-run-binfmt usr/lib/qemu-binfmt/
+debian/binfmts/i386/qemu-i486 usr/share/binfmts/
+debian/binfmts/i386/qemu-i386 usr/share/binfmts/
+debian/binfmts/arm/qemu-armeb usr/share/binfmts/
+debian/binfmts/arm/qemu-arm usr/share/binfmts/
+debian/binfmts/sparc/qemu-sparc usr/share/binfmts/
+debian/binfmts/powerpc/qemu-powerpc usr/share/binfmts/
+debian/binfmts/mips/qemu-mipsel usr/share/binfmts/
+debian/binfmts/mips/qemu-mips usr/share/binfmts/
Index: qemu-0.8.2/debian/qemu-binfmt.links
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/qemu-binfmt.links	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,9 @@
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/arm
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/armeb
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/i386
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/i386
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/mips
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/mipsel
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/powerpc
+usr/lib/qemu-binfmt/qemu-run-binfmt usr/lib/qemu-binfmt/sparc
+usr/bin/qemu-ppc usr/bin/qemu-powerpc
Index: qemu-0.8.2/debian/qemu-run-binfmt
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.2/debian/qemu-run-binfmt	2006-10-29 20:58:39.000000000 -0400
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+ARCH="`basename $0`"
+CROSS_PREFIX=/usr/`dpkg-architecture -a$ARCH -qDEB_HOST_GNU_TYPE 2>/dev/null`
+exec /usr/bin/qemu-$ARCH -L $CROSS_PREFIX "$@"

Reply via email to