%global build_utils 0 %global enterprise 0 %define _ik() /usr/sbin/bootloader-config --action add-kernel --image %{1} --initrd-options "--initrdfs=cramfs" %define _uk() /usr/sbin/bootloader-config --action remove-kernel --image %{1} #%define puk() rm -f /boot/initrd-win4lin-%{1}.img %define puk() depmod -a %{1} >/dev/null 2>&1;rm -f /boot/initrd-win4lin-%{1}.img %define DISTRO %(awk '{print $1}' /etc/mandrake-release) %define DISTVER %(awk '{print $4}' /etc/mandrake-release) Source0: version.sh %{?!_kernel:%global _kernel %(/bin/bash %{SOURCE0})} %define KERNVER %(echo %_kernel|cut -f1 -d-) %define W4LIN_EXT 13 %define DISTRO_EXT %(echo %_kernel|cut -f2 -d-) %define MKIVER 3 %global flavors UP SMP _I686_UP_4GB _I586_UP_1GB # bump this up if you create new release with the same elsewhere %define THISREVISION 10mdk # n or y to build the new mki adapter module %define MAKEADAPTER y %define PKGNAME kernel-win4lin-%{KERNVER}.%{DISTRO_EXT} # These change for smp and bigmem in most cases %define THISVERSION %{KERNVER}.%{W4LIN_EXT} %define EXTRAVERSION -%{DISTRO_EXT} %define CONFIGFILE arch/i386/defconfig %define PATCHVERSION %{W4LIN_EXT} %define SOURCELOC /usr/src/linux-%{KERNVER}-%{DISTRO_EXT} %define BUILDSUB %{PKGNAME}-%{PATCHVERSION} %define MKIPATCH %{PKGNAME}-%{PATCHVERSION}.patch %define ADAPTERPATCH mki-adapter26_1_3_12.patch Summary: Kernel for Win4Lin Package Name: kernel-win4lin-2.6 Version: %{MKIVER} Release: %{THISREVISION} Group: System/Kernel and hardware License: GPL URL: http://www.netraverse.com/ Source1: win4lin.xpm Source4: kernel-win4lin.h Source5: %{MKIPATCH} Source6: %{ADAPTERPATCH} Source7: kernel-win4lin-2.6-previous-version BuildRoot: %{_tmppath}/kernel-build-w4l-%{PKGNAME} BuildRequires: kernel-source %if %build_utils BuildRequires: ImageMagick %endif %description This is a patched version of the linux kernel for use with the Win4Lin package. It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel. %package -n %{PKGNAME} Summary: Kernel for Win4Lin Package Group: System/Kernel and hardware License: GPL URL: http://www.netraverse.com/ Obsoletes: Kernel-Win4Lin3 Provides: Kernel-Win4Lin3 PreReq: kernel-%{KERNVER}.%{DISTRO_EXT} PreReq: bootloader-utils >= 1.8 %description -n %{PKGNAME} This is a patched version of the linux kernel for use with the Win4Lin package. It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel. %package -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT} Group: System/Kernel and hardware License: GPL Summary: SMP Kernel for Win4Lin Package URL: http://www.netraverse.com/ Obsoletes: Kernel-Win4Lin3 Provides: Kernel-Win4Lin3 PreReq: kernel-smp-%{KERNVER}.%{DISTRO_EXT} PreReq: bootloader-utils >= 1.8 %description -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT} This is a patched version of the linux kernel for use with the Win4Lin package. It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for SMP machines %if %enterprise %package -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT} Group: System/Kernel and hardware License: GPL Summary: Enterprise Kernel for Win4Lin Package URL: http://www.netraverse.com/ Obsoletes: Kernel-Win4Lin3 Provides: Kernel-Win4Lin3 PreReq: kernel-enterprise-%{KERNVER}.%{DISTRO_EXT} PreReq: bootloader-utils >= 1.8 %description -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT} This is a patched version of the linux kernel for use with the Win4Lin package. It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for machines with more than 1GB of memory. %endif %package -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} Group: System/Kernel and hardware License: GPL Summary: i686 4GB Kernel for Win4Lin Package URL: http://www.netraverse.com/ Obsoletes: Kernel-Win4Lin3 Provides: Kernel-Win4Lin3 PreReq: kernel-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} PreReq: bootloader-utils >= 1.8 %description -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} This is a patched version of the linux kernel for use with the Win4Lin package. It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for machines with up to 4GB of memory and i686-compatible CPUs %package -n kernel-win4lin-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} Group: System/Kernel and hardware License: GPL Summary: P3 64GB Kernel for Win4Lin Package URL: http://www.netraverse.com/ Obsoletes: Kernel-Win4Lin3 Provides: Kernel-Win4Lin3 PreReq: kernel-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} PreReq: bootloader-utils >= 1.8 %description -n kernel-win4lin-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} This is a patched version of the linux kernel for use with the Win4Lin package. It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for machines with up to 1GB of memory and Pentium-compatible processors. %if %build_utils %package -n win4lin-utils Group: System/Kernel and hardware License: GPL Summary: Bootloader configuration scripts for Win4Lin Kernels %description -n win4lin-utils This package is a version of Mandrake's installkernel script tailored for Win4Lin kernels, and menu entries for the win4lin tools. %endif %prep %setup -q -c -T # you MUST have the appropriate sources installed ! if [ ! -e %{SOURCELOC} ] then echo "You must have the kernel sources installed for this rpm to build!" echo %{SOURCELOC}" does not exist" exit 1 fi mkdir dist if [ ! -e %{SOURCE5} ] then previous=`cat %{SOURCE7}` newpatch=`echo %{SOURCE5}|sed -e "s/%{KERNVER}.%{DISTRO_EXT}/$previous/"` if [ -e $newpatch ] then cp $newpatch %{SOURCE5} else %{error: No patch available please download the current win4lin} %{error: kernel patch and save it as:} %{error: %SOURCE5} exit fi fi %build for i in %{flavors} do if [ ! -e dist/bzImage-${i} ] then cp -a %{SOURCELOC} . ||: # Seems kernel team will never make a fully-readable kernel pushd linux-%{KERNVER}-%{DISTRO_EXT} chmod u+rw * -R make distclean perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{EXTRAVERSION}/" Makefile j=`echo $i|tr [:upper:] [:lower:]|sed -e 's/gb/GB/g;s/_/-/g'` if [ "$j" = "up" ] then cp %{CONFIGFILE} .config; j="" elif [ "$j" = "-i686-up-4GB" -o "$j" = "-i586-up-1GB" ] then cp %{CONFIGFILE}$j .config else cp %{CONFIGFILE}-$j .config fi perl -pi -e 's/CONFIG_MODVERSIONS=y/CONFIG_MODVERSIONS=n/g' .config make oldconfig %make -s dep patch -p1 < %{SOURCE5} grep -q "^+++.*mki-adapter26" %{SOURCE5} || patch -p1 < %{SOURCE6} perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{EXTRAVERSION}${j}/" Makefile echo y | make oldconfig make -s clean %make -s bzImage mv arch/i386/boot/bzImage ../dist/bzImage-${i} mv System.map ../dist/System.map-${i} if [ %{MAKEADAPTER} = y ] then KERN_SRC_PATH=`pwd` pushd arch/i386/mki-adapter26 make -C $KERN_SRC_PATH SUBDIRS=arch/i386/mki-adapter26 \ KERNELRELEASE=%{KERNVER}-%{DISTRO_EXT}${j} # Don't let 'make clean' delete our modules mv mki-adapter.ko ../../../../dist/mki-adapter.ko-${i} popd fi popd rm -Rf linux-%{KERNVER}-%{DISTRO_EXT} fi done %install rm -fr $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_lib} mkdir -p $RPM_BUILD_ROOT/boot mkdir -p $RPM_BUILD_ROOT%{_prefix}src mkdir -p $RPM_BUILD_ROOT%{_sbindir} for i in %{flavors} do j=`echo $i|tr [:upper:] [:lower:]|sed -e 's/gb/GB/g;s/_/-/g'` [ "$j" == "up" ] && j="" cp dist/bzImage-$i $RPM_BUILD_ROOT/boot/win4lin-%{KERNVER}%{EXTRAVERSION}${j} cp dist/System.map-${i} $RPM_BUILD_ROOT/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${j} if [ %{MAKEADAPTER} = y ] then UNAMER=%{KERNVER}%{EXTRAVERSION}${j}; export UNAMER mkdir -p $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/kernel/arch/i386/mki-adapter mkdir -p $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/misc cp dist/mki-adapter.ko-${i} \ $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/kernel/arch/i386/mki-adapter/mki-adapter.ko ln -s ../kernel/arch/i386/mki-adapter/mki-adapter.ko $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/misc/. fi done %if %build_utils #win4lin-loader mkdir -p %{buildroot}/%{_datadir}/ tar -C %{buildroot}/%{_datadir} -xjf %{SOURCE2} mkdir -p %{buildroot}/sbin mv -f %{buildroot}/%{_datadir}/win4lin-loader/installwin4linkernel %{buildroot}/sbin #Menu entries: mkdir -p $RPM_BUILD_ROOT%{_menudir} cat << EOF > $RPM_BUILD_ROOT%{_menudir}/win4lin-utils ?package(win4lin-utils):command="winsetup" icon="win4lin.png" \ needs="x11" section="Configuration/Other" title="Win4Lin" \ longtitle="Win4Lin Configuration" ?package(win4lin-utils):command="win" icon="win4lin.png" \ needs="x11" section="Applications/Emulators/" title="Win4Lin" \ longtitle="Win4Lin" ?package(win4lin-utils):command="fwin" icon="win4lin.png" \ needs="x11" section="Applications/Emulators/" title="Win4Lin full-screen" \ longtitle="Win4Lin in a new X server (full screen)" EOF #icons: mkdir -p %{buildroot}/{%{_miconsdir},%{_liconsdir}} convert -resize 16x16 %{SOURCE1} %{buildroot}/%{_miconsdir}/win4lin.png convert -resize 32x32 %{SOURCE1} %{buildroot}/%{_iconsdir}/win4lin.png convert -resize 48x48 %{SOURCE1} %{buildroot}/%{_liconsdir}/win4lin.png %endif echo "%{KERNVER}.%{DISTRO_EXT}" > %{SOURCE7} %clean rm -Rf %buildroot %post -n %{PKGNAME} depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION} %{KERNVER}%{EXTRAVERSION} >/dev/null 2>&1 %if %build_utils if [ -x /sbin/installwin4linkernel ];then modprobe loop /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION} /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION} fi %else %_ik /boot/win4lin-%{KERNVER}%{EXTRAVERSION} %endif %post -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT} flavor="smp" depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1 %if %build_utils if [ -x /sbin/installwin4linkernel ];then modprobe loop /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} fi %else %_ik /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %if %enterprise %post -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT} flavor="enterprise" depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1 if [ -x /sbin/installwin4linkernel ];then modprobe loop /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} fi %endif %post -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} flavor="-i686-up-4GB" depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1 %if %build_utils if [ -x /sbin/installwin4linkernel ];then modprobe loop /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} fi %else %_ik /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %post -n kernel-win4lin-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} flavor="-i586-up-1GB" depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1 %if %build_utils if [ -x /sbin/installwin4linkernel ];then modprobe loop /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} fi %else %_ik /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %if %build_utils %post -n win4lin-utils %{update_menus} %endif %preun -n %{PKGNAME} %if %build_utils /sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION} /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION} %else %_uk /boot/win4lin-%{KERNVER}%{EXTRAVERSION} %endif %preun -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT} flavor="smp" %if %build_utils /sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %else %_uk /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %if %enterprise %preun -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT} flavor="enterprise" /sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %preun -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} flavor="-i686-up-4GB" %if %build_utils /sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %else %_uk /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %preun -n kernel-win4lin-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} flavor="-i586-up-1GB" %if %build_utils /sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %else %_uk /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %endif %postun -n %{PKGNAME} #depmod -a %{KERNVER}%{EXTRAVERSION} >/dev/null 2>&1 %puk %{KERNVER}%{EXTRAVERSION} %postun -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT} #depmod -a %{KERNVER}%{EXTRAVERSION}smp >/dev/null 2>&1 %puk %{KERNVER}%{EXTRAVERSION}smp %if %enterprise %postun -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT} #depmod -a %{KERNVER}%{EXTRAVERSION}enterprise >/dev/null 2>&1 %puk %{KERNVER}%{EXTRAVERSION}-enterprise %endif %postun -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} #depmod -a %{KERNVER}%{EXTRAVERSION}-i686-up-4GB >/dev/null 2>&1 %puk %{KERNVER}%{EXTRAVERSION}-i686-up-4GB %postun -n kernel-win4lin-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} #depmod -a %{KERNVER}%{EXTRAVERSION}-i586-up-1GB >/dev/null 2>&1 %puk %{KERNVER}%{EXTRAVERSION}-i586-up-1GB %if %build_utils %postun -n win4lin-utils %{clean_menus} %endif %files -n %{PKGNAME} %defattr(-,root,root) /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION} /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}/kernel/arch/*/mki-adapter /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}/misc/mki-adapter.ko %files -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT} %defattr(-,root,root) /boot/win4lin-%{KERNVER}%{EXTRAVERSION}smp /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}smp /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}smp/kernel/arch/*/mki-adapter /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}smp/misc/mki-adapter.ko %if %enterprise %files -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT} %defattr(-,root,root) /boot/win4lin-%{KERNVER}%{EXTRAVERSION}enterprise /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}enterprise /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}enterprise/kernel/arch/*/mki-adapter /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}enterprise/misc/mki-adapter.ko %endif %files -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT} %defattr(-,root,root) /boot/win4lin-%{KERNVER}%{EXTRAVERSION}-i686-up-4GB /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}-i686-up-4GB /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-i686-up-4GB/kernel/arch/*/mki-adapter /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-i686-up-4GB/misc/mki-adapter.ko %files -n kernel-win4lin-i586-up-1GB-%{KERNVER}.%{DISTRO_EXT} %defattr(-,root,root) /boot/win4lin-%{KERNVER}%{EXTRAVERSION}-i586-up-1GB /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}-i586-up-1GB /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-i586-up-1GB/kernel/arch/*/mki-adapter /%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-i586-up-1GB/misc/mki-adapter.ko %if %build_utils %files -n win4lin-utils %defattr(-,root,root) %attr(755,root,root) /sbin/installwin4linkernel %{_datadir}/win4lin-loader %{_menudir}/win4lin-utils %{_miconsdir}/win4lin.png %{_iconsdir}/win4lin.png %{_liconsdir}/win4lin.png %endif %changelog * Tue Sep 13 2005 Buchan Milne <bgmilne@mandriva.org> 3-10mdk - update for 2.6.12 * Wed Apr 20 2005 Buchan Milne <bgmilne@linux-mandrake.com> 3-9mdk - dont version the source package - drop utils subpackage (use bootloader-utils) - allow use of integrated (kernel+mki) patch - sync with new flavours * Thu Apr 01 2004 Buchan Milne <bgmilne@linux-mandrake.com> 3-8mdk - disable modversions (#9358) - update to mki-adapter 1.3.4, update kernel patch (for 2.6.3) * Thu Feb 19 2004 Buchan Milne <bgmilne@linux-mandrake.com> 3-7mdk - First 2.6 attempt. * Tue Oct 28 2003 Buchan Milne <bgmilne@linux-mandrake.com> 3-6mdk - Build for more flavours - Sync with bootloader-utils * Fri Sep 19 2003 Buchan Milne <bgmilne@linux-mandrake.com> 3-5mdk - Rebuild for new kernel * Sun Sep 16 2003 Buchan Milne <bgmilne@cae.co.za> 3-4mdk - Fix bad initrd message * Sun Jun 29 2003 Buchan Milne <bgmilne@cae.co.za> 3-3mdk - Really fix smp and enterprise kernels - Cleanups * Fri Jun 06 2003 Buchan Milne <bgmilne@cae.co.za> 3-2mdk - fix bootloader scripts (win4lin-utils package) - Preserve System.map between builds (try to make smp and enterprise boot ..) - Add menus for win4lin - Fix kernel-source version-detection (allows multiple kernel-source packages) * Thu May 08 2003 Buchan Milne <bgmilne@cae.co.za> 3-1mdk - First Mandrake package