SPECS: kernel-CRI.spec (NEW) - spec to build kernel for CRI (http://cri.pld...

hawk hawk at pld-linux.org
Wed May 7 17:45:41 CEST 2008


Author: hawk                         Date: Wed May  7 15:45:41 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- spec to build kernel for CRI (http://cri.pld-linux.org)

---- Files affected:
SPECS:
   kernel-CRI.spec (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SPECS/kernel-CRI.spec
diff -u /dev/null SPECS/kernel-CRI.spec:1.1
--- /dev/null	Wed May  7 17:45:41 2008
+++ SPECS/kernel-CRI.spec	Wed May  7 17:45:35 2008
@@ -0,0 +1,508 @@
+# $Revision$, $Date$
+#
+# Conditional build:
+%bcond_without	source		# don't build kernel-source package
+%bcond_with	verbose		# verbose build (V=1)
+
+%define		alt_kernel	CRI
+
+%define		_basever	2.6.24
+%define		_postver	.7
+%define		_rel		1
+
+Summary:	The Linux kernel (the core of the Linux operating system)
+Name:		kernel-%{alt_kernel}
+Version:	%{_basever}%{_postver}
+Release:	%{_rel}
+Epoch:		3
+License:	GPL v2
+Group:		Base/Kernel
+Source0:	http://www.kernel.org/pub/linux/kernel/v2.6/linux-%{_basever}.tar.bz2
+# Source0-md5:	3f23ad4b69d0a552042d1ed0f4399857
+%if "%{_postver}" != "%{nil}"
+Source1:	http://www.kernel.org/pub/linux/kernel/v2.6/patch-%{_basever}%{_postver}.bz2
+# Source1-md5:	0c1c5d6d8cd82e18d62406d2f34d1d38
+%endif
+
+Source2:	kernel-CRI-module-build.pl
+Source3:	kernel-CRI-config.h
+
+Source20:	kernel-CRI-x86.config
+Source21:	kernel-CRI-x86_64.config
+
+Patch100:	kernel-CRI-proc-pci.patch
+Patch101:	kernel-CRI-lzma-vmlinuz.patch
+Patch102:	kernel-CRI-squashfs.patch
+
+URL:		http://www.kernel.org/
+BuildRequires:	binutils >= 3:2.14.90.0.7
+BuildRequires:	gcc >= 5:3.2
+BuildRequires:	module-init-tools
+BuildRequires:	net-tools
+BuildRequires:	p7lzma
+BuildRequires:	perl-base
+BuildRequires:	rpmbuild(macros) >= 1.217
+BuildRequires:	sed >= 4.0
+Autoreqprov:	no
+Requires:	coreutils
+Requires:	geninitrd >= 2.57
+Requires:	module-init-tools >= 0.9.9
+Provides:	%{name}-up = %{epoch}:%{version}-%{release}
+Provides:	kernel = %{epoch}:%{version}-%{release}
+Provides:	kernel(realtime-lsm) = 0.1.1
+Provides:	kernel-misc-fuse
+Provides:	kernel-net-hostap = 0.4.4
+Provides:	kernel-net-ieee80211
+Provides:	kernel-net-ipw2100 = 1.1.3
+Provides:	kernel-net-ipw2200 = 1.0.8
+Provides:	module-info
+Conflicts:	e2fsprogs < 1.29
+Conflicts:	isdn4k-utils < 3.1pre1
+Conflicts:	jfsutils < 1.1.3
+Conflicts:	module-init-tool < 0.9.10
+Conflicts:	nfs-utils < 1.0.5
+Conflicts:	oprofile < 0.9
+Conflicts:	ppp < 1:2.4.0
+Conflicts:	procps < 3.2.0
+Conflicts:	quota-tools < 3.09
+Conflicts:	reiserfsprogs < 3.6.3
+Conflicts:	udev < 1:071
+Conflicts:	util-linux < 2.10o
+Conflicts:	xfsprogs < 2.6.0
+ExclusiveArch:	%{ix86} %{x8664}
+ExclusiveOS:	Linux
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+# No ELF objects there to strip (skips processing 27k files)
+%define		_noautostrip	.*%{_kernelsrcdir}/.*
+
+%define		x86_target_base_arch	x86
+%define		initrd_dir	/boot
+
+# kernel release (used in filesystem and eventually in uname -r)
+# modules will be looked from /lib/modules/%{kernel_release}
+# _localversion is just that without version for "> localversion"
+%define		_localversion %{release}
+%define		kernel_release %{version}-%{alt_kernel}-%{_localversion}
+%define		_kernelsrcdir	/usr/src/linux-%{version}-%{alt_kernel}
+
+%define	CommonOpts	HOSTCC="%{__cc}" HOSTCFLAGS="-Wall -Wstrict-prototypes %{rpmcflags} -fomit-frame-pointer"
+%if "%{_target_base_arch}" != "%{_arch}"
+	%define	MakeOpts %{CommonOpts} ARCH=%{_target_base_arch} CROSS_COMPILE=%{_target_cpu}-pld-linux-
+	%define	DepMod /bin/true
+
+	%if "%{_arch}" == "x86_64" && "%{_target_base_arch}" == "i386"
+	%define	MakeOpts %{CommonOpts} CC="%{__cc}" ARCH=%{_target_base_arch}
+	%define	DepMod /sbin/depmod
+	%endif
+
+%else
+	%define MakeOpts %{CommonOpts} CC="%{__cc}"
+	%define	DepMod /sbin/depmod
+%endif
+
+%define __features Enabled features:\
+%define Features %(echo "%{__features}" | sed '/^$/d')
+
+%description
+This package contains the Linux kernel that is used to boot and run
+your system. It contains few device drivers for specific hardware.
+Most hardware is instead supported by modules loaded after booting.
+
+%package vmlinux
+Summary:	vmlinux - uncompressed kernel image
+Group:		Base/Kernel
+
+%description vmlinux
+vmlinux - uncompressed kernel image.
+
+%package headers
+Summary:	Header files for the Linux kernel
+Group:		Development/Building
+Provides:	kernel-headers = %{epoch}:%{version}-%{release}
+Provides:	kernel-headers(agpgart) = %{version}
+Provides:	kernel-headers(alsa-drivers)
+Provides:	kernel-headers(bridging) = %{version}
+Provides:	kernel-headers(reiserfs) = %{version}
+Autoreqprov:	no
+
+%description headers
+These are the C header files for the Linux kernel, which define
+structures and constants that are needed when rebuilding the kernel or
+building kernel modules.
+
+%package module-build
+Summary:	Development files for building kernel modules
+Group:		Development/Building
+Requires:	%{name}-headers = %{epoch}:%{version}-%{release}
+Provides:	kernel-module-build = %{epoch}:%{version}-%{release}
+Autoreqprov:	no
+
+%description module-build
+Development files from kernel source tree needed to build Linux kernel
+modules from external packages.
+
+%package source
+Summary:	Kernel source tree
+Group:		Development/Building
+Requires:	%{name}-module-build = %{epoch}:%{version}-%{release}
+Provides:	kernel-source = %{epoch}:%{version}-%{release}
+Autoreqprov:	no
+
+%description source
+This is the source code for the Linux kernel. You can build a custom
+kernel that is better tuned to your particular hardware.
+
+%prep
+%setup -q -n linux-%{_basever}
+
+%if "%{_postver}" != "%{nil}"
+%{__bzip2} -dc %{SOURCE1} | %{__patch} -p1 -s
+%endif
+
+%patch100 -p1
+%patch101 -p1
+%patch102 -p1
+
+# Fix EXTRAVERSION in main Makefile
+sed -i 's#EXTRAVERSION =.*#EXTRAVERSION = %{_postver}-%{alt_kernel}#g' Makefile
+
+sed -i -e '/select INPUT/d' net/bluetooth/hidp/Kconfig
+
+# remove unwanted files after patching (if any)
+find . '(' -name '*~' -o -name '*.orig' -o -name '.gitignore' ')' -print0 | xargs -0 -r -l512 rm -f
+
+%build
+TuneUpConfigForIX86 () {
+%ifarch %{ix86}
+	%ifnarch i386
+	sed -i 's:CONFIG_M386=y:# CONFIG_M386 is not set:' $1
+	%endif
+	%ifarch i486
+	sed -i 's:# CONFIG_M486 is not set:CONFIG_M486=y:' $1
+	%endif
+	%ifarch i586
+	sed -i 's:# CONFIG_M586 is not set:CONFIG_M586=y:' $1
+	%endif
+	%ifarch i686
+	sed -i 's:# CONFIG_M686 is not set:CONFIG_M686=y:' $1
+	%endif
+	%ifarch pentium3
+	sed -i 's:# CONFIG_MPENTIUMIII is not set:CONFIG_MPENTIUMIII=y:' $1
+	%endif
+	%ifarch pentium4
+	sed -i 's:# CONFIG_MPENTIUM4 is not set:CONFIG_MPENTIUM4=y:' $1
+	%endif
+	%ifarch athlon
+	sed -i 's:# CONFIG_MK7 is not set:CONFIG_MK7=y:' $1
+	%endif
+	%ifarch i686 athlon pentium3 pentium4
+	sed -i 's:CONFIG_MATH_EMULATION=y:# CONFIG_MATH_EMULATION is not set:' $1
+	%endif
+	return 0
+%endif
+}
+
+rm -f .config
+BuildConfig() {
+%ifarch %{ix86}
+	Config="%{x86_target_base_arch}"
+%else
+	Config="%{_target_base_arch}"
+%endif
+	KernelVer=%{kernel_release}
+
+	echo "Building config file [using $Config.conf] for KERNEL ..."
+
+	echo "" > .config
+	cat $RPM_SOURCE_DIR/kernel-CRI-$Config.config >> .config
+	sed -i "/CONFIG_LOCALVERSION=.*/d" .config
+	echo "CONFIG_LOCALVERSION=\"-%{_localversion}\"" >> .config
+
+	TuneUpConfigForIX86 .config
+
+	install .config arch/%{x86_target_base_arch}/defconfig
+	install -d $KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/linux
+	rm -f include/linux/autoconf.h
+	%{__make} %{MakeOpts} include/linux/autoconf.h
+	install include/linux/autoconf.h \
+		$KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/linux/autoconf-dist.h
+	install .config \
+		$KERNEL_INSTALL_DIR%{_kernelsrcdir}/config-dist
+	install .config arch/%{x86_target_base_arch}/defconfig
+}
+
+BuildKernel() {
+	echo "Building kernel ..."
+	%{__make} %{MakeOpts} mrproper \
+		RCS_FIND_IGNORE='-name build-done -prune -o'
+	install arch/%{x86_target_base_arch}/defconfig .config
+
+	%{__make} %{MakeOpts} clean \
+		RCS_FIND_IGNORE='-name build-done -prune -o'
+
+	%{__make} %{MakeOpts} include/linux/version.h \
+		%{?with_verbose:V=1}
+
+	%{__make} %{MakeOpts} \
+		%{?with_verbose:V=1}
+}
+
+PreInstallKernel() {
+%ifarch %{ix86}
+	Config="%{x86_target_base_arch}"
+%else
+	Config="%{_target_base_arch}"
+%endif
+	KernelVer=%{kernel_release}
+
+	mkdir -p $KERNEL_INSTALL_DIR/boot
+	install System.map $KERNEL_INSTALL_DIR/boot/System.map-$KernelVer
+%ifarch %{ix86} %{x8664}
+	install arch/x86/boot/bzImage $KERNEL_INSTALL_DIR/boot/vmlinuz-$KernelVer
+%endif
+
+	install vmlinux $KERNEL_INSTALL_DIR/boot/vmlinux-$KernelVer
+
+	%{__make} %{MakeOpts} modules_install \
+		%{?with_verbose:V=1} \
+		DEPMOD=%{DepMod} \
+		INSTALL_MOD_PATH=$KERNEL_INSTALL_DIR \
+		KERNELRELEASE=$KernelVer
+
+	install Module.symvers \
+		$KERNEL_INSTALL_DIR%{_kernelsrcdir}/Module.symvers-dist
+
+	echo "CHECKING DEPENDENCIES FOR KERNEL MODULES"
+	%if "%{_target_base_arch}" != "%{_arch}"
+		touch $KERNEL_INSTALL_DIR/lib/modules/$KernelVer/modules.dep
+	%else
+		/sbin/depmod --basedir $KERNEL_INSTALL_DIR -ae \
+			-F $KERNEL_INSTALL_DIR/boot/System.map-$KernelVer -r $KernelVer \
+			|| echo
+	%endif
+	echo "KERNEL RELEASE $KernelVer DONE"
+}
+
+KERNEL_BUILD_DIR=`pwd`
+
+KERNEL_INSTALL_DIR="$KERNEL_BUILD_DIR/build-done/kernel"
+rm -rf $KERNEL_INSTALL_DIR
+BuildConfig
+BuildKernel
+PreInstallKernel
+
+%install
+rm -rf $RPM_BUILD_ROOT
+umask 022
+export DEPMOD=%{DepMod}
+
+install -d $RPM_BUILD_ROOT%{_kernelsrcdir}
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{kernel_release}
+
+# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
+if cp -al COPYING $RPM_BUILD_ROOT/COPYING 2>/dev/null; then
+	l=l
+	rm -f $RPM_BUILD_ROOT/COPYING
+fi
+
+KERNEL_BUILD_DIR=`pwd`
+
+cp -a$l $KERNEL_BUILD_DIR/build-done/kernel/* $RPM_BUILD_ROOT
+
+if [ -e  $RPM_BUILD_ROOT/lib/modules/%{kernel_release}$i ] ; then
+	rm -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}$i/build
+	ln -sf %{_kernelsrcdir} \
+		$RPM_BUILD_ROOT/lib/modules/%{kernel_release}$i/build
+	install -d $RPM_BUILD_ROOT/lib/modules/%{kernel_release}$i/{cluster,misc}
+fi
+
+find . -maxdepth 1 ! -name "build-done" ! -name "." -exec cp -a$l "{}" "$RPM_BUILD_ROOT%{_kernelsrcdir}/" ";"
+
+cd $RPM_BUILD_ROOT%{_kernelsrcdir}
+
+%{__make} %{MakeOpts} mrproper archclean \
+	RCS_FIND_IGNORE='-name build-done -prune -o'
+
+find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
+
+if [ -e $KERNEL_BUILD_DIR/build-done/kernel-UP%{_kernelsrcdir}/include/linux/autoconf-dist.h ]; then
+install $KERNEL_BUILD_DIR/build-done/kernel-UP%{_kernelsrcdir}/include/linux/autoconf-dist.h \
+	$RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux
+install	$KERNEL_BUILD_DIR/build-done/kernel-UP%{_kernelsrcdir}/config-dist \
+	$RPM_BUILD_ROOT%{_kernelsrcdir}
+fi
+
+install $KERNEL_BUILD_DIR/build-done/kernel%{_kernelsrcdir}/include/linux/* \
+	$RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux
+
+install $KERNEL_BUILD_DIR/build-done/kernel%{_kernelsrcdir}/config-dist \
+	.config
+
+%{__make} %{MakeOpts} include/linux/version.h include/linux/utsrelease.h
+mv include/linux/version.h{,.save}
+mv include/linux/utsrelease.h{,.save}
+%{__make} %{MakeOpts} mrproper
+mv include/linux/version.h{.save,}
+mv include/linux/utsrelease.h{.save,}
+#install %{SOURCE3} $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux/autoconf.h
+install %{SOURCE3} $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux/config.h
+
+# collect module-build files and directories
+%{__perl} %{SOURCE2} %{_kernelsrcdir} $KERNEL_BUILD_DIR
+
+# ghosted initrd
+touch $RPM_BUILD_ROOT/boot/initrd-%{kernel_release}.gz
+
+# we don't need documentation
+rm -rf $RPM_BUILD_ROOT/%{_kernelsrcdir}/Documentation
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%preun
+rm -f /lib/modules/%{kernel_release}/modules.*
+if [ -x /sbin/new-kernel-pkg ]; then
+	/sbin/new-kernel-pkg --remove %{kernel_release}
+fi
+
+%post
+mv -f /boot/vmlinuz-%{alt_kernel} /boot/vmlinuz-%{alt_kernel}.old 2> /dev/null > /dev/null
+ln -sf vmlinuz-%{kernel_release} /boot/vmlinuz-%{alt_kernel}
+mv -f /boot/System.map-%{alt_kernel} /boot/System.map-%{alt_kernel}.old 2> /dev/null > /dev/null
+ln -sf System.map-%{kernel_release} /boot/System.map-%{alt_kernel}
+
+%depmod %{kernel_release}
+
+/sbin/geninitrd -f --initrdfs=rom %{initrd_dir}/initrd-%{kernel_release}.gz %{kernel_release}
+mv -f %{initrd_dir}/initrd-%{alt_kernel} %{initrd_dir}/initrd-%{alt_kernel}.old 2> /dev/null > /dev/null
+ln -sf initrd-%{kernel_release}.gz %{initrd_dir}/initrd-%{alt_kernel}
+
+if [ -x /sbin/new-kernel-pkg ]; then
+	if [ -f /etc/pld-release ]; then
+		title=$(sed 's/^[0-9.]\+ //' < /etc/pld-release)
+	else
+		title='PLD Linux'
+	fi
+
+	title="$title %{alt_kernel}"
+
+	/sbin/new-kernel-pkg --initrdfile=%{initrd_dir}/initrd-%{kernel_release}.gz --install %{kernel_release} --banner "$title"
+elif [ -x /sbin/rc-boot ]; then
+	/sbin/rc-boot 1>&2 || :
+fi
+
+%post vmlinux
+mv -f /boot/vmlinux-%{alt_kernel} /boot/vmlinux-%{alt_kernel}.old 2> /dev/null > /dev/null
+ln -sf vmlinux-%{kernel_release} /boot/vmlinux-%{alt_kernel}
+
+%post headers
+rm -f %{_prefix}/src/linux-%{alt_kernel}
+ln -snf %{basename:%{_kernelsrcdir}} %{_prefix}/src/linux-%{alt_kernel}
+
+%postun headers
+if [ "$1" = "0" ]; then
+	if [ -L %{_prefix}/src/linux-%{alt_kernel} ]; then
+		if [ "$(readlink %{_prefix}/src/linux-%{alt_kernel})" = "linux-%{version}-%{alt_kernel}" ]; then
+			rm -f %{_prefix}/src/linux-%{alt_kernel}
+		fi
+	fi
+fi
+
+%files
+%defattr(644,root,root,755)
+/boot/vmlinuz-%{kernel_release}
+/boot/System.map-%{kernel_release}
+%ghost /boot/initrd-%{kernel_release}.gz
+%dir /lib/modules/%{kernel_release}
+%dir /lib/modules/%{kernel_release}/kernel
+/lib/modules/%{kernel_release}/kernel/arch
+/lib/modules/%{kernel_release}/kernel/crypto
+/lib/modules/%{kernel_release}/kernel/drivers
+/lib/modules/%{kernel_release}/kernel/fs
+/lib/modules/%{kernel_release}/kernel/lib
+/lib/modules/%{kernel_release}/kernel/net
+/lib/modules/%{kernel_release}/kernel/sound
+%dir /lib/modules/%{kernel_release}/misc
+/lib/modules/%{kernel_release}/build
+%ghost /lib/modules/%{kernel_release}/modules.*
+%dir %{_sysconfdir}/modprobe.d/%{kernel_release}
+
+%files vmlinux
+%defattr(644,root,root,755)
+/boot/vmlinux-%{kernel_release}
+
+%files headers
+%defattr(644,root,root,755)
+%dir %{_kernelsrcdir}
+%{_kernelsrcdir}/include
+%{_kernelsrcdir}/config-dist
+%{_kernelsrcdir}/Module.symvers-dist
+
+%files module-build -f aux_files
+%defattr(644,root,root,755)
+%{_kernelsrcdir}/Kbuild
+%{_kernelsrcdir}/arch/*/kernel/asm-offsets.*
+%{_kernelsrcdir}/arch/*/kernel/sigframe.h
+%dir %{_kernelsrcdir}/scripts
+%dir %{_kernelsrcdir}/scripts/kconfig
+%{_kernelsrcdir}/scripts/Kbuild.include
+%{_kernelsrcdir}/scripts/Makefile*
+%{_kernelsrcdir}/scripts/basic
+%{_kernelsrcdir}/scripts/mkmakefile
+%{_kernelsrcdir}/scripts/mod
+%{_kernelsrcdir}/scripts/setlocalversion
+%{_kernelsrcdir}/scripts/*.c
+%{_kernelsrcdir}/scripts/*.sh
+%{_kernelsrcdir}/scripts/kconfig/*
+
+%if %{with source}
+%files source -f aux_files_exc
+%defattr(644,root,root,755)
+%{_kernelsrcdir}/arch/*/[!Mk]*
+%{_kernelsrcdir}/arch/*/kernel/[!M]*
+%exclude %{_kernelsrcdir}/arch/*/kernel/asm-offsets.*
+%exclude %{_kernelsrcdir}/arch/*/kernel/sigframe.h
+%{_kernelsrcdir}/block
+%{_kernelsrcdir}/crypto
+%{_kernelsrcdir}/drivers
+%{_kernelsrcdir}/fs
+%if %{with grsec_minimal}
+%{_kernelsrcdir}/grsecurity
+%endif
+%{_kernelsrcdir}/init
+%{_kernelsrcdir}/ipc
+%{_kernelsrcdir}/kernel
+%{_kernelsrcdir}/lib
+%{_kernelsrcdir}/mm
+%{_kernelsrcdir}/net
+%{_kernelsrcdir}/samples
+%{_kernelsrcdir}/scripts/*
+%exclude %{_kernelsrcdir}/scripts/Kbuild.include
+%exclude %{_kernelsrcdir}/scripts/Makefile*
+%exclude %{_kernelsrcdir}/scripts/basic
+%exclude %{_kernelsrcdir}/scripts/kconfig
+%exclude %{_kernelsrcdir}/scripts/mkmakefile
+%exclude %{_kernelsrcdir}/scripts/mod
+%exclude %{_kernelsrcdir}/scripts/setlocalversion
+%exclude %{_kernelsrcdir}/scripts/*.c
+%exclude %{_kernelsrcdir}/scripts/*.sh
+%{_kernelsrcdir}/sound
+%{_kernelsrcdir}/security
+%{_kernelsrcdir}/usr
+%{_kernelsrcdir}/COPYING
+%{_kernelsrcdir}/CREDITS
+%{_kernelsrcdir}/MAINTAINERS
+%{_kernelsrcdir}/README
+%{_kernelsrcdir}/REPORTING-BUGS
+%endif
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2008-05-07 15:45:35  hawk
+- spec to build kernel for CRI (http://cri.pld-linux.org)
+
================================================================


More information about the pld-cvs-commit mailing list