Self-build the linux kernel with clang. The method is written before It is almost the same as building with gcc. clang uses the one that was installed in the previous post.
Keep it in your PATH so that you can use the clang command.
% export PATH=(somewhere)/bin:$PATH
Get the source, deploy and patch it.
% wget https://kojipkgs.fedoraproject.org//packages/kernel/5.4.16/200.fc31/src/kernel-5.4.16-200
.fc31.src.rpm
% mkdir files
% cd files
% rpm2cpio ../kernel-5.4.16-200.fc31.src.rpm |cpio -id
% tar Jxf linux-5.4.tar.xz
% cd linux-5.4
% xz -dc ../patch-5.4.16.xz | patch -p1
% for i in `ls ../*patch`;do;patch -p1 < $i;done
Get the .config template and make oldconfig.
% cp ../kernel-x86_64-fedora.config .config
% yes "" | make CC=clang oldconfig
Now, run menuconfig and then build. Uncheck "Kernel hacking-> Compile-time checks and compiler options-> Generate BTF type info".
% make CC=clang menuconfig
% make -j12 CC=clang deb-pkg LOCALVERSION=-my KDEB_PKGVERSION=1
% cd ..
% su
# dpkg -i linux-image-5.4.16-my_1_amd64.deb linux-headers-5.4.16-my_1_amd64.deb
After rebooting and booting with the new kernel, you will see the following wording in /var/log/kern.log:
Feb 1 19:08:49 localpc kernel: [ 0.000000] Linux version 5.4.16-my (tekito2@my-desktop3) (clang version 9.0.0 (tags/RELEASE_900/final)) #1 SMP Sat Feb 1 18:20:36 JST 2020
Recommended Posts