add packaging
authorGui Chen <gui.chen@intel.com>
Fri, 1 Aug 2014 06:27:47 +0000 (02:27 -0400)
committerGui Chen <gui.chen@intel.com>
Fri, 1 Aug 2014 06:27:47 +0000 (02:27 -0400)
Signed-off-by: Gui Chen <gui.chen@intel.com>
packaging/qemu-arm-static.spec [new file with mode: 0644]
packaging/qemu-binfmt-conf.sh [new file with mode: 0644]
packaging/rpmlintrc [new file with mode: 0644]

diff --git a/packaging/qemu-arm-static.spec b/packaging/qemu-arm-static.spec
new file mode 100644 (file)
index 0000000..73a3444
--- /dev/null
@@ -0,0 +1,109 @@
+#
+# spec file for package qemu
+#
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+
+Name:           qemu-arm-static
+Url:            http://www.qemu.org/
+Summary:        Universal CPU emulator
+License:        BSD-3-Clause and GPL-2.0+ and LGPL-2.1+ and MIT
+Group:          System/Emulators/PC
+Version:        1.6.0rc3
+Release:        0
+Source:         qemu-1.6.0-rc3.tar.bz2
+Source1:        qemu-binfmt-conf.sh
+# this is to make lint happy
+Source300:      rpmlintrc
+Patch0037:      0037-initial-aarch64-work.patch.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+
+BuildRequires:  python
+BuildRequires:  libattr-devel
+%if 0%{?suse_version} >= 1220
+BuildRequires:  pcre-devel-static
+%endif
+%if 0%{?suse_version}
+BuildRequires:  glibc-devel-static
+BuildRequires:  libattr-devel-static
+BuildRequires:  glib2-devel-static
+BuildRequires:  zlib-devel-static
+%else
+BuildRequires:  glibc-static
+BuildRequires:  glib2-static
+BuildRequires:  zlib-static
+%endif
+
+Provides:       qemu:%_bindir/qemu-arm-static
+Provides:       tizen-qemu-arm-static = 2013.12.12
+
+%description
+QEMU is an extremely well-performing CPU emulator that allows you to
+choose between simulating an entire system and running userspace
+binaries for different architectures under your native operating
+system. It currently emulates x86, ARM, PowerPC and SPARC CPUs as well
+as PC and PowerMac systems.
+
+%prep
+%setup -q -n qemu-1.6.0-rc3
+%patch0037 -p1
+
+%build
+
+export LDFLAGS="-lrt -pthread -lgthread-2.0 -lglib-2.0"
+./configure \
+       --prefix=%_prefix \
+       --sysconfdir=%_sysconfdir \
+       --libexecdir=%_libexecdir \
+       --target-list="arm-linux-user,arm64-linux-user" \
+       --disable-tools \
+       --disable-guest-agent \
+       --disable-docs \
+       --disable-system \
+       --enable-linux-user \
+       --disable-werror \
+       --disable-linux-aio \
+       --disable-fdt \
+       --disable-sdl \
+       --static
+
+%if 0%{?suse_version} >= 1230 || 0%{?fedora} >= 19
+# -lrt needs to come after -lglib-2.0 to avoid undefined mq_open, mq_xxx
+sed -i "s/-lglib-2.0/-lglib-2.0 -lrt/" config-host.mak
+%endif
+
+make %{?jobs:-j%jobs} V=1
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT
+install -d -m 755 $RPM_BUILD_ROOT/%_sbindir
+install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%_sbindir
+mv $RPM_BUILD_ROOT/%_bindir/qemu-arm $RPM_BUILD_ROOT/%_bindir/qemu-arm-static
+mv $RPM_BUILD_ROOT/%_bindir/qemu-arm64 $RPM_BUILD_ROOT/%_bindir/qemu-arm64-static
+rm -rf $RPM_BUILD_ROOT/%_datadir
+rm -rf $RPM_BUILD_ROOT/%_sysconfdir
+rm -rf $RPM_BUILD_ROOT/%_libexecdir
+#%fdupes -s $RPM_BUILD_ROOT
+
+%clean
+rm -rf ${RPM_BUILD_ROOT}
+
+%files
+%defattr(-, root, root)
+%{_bindir}/qemu-arm-static
+%{_bindir}/qemu-arm64-static
+%{_sbindir}/*
+
+%changelog
diff --git a/packaging/qemu-binfmt-conf.sh b/packaging/qemu-binfmt-conf.sh
new file mode 100644 (file)
index 0000000..53fadc8
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel
+
+# load the binfmt_misc module
+if [ ! -d /proc/sys/fs/binfmt_misc ]; then
+  /sbin/modprobe binfmt_misc
+fi
+if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
+  mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
+fi
+
+# probe cpu type
+cpu=`uname -m`
+case "$cpu" in
+  i386|i486|i586|i686|i86pc|BePC|x86_64)
+    cpu="i386"
+  ;;
+  m68k)
+    cpu="m68k"
+  ;;
+  mips*)
+    cpu="mips"
+  ;;
+  "Power Macintosh"|ppc|ppc64)
+    cpu="ppc"
+  ;;
+  armv[4-9]*)
+    cpu="arm"
+  ;;
+esac
+
+# register the interpreter for each cpu except for the native one
+if [ $cpu != "i386" ] ; then
+    echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
+    echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "alpha" ] ; then
+    echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "arm" ] ; then
+    echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-arm-static:P' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "sparc" ] ; then
+    echo   ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "ppc" ] ; then
+    echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "m68k" ] ; then
+    echo   'Please check cpu value and header information for m68k!'
+    echo   ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "mips" ] ; then
+    # FIXME: We could use the other endianness on a MIPS host.
+    echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mipsn32:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsn32el:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "sh" ] ; then
+    echo    ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
+    echo    ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
+fi
+if [ $cpu != "s390x" ] ; then
+    echo   ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register
+fi
diff --git a/packaging/rpmlintrc b/packaging/rpmlintrc
new file mode 100644 (file)
index 0000000..66f5a92
--- /dev/null
@@ -0,0 +1,5 @@
+# This line is mandatory to access the configuration functions
+from Config import *
+
+addFilter("arch-dependent-file-in-usr-share")
+