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 %if %{with kqemu} && %{with dist_kernel}
46 BuildRequires: kernel-module-build >= 2.6.7
48 BuildRequires: rpmbuild(macros) >= 1.217
49 BuildRequires: sed >= 4.0
50 Requires: SDL >= 1.2.1
51 ExclusiveArch: %{ix86} %{x8664} ppc
52 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
53 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
55 # some SPARC boot image in ELF format
56 %define _noautostrip .*%{_datadir}/qemu/proll.elf
63 QEMU is a FAST! processor emulator. By using dynamic translation it
64 achieves a reasonnable speed while being easy to port on new host
65 CPUs. QEMU has two operating modes:
67 - User mode emulation. In this mode, QEMU can launch Linux processes
68 compiled for one CPU on another CPU. Linux system calls are converted
69 because of endianness and 32/64 bit mismatches. Wine (Windows
70 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
72 - Full system emulation. In this mode, QEMU emulates a full system,
73 including a processor and various peripherials.
74 It can also be used to provide virtual hosting of several
75 virtual PC on a single server.
78 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
79 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
80 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
82 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
83 procesy linuksowe skompilowane dla jednego procesora na innym
84 procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
85 na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
86 s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
89 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
90 w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
91 Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych
92 pecetów na pojedynczym serwerze.
94 %package -n kernel-misc-kqemu
95 Summary: kqemu - kernel module
96 Summary(pl): kqemu - modu³ j±dra
97 Version: %{_kqemu_version}
98 Release: %{_rel}@%{_kernel_ver_str}
100 %{?with_dist_kernel:%requires_releq_kernel_up}
101 License: Free to use, non-distributable
102 Requires(post,postun): /sbin/depmod
104 %description -n kernel-misc-kqemu
105 kqemu - kernel module.
107 %description -n kernel-misc-kqemu -l pl
110 %package -n kernel-smp-misc-kqemu
111 Summary: kqemu - SMP kernel module
112 Summary(pl): kqemu - modu³ j±dra SMP
113 Version: %{_kqemu_version}
114 Release: %{_rel}@%{_kernel_ver_str}
116 %{?with_dist_kernel:%requires_releq_kernel_up}
117 License: Free to use, non-distributable
118 Requires(post,postun): /sbin/depmod
120 %description -n kernel-smp-misc-kqemu
121 kqemu - SMP kernel module.
123 %description -n kernel-smp-misc-kqemu -l pl
124 kqemu - modu³ j±dra SMP.
127 %setup -q %{?with_kqemu:-a1}
135 # probably not needed
137 %{?with_nosdlgui:%patch8 -p1}
141 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
142 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
144 # cannot use optflags on x86 - they cause "no register to spill" errors
145 %if %{with cflags_passing}
146 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
148 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
151 %{?with_kqemu:echo -n > kqemu/install.sh}
156 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
157 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
161 install -d include/{linux,config}
162 ln -sf %{_kernelsrcdir}/config-$cfg .config
163 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
164 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
165 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
166 %if %{without dist_kernel}
167 ln -sf %{_kernelsrcdir}/scripts
169 touch include/config/MARKER
170 %{__make} -C %{_kernelsrcdir} clean \
171 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
173 %{__make} -C %{_kernelsrcdir} modules \
175 mv kqemu.ko kqemu-mod-$cfg.ko
180 %if %{with userspace}
181 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
182 # they can be passed if the cflags_passing bcond is used
184 --prefix=%{_prefix} \
186 %{!?with_kqemu:--disable-kqemu} \
192 rm -rf $RPM_BUILD_ROOT
194 %if %{with userspace}
196 DESTDIR=$RPM_BUILD_ROOT
198 install -d $RPM_BUILD_ROOT/sbin
199 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
201 if [ -f /etc/sysconfig/qemu ]; then
202 . /etc/sysconfig/qemu
204 # of course this will work only for one interface. a lot possible to involve
205 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
210 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
211 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
212 %if %{with smp} && %{with dist_kernel}
213 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
217 # This dir is unneeded
218 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
221 rm -rf $RPM_BUILD_ROOT
225 %banner %{name} -e <<EOF
226 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
231 %post -n kernel-misc-kqemu
232 %depmod %{_kernel_ver}
233 %banner %{name}-module -e <<EOF
234 To autoload kqemu module, add to /etc/modprobe.conf:
235 alias char-major-250 kqemu
238 %postun -n kernel-misc-kqemu
239 %depmod %{_kernel_ver}
241 %post -n kernel-smp-misc-kqemu
242 %depmod %{_kernel_ver}smp
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-smp-misc-kqemu
249 %depmod %{_kernel_ver}smp
251 %if %{with userspace}
253 %defattr(644,root,root,755)
254 %doc README qemu-doc.html qemu-tech.html
255 %attr(755,root,root) /sbin/qemu-ifup
256 %attr(755,root,root) %{_bindir}/*
258 %{_mandir}/man1/qemu.1*
259 %{_mandir}/man1/qemu-img.1*
260 # FIXME: maybe better moved this into dev.spec
262 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
267 %files -n kernel-misc-kqemu
268 %defattr(644,root,root,755)
269 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
272 %if %{with smp} && %{with dist_kernel}
273 %files -n kernel-smp-misc-kqemu
274 %defattr(644,root,root,755)
275 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*