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: b0c80d2c082049a5b8ccbc7f55fe165b
26 Source1: http://fabrice.bellard.free.fr/qemu/kqemu-%{version}-1.tar.gz
27 # NoSource1-md5: 012498dac620eb8c212bf5f622414dd0
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 URL: http://fabrice.bellard.free.fr/qemu/
40 BuildRequires: SDL-devel >= 1.2.1
41 %if %{with kqemu} && %{with dist_kernel}
42 BuildRequires: kernel-module-build >= 2.6.7
44 BuildRequires: rpmbuild(macros) >= 1.217
45 BuildRequires: sed >= 4.0
46 Requires: SDL >= 1.2.1
47 ExclusiveArch: %{ix86} %{x8664} ppc
48 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
49 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51 # some SPARC boot image in ELF format
52 %define _noautostrip .*%{_datadir}/qemu/proll.elf
59 QEMU is a FAST! processor emulator. By using dynamic translation it
60 achieves a reasonnable speed while being easy to port on new host
61 CPUs. QEMU has two operating modes:
63 - User mode emulation. In this mode, QEMU can launch Linux processes
64 compiled for one CPU on another CPU. Linux system calls are converted
65 because of endianness and 32/64 bit mismatches. Wine (Windows
66 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
68 - Full system emulation. In this mode, QEMU emulates a full system,
69 including a processor and various peripherials.
70 It can also be used to provide virtual hosting of several
71 virtual PC on a single server.
74 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
75 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
76 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
78 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
79 procesy linuksowe skompilowane dla jednego procesora na innym
80 procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
81 na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
82 s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
85 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
86 w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
87 Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych
88 pecetów na pojedynczym serwerze.
90 %package -n kernel-misc-kqemu
91 Summary: kqemu - kernel module
92 Summary(pl): kqemu - modu³ j±dra
93 Release: %{_rel}@%{_kernel_ver_str}
95 %{?with_dist_kernel:%requires_releq_kernel_up}
96 Requires(post,postun): /sbin/depmod
98 %description -n kernel-misc-kqemu
99 kqemu - kernel module.
101 %description -n kernel-misc-kqemu -l pl
104 %package -n kernel-smp-misc-kqemu
105 Summary: kqemu - SMP kernel module
106 Summary(pl): kqemu - modu³ j±dra SMP
107 Release: %{_rel}@%{_kernel_ver_str}
109 %{?with_dist_kernel:%requires_releq_kernel_up}
110 Requires(post,postun): /sbin/depmod
112 %description -n kernel-smp-misc-kqemu
113 kqemu - SMP kernel module.
115 %description -n kernel-smp-misc-kqemu -l pl
116 kqemu - modu³ j±dra SMP.
119 %setup -q %{?with_kqemu:-a1}
128 %{?with_nosdlgui:%patch8 -p1}
130 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
131 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
133 # cannot use optflags on x86 - they cause "no register to spill" errors
134 %if %{with cflags_passing}
135 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
138 %{?with_kqemu:echo -n > kqemu/install.sh}
143 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
144 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
148 install -d include/{linux,config}
149 ln -sf %{_kernelsrcdir}/config-$cfg .config
150 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
151 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
152 %if %{without dist_kernel}
153 ln -sf %{_kernelsrcdir}/scripts
155 touch include/config/MARKER
156 %{__make} -C %{_kernelsrcdir} clean \
157 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
159 %{__make} -C %{_kernelsrcdir} modules \
161 mv kqemu.ko kqemu-mod-$cfg.ko
166 %if %{with userspace}
167 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
168 # they can be passed if the cflags_passing bcond is used
170 --prefix=%{_prefix} \
172 %{!?with_kqemu:--disable-kqemu} \
178 rm -rf $RPM_BUILD_ROOT
180 %if %{with userspace}
182 DESTDIR=$RPM_BUILD_ROOT
186 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
187 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
188 %if %{with smp} && %{with dist_kernel}
189 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
193 # This dir is unneeded
194 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
197 rm -rf $RPM_BUILD_ROOT
201 %banner %{name} -e << EOF
202 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
207 %post -n kernel-misc-kqemu
208 %depmod %{_kernel_ver}
210 %postun -n kernel-misc-kqemu
211 %depmod %{_kernel_ver}
213 %post -n kernel-smp-misc-kqemu
214 %depmod %{_kernel_ver}smp
216 %postun -n kernel-smp-misc-kqemu
217 %depmod %{_kernel_ver}smp
220 %if %{with userspace}
222 %defattr(644,root,root,755)
223 %doc README qemu-doc.html qemu-tech.html
224 %attr(755,root,root) %{_bindir}/*
226 %{_mandir}/man1/qemu.1*
227 %{_mandir}/man1/qemu-img.1*
228 # FIXME: maybe better moved this into dev.spec
230 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
235 %files -n kernel-misc-kqemu
236 %defattr(644,root,root,755)
237 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
239 %if %{with smp} && %{with dist_kernel}
240 %files -n kernel-smp-misc-kqemu
241 %defattr(644,root,root,755)
242 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*