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 Patch10: %{name}-gcc33.patch
43 URL: http://fabrice.bellard.free.fr/qemu/
44 BuildRequires: SDL-devel >= 1.2.1
45 BuildRequires: alsa-lib-devel
46 %if %{with kqemu} && %{with dist_kernel}
47 BuildRequires: kernel-module-build >= 2.6.7
49 BuildRequires: rpmbuild(macros) >= 1.217
50 BuildRequires: sed >= 4.0
51 Requires: SDL >= 1.2.1
52 ExclusiveArch: %{ix86} %{x8664} ppc
53 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
54 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56 # some SPARC boot image in ELF format
57 %define _noautostrip .*%{_datadir}/qemu/proll.elf
64 QEMU is a FAST! processor emulator. By using dynamic translation it
65 achieves a reasonnable speed while being easy to port on new host
66 CPUs. QEMU has two operating modes:
68 - User mode emulation. In this mode, QEMU can launch Linux processes
69 compiled for one CPU on another CPU. Linux system calls are converted
70 because of endianness and 32/64 bit mismatches. Wine (Windows
71 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
73 - Full system emulation. In this mode, QEMU emulates a full system,
74 including a processor and various peripherials.
75 It can also be used to provide virtual hosting of several
76 virtual PC on a single server.
79 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
80 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
81 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
83 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
84 procesy linuksowe skompilowane dla jednego procesora na innym
85 procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
86 na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
87 s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
90 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
91 w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
92 Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych
93 pecetów na pojedynczym serwerze.
95 %package -n kernel-misc-kqemu
96 Summary: kqemu - kernel module
97 Summary(pl): kqemu - modu³ j±dra
98 Version: %{_kqemu_version}
99 Release: %{_rel}@%{_kernel_ver_str}
101 %{?with_dist_kernel:%requires_releq_kernel_up}
102 License: Free to use, non-distributable
103 Requires(post,postun): /sbin/depmod
105 %description -n kernel-misc-kqemu
106 kqemu - kernel module.
108 %description -n kernel-misc-kqemu -l pl
111 %package -n kernel-smp-misc-kqemu
112 Summary: kqemu - SMP kernel module
113 Summary(pl): kqemu - modu³ j±dra SMP
114 Version: %{_kqemu_version}
115 Release: %{_rel}@%{_kernel_ver_str}
117 %{?with_dist_kernel:%requires_releq_kernel_up}
118 License: Free to use, non-distributable
119 Requires(post,postun): /sbin/depmod
121 %description -n kernel-smp-misc-kqemu
122 kqemu - SMP kernel module.
124 %description -n kernel-smp-misc-kqemu -l pl
125 kqemu - modu³ j±dra SMP.
128 %setup -q %{?with_kqemu:-a1}
136 # probably not needed
138 %{?with_nosdlgui:%patch8 -p1}
142 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
143 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
145 # cannot use optflags on x86 - they cause "no register to spill" errors
146 %if %{with cflags_passing}
147 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
149 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
152 %{?with_kqemu:echo -n > kqemu/install.sh}
157 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
158 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
162 install -d include/{linux,config}
163 ln -sf %{_kernelsrcdir}/config-$cfg .config
164 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
165 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
166 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
167 %if %{without dist_kernel}
168 ln -sf %{_kernelsrcdir}/scripts
170 touch include/config/MARKER
171 %{__make} -C %{_kernelsrcdir} clean \
172 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
174 %{__make} -C %{_kernelsrcdir} modules \
176 mv kqemu.ko kqemu-mod-$cfg.ko
181 %if %{with userspace}
182 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
183 # they can be passed if the cflags_passing bcond is used
185 --prefix=%{_prefix} \
188 %{!?with_kqemu:--disable-kqemu} \
194 rm -rf $RPM_BUILD_ROOT
196 %if %{with userspace}
198 DESTDIR=$RPM_BUILD_ROOT
200 install -d $RPM_BUILD_ROOT/sbin
201 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
203 if [ -f /etc/sysconfig/qemu ]; then
204 . /etc/sysconfig/qemu
206 # of course this will work only for one interface. a lot possible to involve
207 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
212 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
213 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
214 %if %{with smp} && %{with dist_kernel}
215 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
219 # This dir is unneeded
220 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
223 rm -rf $RPM_BUILD_ROOT
227 %banner %{name} -e <<EOF
228 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
233 %post -n kernel-misc-kqemu
234 %depmod %{_kernel_ver}
235 %banner %{name}-module -e <<EOF
236 To autoload kqemu module, add to /etc/modprobe.conf:
237 alias char-major-250 kqemu
240 %postun -n kernel-misc-kqemu
241 %depmod %{_kernel_ver}
243 %post -n kernel-smp-misc-kqemu
244 %depmod %{_kernel_ver}smp
245 %banner %{name}-module -e <<EOF
246 To autoload kqemu module, add to /etc/modprobe.conf:
247 alias char-major-250 kqemu
250 %postun -n kernel-smp-misc-kqemu
251 %depmod %{_kernel_ver}smp
253 %if %{with userspace}
255 %defattr(644,root,root,755)
256 %doc README qemu-doc.html qemu-tech.html
257 %attr(755,root,root) /sbin/qemu-ifup
258 %attr(755,root,root) %{_bindir}/*
260 %{_mandir}/man1/qemu.1*
261 %{_mandir}/man1/qemu-img.1*
262 # FIXME: maybe better moved this into dev.spec
264 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
269 %files -n kernel-misc-kqemu
270 %defattr(644,root,root,755)
272 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
274 %if %{with smp} && %{with dist_kernel}
275 %files -n kernel-smp-misc-kqemu
276 %defattr(644,root,root,755)
278 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*