On Wed, 18 Mar 2015 18:19:54 +0100 Heinz Diehl htd+ml@fritha.org wrote:
- Download a kernel tarball from kernel.org
- Unpack it into /usr/src
- Copy .config from the latest Fedora kernel into the kernel toplevel sourcedir (it is stored in /boot).
- "make oldconfig"
- "make"
- "make modules_install"
- "make install"
- Reboot
Thanks.
Step 3. is for convenience, you can of course use your own .config.
Yeah, I usually do a make menuconfig after make oldconfig.
This kernel will live peacefully alongside of your Fedora kernels.
That's good. How do you remove the old kernels so that they don't pile up indefinitely? Manually? Or does this automatically replace the last version that was compiled and installed this way? That is, does it use a generic install directory, or one that is stamped with kernel version?
Here's my Fedora rpmbuild procedure:
I go to koji, the fedora central build repository for package maintainers, and download the src.rpm.
http://koji.fedoraproject.org/koji/packageinfo?packageID=8
I use rpm to install it into the ~/rpmbuild heirarchy as a user. rpm -ivh kernel-4.0.0-0.rc3.git1.1.fc22.src.rpm This requires that the rpm-build package be installed.
I then go to ~/rpmbuild/SPECS to unpack and patch it. rpmbuild -bp kernel.spec
This puts the unpacked, patched source in, for example, ~/rpmbuild/BUILD/kernel-4.0-rc3.fc21/linux-4.0.0-0.rc3.git2.1.20150315.fc21.x86_64
The vanilla kernel is there as, for example, ~/rpmbuild/BUILD/kernel-4.0-rc3.fc21/vanilla-4.0-rc3-git2 but I'm not using that.
In the ~/rpmbuild/BUILD/kernel-4.0-rc3.fc21/linux-4.0.0-0.rc3.git2.1.20150315.fc21.x86_64 directory, I cp from /boot the config file for the last kernel I built into .config.
I then run make oldconfig to set the new kernel to that previous config.
I then run make menuconfig to do any tweaks or changes I want to the new kernel. I try to remove modules and options I don't need on my system to speed up compilation. I then save that as a new .config.
I edit the new .config, and put # x86_64 as the first line, so the rpmbuild program can find it, and move that to ~/rpmbuild/SOURCES/config-x86_64-generic
I move to ~/rpmbuild/SPECS and edit kernel.spec to add the date to the kernel name. %define buildid .20150315
I then run the rpm build process as rpmbuild -bb --without debug --target=`uname -m` kernel.spec > build_output 2> error_output
This eventually produces the kernel rpms in ~/rpmbuild/RPMS/x86_64 which I then install using yum -C from within that directory.
I do all this in a virtual console, within screen, which has windows for each of the places I need to go. All except the install step are run as user.