Recompile and repackage rhel 7 kernel

Latest response

Hi guys,
i'd like to for testing purposes turn on some modules that are swithched off in stock shipped kernel.
Is there some kind of RH guide for how to do that?

Thank you

Responses

Custom kernels are not officially supported but you can fairly easily do it by taking a look at the CentOSPlusKernel. For example, download this source rpm and examine the spec file. It will show you how to use your modified kernel config file and how to add new patches.

Thanks Akemi. I had a look.
What i'm trying to do is to build as slim as possible kernel for RHEL7 guests farm. I think it might be a good idea to get as small kernels as possible for those?
I think the RHEL7 kernel increased size compared to 6 and i'm trying to get guests as small and as fast as possibly can be done

what i do:
cd ~
rpmdev-setuptree
rpm -ivh kernel-bla-bla.src.rpm

cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec

cd ~/rpmbuild/BUILD/kernel-/linux-/

cp /boot/config-old.kernel.version .config

make oldconfig
make menuconfig (here i turn off unneeded modules)

cd ~/rpmbuild/SPECS
rpmbuild -bb --target=uname -m kernel.spec

but it still builds with not the customized options, i miss one midstep there .. how to tell the specfile to use the modified .confing file instead of whichever file it uses ..?

Could this be a problem?:
Source50: kernel-%{version}-x86_64.config
Should i copy .config (where my changes are saved) over there ?

Thanks!

Source50: kernel-%{version}-x86_64.config
Should i copy .config (where my changes are saved) over there ?

Exactly. That's what needs to be done. Copy your config to SOURCES as kernel-3.10.0-x86_64.config and add this line at the top:

# x86_64

Thanks!
you pointed me in the right direction :]. After saving my '.config' as you suggested + stating i want the x86_64 architecture at '.specfile' start, it all did what it supposed to.
I'm enjoying 'fat-reduced' kernel :].

Glad to hear all is working for you. :)