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_without dist_kernel # without distribution kernel
10 %bcond_without kernel # don't build kernel modules
11 %bcond_without smp # don't build SMP module
12 %bcond_without userspace # don't build userspace utilities
14 %define _kqemu_version 0.7.2
16 Summary: QEMU CPU Emulator
17 Summary(pl): QEMU - emulator procesora
21 Release: %{_rel}%{?with_kqemu:k}
23 Group: Applications/Emulators
24 #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
25 Source0: http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz
26 # Source0-md5: eb175b26583280706fe7e4d8910d320d
28 Source1: http://fabrice.bellard.free.fr/qemu/kqemu-%{_kqemu_version}.tar.gz
29 # NoSource1-md5: 02cfdecda90458d6393781496ec6b48b
32 Patch0: %{name}-nostatic.patch
33 Patch1: %{name}-DESTDIR.patch
34 Patch2: %{name}-longjmp.patch
35 Patch3: %{name}-dot.patch
36 Patch4: %{name}-initrd_load_addr.patch
37 Patch5: %{name}-gcc4_x86.patch
38 Patch6: %{name}-gcc4_ppc.patch
39 Patch7: %{name}-parallel.patch
40 Patch8: %{name}-nosdlgui.patch
41 Patch9: %{name}-ifup.patch
42 URL: http://fabrice.bellard.free.fr/qemu/
43 BuildRequires: SDL-devel >= 1.2.1
44 %if %{with kqemu} && %{with dist_kernel}
45 BuildRequires: kernel-module-build >= 2.6.7
47 BuildRequires: rpmbuild(macros) >= 1.217
48 BuildRequires: sed >= 4.0
49 Requires: SDL >= 1.2.1
50 ExclusiveArch: %{ix86} %{x8664} ppc
51 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
52 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54 # some SPARC boot image in ELF format
55 %define _noautostrip .*%{_datadir}/qemu/proll.elf
62 QEMU is a FAST! processor emulator. By using dynamic translation it
63 achieves a reasonnable speed while being easy to port on new host
64 CPUs. QEMU has two operating modes:
66 - User mode emulation. In this mode, QEMU can launch Linux processes
67 compiled for one CPU on another CPU. Linux system calls are converted
68 because of endianness and 32/64 bit mismatches. Wine (Windows
69 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
71 - Full system emulation. In this mode, QEMU emulates a full system,
72 including a processor and various peripherials.
73 It can also be used to provide virtual hosting of several
74 virtual PC on a single server.
77 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
78 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
79 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
81 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
82 procesy linuksowe skompilowane dla jednego procesora na innym
83 procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
84 na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
85 s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
88 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
89 w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
90 Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych
91 pecetów na pojedynczym serwerze.
93 %package -n kernel-misc-kqemu
94 Summary: kqemu - kernel module
95 Summary(pl): kqemu - modu³ j±dra
96 Version: %{_kqemu_version}
97 Release: %{_rel}@%{_kernel_ver_str}
99 %{?with_dist_kernel:%requires_releq_kernel_up}
100 License: Free to use, non-distributable
101 Requires(post,postun): /sbin/depmod
103 %description -n kernel-misc-kqemu
104 kqemu - kernel module.
106 %description -n kernel-misc-kqemu -l pl
109 %package -n kernel-smp-misc-kqemu
110 Summary: kqemu - SMP kernel module
111 Summary(pl): kqemu - modu³ j±dra SMP
112 Version: %{_kqemu_version}
113 Release: %{_rel}@%{_kernel_ver_str}
115 %{?with_dist_kernel:%requires_releq_kernel_up}
116 License: Free to use, non-distributable
117 Requires(post,postun): /sbin/depmod
119 %description -n kernel-smp-misc-kqemu
120 kqemu - SMP kernel module.
122 %description -n kernel-smp-misc-kqemu -l pl
123 kqemu - modu³ j±dra SMP.
126 %setup -q %{?with_kqemu:-a1}
134 # probably not needed
136 %{?with_nosdlgui:%patch8 -p1}
139 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
140 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
142 # cannot use optflags on x86 - they cause "no register to spill" errors
143 %if %{with cflags_passing}
144 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
146 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
149 %{?with_kqemu:echo -n > kqemu/install.sh}
154 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
155 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
159 install -d include/{linux,config}
160 ln -sf %{_kernelsrcdir}/config-$cfg .config
161 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
162 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
163 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
164 %if %{without dist_kernel}
165 ln -sf %{_kernelsrcdir}/scripts
167 touch include/config/MARKER
168 %{__make} -C %{_kernelsrcdir} clean \
169 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
171 %{__make} -C %{_kernelsrcdir} modules \
173 mv kqemu.ko kqemu-mod-$cfg.ko
178 %if %{with userspace}
179 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
180 # they can be passed if the cflags_passing bcond is used
182 --prefix=%{_prefix} \
184 %{!?with_kqemu:--disable-kqemu} \
190 rm -rf $RPM_BUILD_ROOT
192 %if %{with userspace}
194 DESTDIR=$RPM_BUILD_ROOT
196 install -d $RPM_BUILD_ROOT/sbin
197 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
199 if [ -f /etc/sysconfig/qemu ]; then
200 . /etc/sysconfig/qemu
202 # of course this will work only for one interface. a lot possible to involve
203 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
208 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
209 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
210 %if %{with smp} && %{with dist_kernel}
211 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
215 # This dir is unneeded
216 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
219 rm -rf $RPM_BUILD_ROOT
223 %banner %{name} -e <<EOF
224 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
229 %post -n kernel-misc-kqemu
230 %depmod %{_kernel_ver}
231 %banner %{name}-module -e <<EOF
232 To autoload kqemu module, add to /etc/modprobe.conf:
233 alias char-major-250 kqemu
236 %postun -n kernel-misc-kqemu
237 %depmod %{_kernel_ver}
239 %post -n kernel-smp-misc-kqemu
240 %depmod %{_kernel_ver}smp
241 %banner %{name}-module -e <<EOF
242 To autoload kqemu module, add to /etc/modprobe.conf:
243 alias char-major-250 kqemu
246 %postun -n kernel-smp-misc-kqemu
247 %depmod %{_kernel_ver}smp
249 %if %{with userspace}
251 %defattr(644,root,root,755)
252 %doc README qemu-doc.html qemu-tech.html
253 %attr(755,root,root) /sbin/qemu-ifup
254 %attr(755,root,root) %{_bindir}/*
256 %{_mandir}/man1/qemu.1*
257 %{_mandir}/man1/qemu-img.1*
258 # FIXME: maybe better moved this into dev.spec
260 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
265 %files -n kernel-misc-kqemu
266 %defattr(644,root,root,755)
267 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
270 %if %{with smp} && %{with dist_kernel}
271 %files -n kernel-smp-misc-kqemu
272 %defattr(644,root,root,755)
273 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*