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 Summary: QEMU CPU Emulator
15 Summary(pl): QEMU - emulator procesora
19 Release: %{_rel}%{?with_kqemu:k}
21 Group: Applications/Emulators
22 #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
23 Source0: http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz
24 # Source0-md5: 7d69dd96edf7ae5298a9a7283a0e9fb8
26 Source1: http://fabrice.bellard.free.fr/qemu/kqemu-%{version}.tar.gz
27 # NoSource1-md5: 02cfdecda90458d6393781496ec6b48b
30 Patch0: %{name}-nostatic.patch
31 Patch1: %{name}-DESTDIR.patch
32 Patch2: %{name}-longjmp.patch
33 Patch3: %{name}-dot.patch
34 Patch4: %{name}-initrd_load_addr.patch
35 Patch5: %{name}-gcc4_x86.patch
36 Patch6: %{name}-gcc4_ppc.patch
37 Patch7: %{name}-parallel.patch
38 Patch8: %{name}-nosdlgui.patch
39 Patch9: %{name}-ifup.patch
40 URL: http://fabrice.bellard.free.fr/qemu/
41 BuildRequires: SDL-devel >= 1.2.1
42 %if %{with kqemu} && %{with dist_kernel}
43 BuildRequires: kernel-module-build >= 2.6.7
45 BuildRequires: rpmbuild(macros) >= 1.217
46 BuildRequires: sed >= 4.0
47 Requires: SDL >= 1.2.1
48 ExclusiveArch: %{ix86} %{x8664} ppc
49 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
50 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
52 # some SPARC boot image in ELF format
53 %define _noautostrip .*%{_datadir}/qemu/proll.elf
60 QEMU is a FAST! processor emulator. By using dynamic translation it
61 achieves a reasonnable speed while being easy to port on new host
62 CPUs. QEMU has two operating modes:
64 - User mode emulation. In this mode, QEMU can launch Linux processes
65 compiled for one CPU on another CPU. Linux system calls are converted
66 because of endianness and 32/64 bit mismatches. Wine (Windows
67 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
69 - Full system emulation. In this mode, QEMU emulates a full system,
70 including a processor and various peripherials.
71 It can also be used to provide virtual hosting of several
72 virtual PC on a single server.
75 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
76 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
77 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
79 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
80 procesy linuksowe skompilowane dla jednego procesora na innym
81 procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
82 na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
83 s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
86 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
87 w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
88 Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych
89 pecetów na pojedynczym serwerze.
91 %package -n kernel-misc-kqemu
92 Summary: kqemu - kernel module
93 Summary(pl): kqemu - modu³ j±dra
94 Release: %{_rel}@%{_kernel_ver_str}
96 %{?with_dist_kernel:%requires_releq_kernel_up}
97 Requires(post,postun): /sbin/depmod
99 %description -n kernel-misc-kqemu
100 kqemu - kernel module.
102 %description -n kernel-misc-kqemu -l pl
105 %package -n kernel-smp-misc-kqemu
106 Summary: kqemu - SMP kernel module
107 Summary(pl): kqemu - modu³ j±dra SMP
108 Release: %{_rel}@%{_kernel_ver_str}
110 %{?with_dist_kernel:%requires_releq_kernel_up}
111 Requires(post,postun): /sbin/depmod
113 %description -n kernel-smp-misc-kqemu
114 kqemu - SMP kernel module.
116 %description -n kernel-smp-misc-kqemu -l pl
117 kqemu - modu³ j±dra SMP.
120 %setup -q %{?with_kqemu:-a1}
129 %{?with_nosdlgui:%patch8 -p1}
132 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
133 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
135 # cannot use optflags on x86 - they cause "no register to spill" errors
136 %if %{with cflags_passing}
137 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
139 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
142 %{?with_kqemu:echo -n > kqemu/install.sh}
147 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
148 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
152 install -d include/{linux,config}
153 ln -sf %{_kernelsrcdir}/config-$cfg .config
154 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
155 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
156 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
157 %if %{without dist_kernel}
158 ln -sf %{_kernelsrcdir}/scripts
160 touch include/config/MARKER
161 %{__make} -C %{_kernelsrcdir} clean \
162 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
164 %{__make} -C %{_kernelsrcdir} modules \
166 mv kqemu.ko kqemu-mod-$cfg.ko
171 %if %{with userspace}
172 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
173 # they can be passed if the cflags_passing bcond is used
175 --prefix=%{_prefix} \
177 %{!?with_kqemu:--disable-kqemu} \
183 rm -rf $RPM_BUILD_ROOT
185 %if %{with userspace}
187 DESTDIR=$RPM_BUILD_ROOT
189 install -d $RPM_BUILD_ROOT/sbin
190 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
192 if [ -f /etc/sysconfig/qemu ]; then
193 . /etc/sysconfig/qemu
195 # of course this will work only for one interface. a lot possible to involve
196 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
201 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
202 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
203 %if %{with smp} && %{with dist_kernel}
204 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
208 # This dir is unneeded
209 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
212 rm -rf $RPM_BUILD_ROOT
216 %banner %{name} -e <<EOF
217 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
222 %post -n kernel-misc-kqemu
223 %depmod %{_kernel_ver}
224 %banner %{name}-module -e <<EOF
225 To autoload kqemu module, add to /etc/modprobe.conf:
226 alias char-major-250 kqemu
229 %postun -n kernel-misc-kqemu
230 %depmod %{_kernel_ver}
232 %post -n kernel-smp-misc-kqemu
233 %depmod %{_kernel_ver}smp
234 %banner %{name}-module -e <<EOF
235 To autoload kqemu module, add to /etc/modprobe.conf:
236 alias char-major-250 kqemu
239 %postun -n kernel-smp-misc-kqemu
240 %depmod %{_kernel_ver}smp
242 %if %{with userspace}
244 %defattr(644,root,root,755)
245 %doc README qemu-doc.html qemu-tech.html
246 %attr(755,root,root) /sbin/qemu-ifup
247 %attr(755,root,root) %{_bindir}/*
249 %{_mandir}/man1/qemu.1*
250 %{_mandir}/man1/qemu-img.1*
251 # FIXME: maybe better moved this into dev.spec
253 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
258 %files -n kernel-misc-kqemu
259 %defattr(644,root,root,755)
260 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
262 %if %{with smp} && %{with dist_kernel}
263 %files -n kernel-smp-misc-kqemu
264 %defattr(644,root,root,755)
265 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*