I want to build myself a custom kernel as a RPM. I use the .config
from the distribution I'm using, in this case, Centos, and end up with a kernel install size of 2.2Gb. I have deselected all the drivers/modules I don't need and updated the .config. When I make the kernel I see drivers being compiled that I deselected. What step am I missing to read the .config and not compile a large kernel? The kernel from the repos are a couple of Mb comparing to mine.
Download source
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.138.tar.xz
Extract source
tar -xf linux-5.4.138.tar.xz
Copy in existing config found from elrepo.
cp ~/config-5.4.138-x86_64 linux-5.4.138/.config
Run
make oldconfig
Configure with menuconfig and deselect drivers/modules not needed and save.
make menuconfig
Build RPM
make rpm-pkg -j4
Result is:
586.3 MiB [##########] kernel-5.4.138-1.x86_64.rpm
147.8 MiB [## ] kernel-devel-5.4.138-1.x86_64.rpm
1.3 MiB [ ] kernel-headers-5.4.138-1.x86_64.rpm
yum install:
kernel x86_64 5.4.138-1 /kernel-5.4.138-1.x86_64 2.2 G
Here is my .config if it can help https://pastebin.com/LBw6Gm1s