Score:-1

Installing a new kernel built from source takes too much time

cn flag

I have built Linux kernel from source with make and make modules_install. But I issue the install command:

$ sudo make -j8 V=1 install
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
echo >&2;                           \
echo >&2 "  ERROR: Kernel configuration is invalid.";       \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
echo >&2 ;                          \
/bin/false)
sh ./arch/x86/boot/install.sh 5.15.10 \
    arch/x86/boot/bzImage System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.15.10 /boot/vmlinuz-5.15.10
run-parts: executing /etc/kernel/postinst.d/dkms 5.15.10 /boot/vmlinuz-5.15.10
 * dkms: running auto installation service for kernel 5.15.10                                                      
Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area......
make KERNELRELEASE=5.15.10 all INCLUDEDIR=/lib/modules/5.15.10/build/include KVERSION=5.15.10 DKMS_BUILD=1
...

This command goes on for hours. What is really going?

terdon avatar
cn flag
@Nmath why would this be about Arch? The `./arch` there is the subdirectory of the kernel build tree. It is shorthand for "architecture" as in "x86 architecture", it isn't about Arch Linux.
andrew.46 avatar
in flag
You perhaps need a better processor? I run a 2nd gen threadripper and a recent kernel takes about 7 minutes: https://www.linuxquestions.org/questions/slackware-14/kernel-build-time-4175691322/page2.html#post6226386
Score:4
cn flag

From the output you show, it looks like your machine is recompiling all of the kernel modules you have, to work with the new kernel. That's what dkms (Dynamic Kernel Module Support) does. Since this is compilation, it is expected to take quite a long time.

As long as you keep seeing output there (there should be various compilation messages), there should be no problem and it will finish. Eventually.

sal_guy avatar
cn flag
The problem is that it cleans the build area, and therefore the whole kernel is again built by this service (`dkms`). On top of that, it does not parallelize the whole process and takes a lot of time. How to parallelize the build process? And is there anyway to not use this `installkernel` approach to deploy a new kernel? I just want to deploy the newly built kernel with a procedure to build all the kernel modules with the new kernel. `dkms` tries to automate the process, but it is very slow and unnecessarily cleans the build area.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.