Re: Problems with building a complete kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Mark Hull-Richter wrote:
I have a plain vanilla Centos source (not 100% sure where we got it
from), but I can't seem to get a build that installs correctly.

I tried the method described at
http://wiki.centos.org/HowTos/Custom_Kernel, but rpm doesn't like the
output file, and even if I install it with -F, nothing seems to happen -
no new kernel, now initrd, nothing.

My 30-second glance at it suggests it's not very good; the prep stage is quite wrong. For example, kernel-devel is a part of the output of the build process. You cannot install it before you have built your kernel.

I suggest you start with the src.rpm.
rpm -i ...
rpmbuild -bp ... <wherevr the spec went>
Install whatever is says you need:-)

Here is a script that works for _at least some_ RHEL4 & FC3 kernels. I suggest you read it, understand it and adapt it to what you want. Then, maybe fix that wiki.
#!/bin/bash
set -xe
rpmbuild=rpmbuild\ --define\ "_topdir${HOME}/redhat"
rpm=rpm\ --define\ "_topdir${HOME}/redhat"
if [ -n "$1" ] ; then
	K=$1
else
K=$(dir -d1rt ~/Fedora/kernel*src.rpm ~/RH/FC3/updates/SRPMS/kernel*src.rpm | tail -1)
fi
DirName=$(rpm -qp --qf '%{name}-%{version}\n' ${K})
${rpm} -i ${K}
date=$(date "+%a %b %d %Y")
sed -r <redhat/SPECS/kernel-2.6.spec >redhat/SPECS/kernel-2.6-dl.spec \
	-e 's=FC\>=dl=g'		\
	-e 's=FC2\>=dl2=g'	\
	-e 's=FC3\>=dl3=g'	\
	-e 's=%define builddoc 0=%define builddoc 1=' \
-e "s=%changelog=%changelog\n* ${date} John Summerfield <summer@xxxxxxxxxxxxxxxxxxxxxx>\n- autobuild for dl %{release}\n="
:
:
:
:
diff -u redhat/SPECS/kernel-2.6.spec redhat/SPECS/kernel-2.6-dl.spec || :
${rpmbuild} -bp --target i686 redhat/SPECS/kernel-2.6-dl.spec

echo Fixing configs
(
	set -x
	cd $(find ~/redhat -type d -name ${DirName})/lin*
	ls -la
	for f in configs/*.config
		do :
			make -s mrproper
			sed <   $f >.config \
-e 's+# CONFIG_NTFS_FS is not set+CONFIG_NTFS_FS=m\nCONFIG_NTFS_DEBUG=n\nCONFIG_NTFS_RW=y+'

			grep -q 'CONFIG_NTFS_FS is not set' .config && exit
			grep -4 NTFS .config
#			make -s oldconfig
			cp -bvp .config ~/redhat/SOURCES/$(basename $f)
			head -9 $f .config ~/redhat/SOURCES/$(basename $f)
			mv -b .config $f
		done
	)

echo Fixed configs

BO="-ba"
for arch in i686
	do :
${rpmbuild} ${BO} --clean --target ${arch} redhat/SPECS/kernel-2.6-dl.spec
		 BO="-bb --rmsource"
	done

In my case, I'm building a brace of kernels with NTFS support. the resultant kernals install on nahant/FC3 just fine.







--

Cheers
John

-- spambait
1aaaaaaa@xxxxxxxxxxxxxxxx  Z1aaaaaaa@xxxxxxxxxxxxxxxx

Please do not reply off-list
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux