Cannot compile kernel

Attempting to compile kernel, but bumping into error.

[root@rocky8 build]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.9 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.9"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.9 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2029-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.9"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.9"
uname -r
4.18.0-513.11.1.el8_9.x86_64

source dir:
/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/

Steps:

  1. All necessary dev and kernel-devel utils and source files are installed
  2. Copied config-$(uname -r) from /boot to /usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64 and saved as .config
  3. Ran make oldconfig
  4. Ran make manuconfig → saved changes
  5. Ran make

Shortly afterwords I get the following error:

[root@rocky8 4.18.0-513.11.1.el8_9.x86_64]# make
  DESCEND objtool
/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Makefile.build:37: /usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Build.i
make[4]: *** No rule to make target '/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Build.include'.  Stop.
make[3]: *** [Makefile:47: /usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/objtool/fixdep-in.o] Error 2
make[2]: *** [/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Makefile.include:4: fixdep] Error 2
make[1]: *** [Makefile:65: objtool] Error 2
make: *** [Makefile:1782: tools/objtool] Error 2

There is no Build.include file under tools/build/ directory.

[root@rocky8 4.18.0-513.11.1.el8_9.x86_64]# cd tools/build/
[root@rocky8 build]# ll
total 24
drwxr-xr-x. 2 root root   22 Jan 26 08:56 feature
-rw-r--r--. 1 root root 1286 Jan 10 15:09 Makefile
-rw-r--r--. 1 root root 3987 Jan 10 15:09 Makefile.build
-rw-r--r--. 1 root root 8621 Jan 10 15:09 Makefile.feature
-rw-r--r--. 1 root root  217 Jan 10 15:09 Makefile.include
drwxr-xr-x. 3 root root   16 Jan 26 08:56 tests

Is this a bug or am i supposed to generate it? It’s not clear if the additional errors are the problem or the file missing is the problem.

I’m at a loss on how to fix this, any advice would be appreciated.

You’ll need a lot more than just the kernel-devel package. The devel package typically only provides enough to compile a module against that kernel. This means you’ll need the source kernel package that was used to build the current kernel.

Is there a reason why you’re trying to compile your own kernel? This isn’t recommended nor supported.

I’ve downloaded everything various online instructions have said to download and install.

Typically I (we) rebuild kernels to enable or disable features. I’m not sure why you said its not recommended, its common practice.

In my case I’m enabling NTFS r/w filesystem support.

I’m open to any suggestions on what steps you may have to address the compiling error?

It is not recommended because we (the community and maintainers) cannot support it. The wiki link specifies the reasons why it’s not supported.

Are ntfs-3g and ntfsprogs from the epel repository insufficient? You can easily install them after enabling the epel repository and they provide read/write support.

I’m not sure what you’ve read for compiling kernels, but the kernel-devel package is not enough. If you insist on building your own kernel, it would be better to recompile the source RPM. See below.

% dnf download kernel --source
% sudo dnf install epel-release rpm-build -y
% sudo crb enable
% sudo dnf install mock -y
% sudo usermod -aG mock label
# run newgrp or log out and back in
% newgrp
% rpm -i kernel-4.18.0-513.11.1.el8_9.src.rpm
% vi rpmbuild/SOURCES/kernel-x86_64.config
# make your changes as you see fit
% rpmbuild -bs rpmbuild/SPECS/kernel.spec --define 'dist .el8_9.custom'
Wrote: /home/label/rpmbuild/SRPMS/kernel-4.18.0-513.11.1.el8_9.custom.src.rpm
% mock -r rocky-8-x86_64 \
  --define 'dist .el8_9.custom' \
  --enablerepo=devel \
  /home/label/rpmbuild/SRPMS/kernel-4.18.0-513.11.1.el8_9.custom.src.rpm

. . .

Wrote: /builddir/build/RPMS/kernel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-headers-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-cross-headers-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debuginfo-common-x86_64-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/perf-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/perf-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/python3-perf-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/python3-perf-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-libs-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-libs-devel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/bpftool-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/bpftool-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-selftests-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-core-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-devel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-modules-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-modules-extra-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-modules-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-core-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-devel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-modules-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-modules-extra-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-modules-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-ipaclones-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm

Thanks. I’ll try that tonight and post back my results for others who might be interested.

This process sucked, using up all remaining hard drive space on a 40G partition. Ultimately, failing completely due to lack of disk space.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.