Can't compile Kernel

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
lcsavb
Posts: 1
Joined: 2024-08-21 18:27

Can't compile Kernel

#1 Post by lcsavb »

Hello everyone,

I'm attempting to compile a custom kernel on my Dell XPS 13 9370 running Debian, but I've hit a wall with an error that I can't seem to resolve.

I reviewed the build log and found the error occurs near the end, after the archiving (AR) process, but I couldn't identify the exact cause. The log ends with:

Code: Select all

make: *** [Makefile:2034: .] Erro 2
I made sure to install all build dependencies for the Linux kernel:

Code: Select all

sudo apt-get build-dep linux
sudo apt-get install build-essential binutils libncurses5-dev libelf-dev libssl-dev flex bison
Verified that ar, gcc, make, and other essential tools are installed and up-to-date.

Configured the Kernel:

I used make localmodconfig to generate an initial .config file.
I then manually edited the .config to further optimize it for my hardware (e.g., reducing CONFIG_NR_CPUS, disabling unnecessary drivers and modules).

Compiling the Kernel:

I attempted to compile the kernel using the following command:

Code: Select all

make -j$(nproc) bindeb-pkg
The compilation process fails with the following error:

Code: Select all

.
.
.
.
  CC      kernel/iomem.o
  CC      kernel/rseq.o
  UPD     kernel/config_data
  GZIP    kernel/config_data.gz
  CC [M]  kernel/configs.o
  AR      mm/built-in.a
  AR      kernel/built-in.a
make: *** [Makefile:2034: .] Erro 2
Troubleshooting Steps I've Taken:

Cleaned the Build Environment:

I ran make clean and even make mrproper to ensure there were no leftover files causing issues.
Re-ran make oldconfig to reconfigure the kernel after cleaning.

Ensured Sufficient Resources:
I confirmed there is enough disk space and memory available during the build process.

Tried Compiling Without Packaging:

I attempted to compile the kernel without creating Debian packages:

Code: Select all

make -j$(nproc)
The same error occurs.

System Information:
Laptop: Dell XPS 13 9370
OS: Debian 12 (Bookworm)
Kernel Version: Linux 6.1 (Custom Configuration)

I’ve exhausted my knowledge and troubleshooting steps. Could anyone provide guidance on how to resolve this error or further steps I should take to diagnose the problem? If more information or logs are needed, I’m happy to provide them.

Thanks in advance for your help!

User avatar
stevepusser
Posts: 12983
Joined: 2009-10-06 05:53
Has thanked: 42 times
Been thanked: 79 times

Re: Can't compile Kernel

#2 Post by stevepusser »

You need to search the output for "Error 1". Since your build is multithreaded, the threads that aren't dying continue on until they all finish, at which point you get "Error 2". So the actual build error is earlier; a lot earlier if you have a lot of cores.

You could use just one thread by just "make", which of course would take a while, but then the error would be right there at the tail end.

Which kernel version source are you using?

If you have read stuff about how a custom stripped-down kernel will perform much faster than the stodgy and sedate Debian one, you could be in for a letdown, though.
MX Linux packager and developer

lindi
Debian Developer
Debian Developer
Posts: 531
Joined: 2022-07-12 14:10
Has thanked: 2 times
Been thanked: 101 times

Re: Can't compile Kernel

#3 Post by lindi »

Also, you can simply use "rm" to remove unnecessary modules, no need to recompile.

Aki
Global Moderator
Global Moderator
Posts: 3698
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 100 times
Been thanked: 486 times

Re: Can't compile Kernel

#4 Post by Aki »

Hello @lcsavb,

Do you have any updates?

----
Moved to "Programming" sub-forum.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Post Reply