3 # - wait till the gcc bug http://gcc.gnu.org/PR16185 is fixed.
6 %bcond_with kqemu # with QEMU accelerator module
7 %bcond_with cflags_passing # with passing rpmcflags to Makefiles
8 %bcond_with nosdlgui # do not use SDL gui (use X11 instead)
9 %bcond_with gcc4 # use gcc4 patches (broke build on gcc33)
10 %bcond_without dist_kernel # without distribution kernel
11 %bcond_without kernel # don't build kernel modules
12 %bcond_without smp # don't build SMP module
13 %bcond_without userspace # don't build userspace utilities
15 %define _kqemu_version 0.7.2
17 Summary: QEMU CPU Emulator
18 Summary(pl): QEMU - emulator procesora
22 Release: %{_rel}%{?with_kqemu:k}
24 Group: Applications/Emulators
25 #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
26 Source0: http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz
27 # Source0-md5: eb175b26583280706fe7e4d8910d320d
29 Source1: http://fabrice.bellard.free.fr/qemu/kqemu-%{_kqemu_version}.tar.gz
30 # NoSource1-md5: 02cfdecda90458d6393781496ec6b48b
33 Patch0: %{name}-nostatic.patch
34 Patch1: %{name}-DESTDIR.patch
35 Patch2: %{name}-longjmp.patch
36 Patch3: %{name}-dot.patch
37 Patch4: %{name}-initrd_load_addr.patch
38 Patch5: %{name}-gcc4_x86.patch
39 Patch6: %{name}-gcc4_ppc.patch
40 Patch7: %{name}-parallel.patch
41 Patch8: %{name}-nosdlgui.patch
42 Patch9: %{name}-ifup.patch
43 Patch10: %{name}-gcc33.patch
44 Patch11: %{name}-slirp_throttle.patch
45 URL: http://fabrice.bellard.free.fr/qemu/
46 BuildRequires: SDL-devel >= 1.2.1
47 BuildRequires: alsa-lib-devel
48 %{!?with_gcc4:BuildRequires: gcc < 5:4.0}
49 %if %{with kqemu} && %{with dist_kernel}
50 BuildRequires: kernel-module-build >= 2.6.7
52 BuildRequires: rpmbuild(macros) >= 1.217
53 BuildRequires: sed >= 4.0
54 Requires: SDL >= 1.2.1
55 ExclusiveArch: %{ix86} %{x8664} ppc
56 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
57 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 # some SPARC boot image in ELF format
60 %define _noautostrip .*%{_datadir}/qemu/proll.elf
67 QEMU is a FAST! processor emulator. By using dynamic translation it
68 achieves a reasonnable speed while being easy to port on new host
69 CPUs. QEMU has two operating modes:
71 - User mode emulation. In this mode, QEMU can launch Linux processes
72 compiled for one CPU on another CPU. Linux system calls are converted
73 because of endianness and 32/64 bit mismatches. Wine (Windows
74 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
76 - Full system emulation. In this mode, QEMU emulates a full system,
77 including a processor and various peripherials.
78 It can also be used to provide virtual hosting of several
79 virtual PC on a single server.
82 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
83 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
84 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
86 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
87 procesy linuksowe skompilowane dla jednego procesora na innym
88 procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
89 na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
90 s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
93 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
94 w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
95 Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych
96 pecetów na pojedynczym serwerze.
98 %package -n kernel-misc-kqemu
99 Summary: kqemu - kernel module
100 Summary(pl): kqemu - modu³ j±dra
101 Version: %{_kqemu_version}
102 Release: %{_rel}@%{_kernel_ver_str}
104 %{?with_dist_kernel:%requires_releq_kernel_up}
105 License: Free to use, non-distributable
106 Requires(post,postun): /sbin/depmod
108 %description -n kernel-misc-kqemu
109 kqemu - kernel module.
111 %description -n kernel-misc-kqemu -l pl
114 %package -n kernel-smp-misc-kqemu
115 Summary: kqemu - SMP kernel module
116 Summary(pl): kqemu - modu³ j±dra SMP
117 Version: %{_kqemu_version}
118 Release: %{_rel}@%{_kernel_ver_str}
120 %{?with_dist_kernel:%requires_releq_kernel_up}
121 License: Free to use, non-distributable
122 Requires(post,postun): /sbin/depmod
124 %description -n kernel-smp-misc-kqemu
125 kqemu - SMP kernel module.
127 %description -n kernel-smp-misc-kqemu -l pl
128 kqemu - modu³ j±dra SMP.
131 %setup -q %{?with_kqemu:-a1}
141 # probably not needed
143 %{?with_nosdlgui:%patch8 -p1}
148 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
149 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
151 # cannot use optflags on x86 - they cause "no register to spill" errors
152 %if %{with cflags_passing}
153 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
155 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
158 %{?with_kqemu:echo -n > kqemu/install.sh}
163 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
164 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
168 install -d include/{linux,config}
169 ln -sf %{_kernelsrcdir}/config-$cfg .config
170 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
171 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
172 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
173 %if %{without dist_kernel}
174 ln -sf %{_kernelsrcdir}/scripts
176 touch include/config/MARKER
177 %{__make} -C %{_kernelsrcdir} clean \
178 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
180 %{__make} -C %{_kernelsrcdir} modules \
182 mv kqemu.ko kqemu-mod-$cfg.ko
187 %if %{with userspace}
188 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
189 # they can be passed if the cflags_passing bcond is used
191 --prefix=%{_prefix} \
193 %{?with_gcc4:--disable-gcc-check} \
194 %{!?with_kqemu:--disable-kqemu} \
197 --interp-prefix=%{_libdir}/%{name}
202 rm -rf $RPM_BUILD_ROOT
204 %if %{with userspace}
206 DESTDIR=$RPM_BUILD_ROOT
208 install -d $RPM_BUILD_ROOT/sbin
209 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
211 if [ -f /etc/sysconfig/qemu ]; then
212 . /etc/sysconfig/qemu
214 # of course this will work only for one interface. a lot possible to involve
215 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
220 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
221 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
222 %if %{with smp} && %{with dist_kernel}
223 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
227 # This dir is unneeded
228 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
231 rm -rf $RPM_BUILD_ROOT
235 %banner %{name} -e <<EOF
236 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
241 %post -n kernel-misc-kqemu
242 %depmod %{_kernel_ver}
243 %banner %{name}-module -e <<EOF
244 To autoload kqemu module, add to /etc/modprobe.conf:
245 alias char-major-250 kqemu
248 %postun -n kernel-misc-kqemu
249 %depmod %{_kernel_ver}
251 %post -n kernel-smp-misc-kqemu
252 %depmod %{_kernel_ver}smp
253 %banner %{name}-module -e <<EOF
254 To autoload kqemu module, add to /etc/modprobe.conf:
255 alias char-major-250 kqemu
258 %postun -n kernel-smp-misc-kqemu
259 %depmod %{_kernel_ver}smp
261 %if %{with userspace}
263 %defattr(644,root,root,755)
264 %doc README qemu-doc.html qemu-tech.html
265 %attr(755,root,root) /sbin/qemu-ifup
266 %attr(755,root,root) %{_bindir}/*
268 %{_mandir}/man1/qemu.1*
269 %{_mandir}/man1/qemu-img.1*
270 # FIXME: maybe better moved this into dev.spec
272 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
277 %files -n kernel-misc-kqemu
278 %defattr(644,root,root,755)
280 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
282 %if %{with smp} && %{with dist_kernel}
283 %files -n kernel-smp-misc-kqemu
284 %defattr(644,root,root,755)
286 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*