tcrop
2007-02-03, 05:40 AM CST
Many have attempted to build an i686 kernel only to end up with a i386 kernel instead. The following steps will allow you to build the i686 kernel without jumping through a lot of hoops.
We will build a 2.6.19 kernel, which is the most current version at this time [02-03-2007].
1. Download the kernel source rpm: wget ftp://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/updates/6/SRPMS/kernel-2.6.19-1.2895.fc6.src.rpm
2. Install source rpm. We will be compiling as root and using the rpm-build directory sturcture. You could of course build as a user by installing fedora-rpmdevtools, then as a user, running fedora-buildrpmtree to create the build directory structure under you home directory and then installing the source package:
rpm -ivh kernel-2.6.19-1.2895.fc6.src.rpm
3. Edit the kernel-2.6.spec file and make changes according to your needs. The following changes work for me.
I turn off Xen kernels because I don't use the feature. What are Xen kernels? "Xen is a paravirtualising virtual machine monitor (VMM), or `hypervisor', for the x86 processor architecture." It is a way to run multiple virtual machines on a single physical machines.
I also don't do kernel dumps.
If you need to build a kernel with the same name as the release then the last modification
will give you what you need. If you know of a better way to accomplish this then please let us know.
Change: %define buildxen 1
To: %define buildxen 0
Change: %define buildkdump 1
To: %define buildkdump 0
Change: perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -prep/" Makefile
To: perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -1.2895.fc6/" Makefile
4. Executes the "%prep" stage from the spec file. This involves unpacking the sources and applying any patches.:
rpmbuild -bp --target i686 /usr/src/redhat/SPECS/kernel-2.6.spec
5. Change to our BUILD directory so we can customize our kernel build.
cd /usr/src/redhat/BUILD/kernel-2.6.19/linux-2.6.19.i686/
6. Delete the current configuration, and all generated files. Were going to start clean here.
make mrproper
7. Copy the i686 config file to .config
cp /usr/src/redhat/SOURCES/kernel-2.6.19-i686.config .config
If you have a customized .conf from a previous build then copy it in to place instead of the above. Then run 'make oldconfig' to update any new functionality.
make oldconfig
8. If you need to customize the kernel do it now by running 'make menuconfig' or 'make xconfig'. make xconfig has options, under options menu, which allow you to see any hidden functionality that are may not be active due to parent features being turned off.
make xconfig
9. Begin compile:
make UTS_MACHINE=i686 rpm
You should then see "Building target platforms: i686" in the build console.
The above process will build a i686 RPM and a SRPM. It does not build initrd - you may need to do that with mkinitrd.
The below names may vary according to your kernel-2.6.spec modifications.
mkinitrd /boot/initrd-2.6.19-prep.img 2.6.19-prep
We will build a 2.6.19 kernel, which is the most current version at this time [02-03-2007].
1. Download the kernel source rpm: wget ftp://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/updates/6/SRPMS/kernel-2.6.19-1.2895.fc6.src.rpm
2. Install source rpm. We will be compiling as root and using the rpm-build directory sturcture. You could of course build as a user by installing fedora-rpmdevtools, then as a user, running fedora-buildrpmtree to create the build directory structure under you home directory and then installing the source package:
rpm -ivh kernel-2.6.19-1.2895.fc6.src.rpm
3. Edit the kernel-2.6.spec file and make changes according to your needs. The following changes work for me.
I turn off Xen kernels because I don't use the feature. What are Xen kernels? "Xen is a paravirtualising virtual machine monitor (VMM), or `hypervisor', for the x86 processor architecture." It is a way to run multiple virtual machines on a single physical machines.
I also don't do kernel dumps.
If you need to build a kernel with the same name as the release then the last modification
will give you what you need. If you know of a better way to accomplish this then please let us know.
Change: %define buildxen 1
To: %define buildxen 0
Change: %define buildkdump 1
To: %define buildkdump 0
Change: perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -prep/" Makefile
To: perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -1.2895.fc6/" Makefile
4. Executes the "%prep" stage from the spec file. This involves unpacking the sources and applying any patches.:
rpmbuild -bp --target i686 /usr/src/redhat/SPECS/kernel-2.6.spec
5. Change to our BUILD directory so we can customize our kernel build.
cd /usr/src/redhat/BUILD/kernel-2.6.19/linux-2.6.19.i686/
6. Delete the current configuration, and all generated files. Were going to start clean here.
make mrproper
7. Copy the i686 config file to .config
cp /usr/src/redhat/SOURCES/kernel-2.6.19-i686.config .config
If you have a customized .conf from a previous build then copy it in to place instead of the above. Then run 'make oldconfig' to update any new functionality.
make oldconfig
8. If you need to customize the kernel do it now by running 'make menuconfig' or 'make xconfig'. make xconfig has options, under options menu, which allow you to see any hidden functionality that are may not be active due to parent features being turned off.
make xconfig
9. Begin compile:
make UTS_MACHINE=i686 rpm
You should then see "Building target platforms: i686" in the build console.
The above process will build a i686 RPM and a SRPM. It does not build initrd - you may need to do that with mkinitrd.
The below names may vary according to your kernel-2.6.spec modifications.
mkinitrd /boot/initrd-2.6.19-prep.img 2.6.19-prep