Centos 8.2: Change kernel configuration

Issues related to applications and software problems and general support
Post Reply
zvivered
Posts: 17
Joined: 2019/09/23 17:23:00

Centos 8.2: Change kernel configuration

Post by zvivered » 2021/07/15 21:12:22

Hello,

In order to change the default kernel configuration I ran the following procedure according to the wiki.

I had to do minor changes (e.g yum install required for the rpmbuild to unpack).
[root] yum groupinstall "Development Tools"
[root] yum install ncurses-devel qt5-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel

mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
rpm -i https://vault.centos.org/8.2.2004/BaseO ... l8.src.rpm

unpack and prepare the source files
------------------------------------
cd ~/rpmbuild/SPECS

[root] yum install audit-libs-devel dwarves elfutils-devel java-devel kabi-dw libbpf-devel libcap-devel libcap-ng-devel llvm-toolset newt-devel numactl-devel openssl-devel pciutils-devel perl perl-devel python3-devel python3-docutils xmlto xz-devel

rpmbuild -bp --target=$(uname -m) kernel.spec

.config modification
------------------------------------
cd ~/rpmbuild/BUILD/kernel-*/linux-*/
make mrproper
cp /boot/config-`uname -r` .config

make menuconfig (+modify configuration)

Add, as the first line of the .config file, either:
# x86_64

cp .config configs/kernel-4.18.0-`uname -m`.config
cp -av configs/* ~/rpmbuild/SOURCES/

cd ~/rpmbuild/SPECS/
cp kernel.spec kernel.spec.distro
vi kernel.spec

Add : %define buildid .cma
right after the line:
# define buildid .local

rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log

cd /home/zvivered/rpmbuild/RPMS/`uname -m`/
[root] dnf install kernel-*.rpm --allowerasing
But after installing the new kernel, nothing was changed in the kernel configuration.
I only got a new line in the grub and the date of the kernel (/proc/version) was changed.

Can you please tell what did I do wrong ?

Thank you in advance,
Zvika

zvivered
Posts: 17
Joined: 2019/09/23 17:23:00

Re: Centos 8.2: Change kernel configuration

Post by zvivered » 2021/07/17 19:37:56

Hello,

Thanks to the help I got in www.linuxquestions.org, the procudure to customize kernel configuration in 8.2 now works.

The procedure in the wiki needs few changes for 8.2:
[root] yum groupinstall "Development Tools"
[root] yum install ncurses-devel qt5-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel

mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
rpm -i https://vault.centos.org/8.2.2004/BaseO ... l8.src.rpm

unpack and prepare the source files
------------------------------------
cd ~/rpmbuild/SPECS

[root] yum install audit-libs-devel dwarves elfutils-devel java-devel kabi-dw libbpf-devel libcap-devel libcap-ng-devel llvm-toolset newt-devel numactl-devel openssl-devel pciutils-devel perl perl-devel python3-devel python3-docutils xmlto xz-devel

rpmbuild -bp --target=$(uname -m) kernel.spec

.config modification
------------------------------------
cd ~/rpmbuild/BUILD/kernel-*/linux-*/
make mrproper
cp ./configs/kernel-4.18.0-`uname -m`.config .config

make menuconfig (+modify configuration)

Add, as the first line of the .config file, either:
# x86_64

cp .config configs/kernel-4.18.0-`uname -m`.config
cp .config ~/rpmbuild/SOURCES/kernel-`uname -m`.config

cd ~/rpmbuild/SPECS/
cp kernel.spec kernel.spec.distro
vi kernel.spec

Add : %define buildid .cma
right after the line:
# define buildid .local

rpmbuild -bb --target=`uname -m` kernel.spec --without kabichk --without debug --without debuginfo 2> build-err.log | tee build-out.log

cd ~/rpmbuild/RPMS/`uname -m`/
[root] dnf install kernel-*.rpm --allowerasing

Post Reply