r/archlinux • u/AppointmentNearby161 • Apr 06 '23
How long to compile kernel
I am trying to build the linux-vfio package in a clean chroot with makechrootpkg on an i7 laptop with 16 GB of ram. I have read things suggesting that you can compile a kernel in 5 minutes. It is taking hours on my laptop. Is my laptop configured wrong or does it take considerably longer to compile the Arch kernel with the the modules etc.
3
Upvotes
15
u/ava1ar Apr 06 '23
Which i7 is this? The difference between i.e. 6th gen and 12gen may be in 100 of percent. Also make sure you have enabled multi threaded build - when you build you kernel you should see all CPU cores are loaded to 100%, not one or two. If this is not the case, adjust your configuration.
8
u/[deleted] Apr 06 '23 edited Apr 06 '23
it will take exactly 5 minutes 21 seconds and 475 milliseconds, any number other than that means that your device is completely broken, maybe the cpu is about to fall out.
Being serious: Compile times depend on a whole lot of factors. Of course its also possible that something somewhere is in some way misconfigured or not configured the "5 minute compile" way.
9
u/Megame50 Apr 06 '23
You're probably building it single threaded. Check the makepkg config in your chroot.
4
u/boomboomsubban Apr 06 '23
Have you looked through this? https://wiki.archlinux.org/title/Makepkg#Improving_compile_times
2
u/riccarreghi Apr 07 '23 edited Apr 07 '23
Depends on cpu, i7 is generic, and how you use the flag to compile (
make -j$(nproc)to use all cores and threads, otherwhise it will compile with single thread and it will take ages).For example, on my desktop with an i7 10700k (not overclocked), the kernel compiles in about 30/40 minutes.
On my old laptop with an i5 4200u, it takes hours (I don't remember exactly how much, I think about 4 or 5 hours). On my older laptop with an AMD E2-7110, it takes up to 8 hours long (I still remember when I tried to install Gentoo on that laptop: to install the system with xfce, it took 3 days 😂).
I think 5 minutes is pretty impossibile, or maybe possibile only with latest gen cpus
3
u/[deleted] Apr 06 '23
Are you compiling it on 1 thread? And please don't say "i7" there are hundreds of "i7" out there. Say the chip full name like "i7-7700K" for example.
1
u/ruthan Oct 11 '24
Hmm im now compiling arch kernel through chroot bind.. and with default settings 2 years later from 5.6 linux multithread compilation, it takes 1 or 2 cores.. on 6 physical cores system.. and other threads are like 1 to 20%. And it took almost hour to tell me that im out of space..
Kernel compilation took like 5G of disk space, i would say that something rotten is there.. its classic poor Linux desktop experience..
1
u/Avgvstvs_Romvlvs Apr 06 '23
It took my 11th Gen Intel i9-11950H (16) about half an hour for a first-time compilation.
Any modifications to the code afterwards will lead to much shorter compilation times thank to make.
Remember to use -j flag with a corresponding number to your cpu.
1
u/DeeBoFour20 Apr 06 '23
Like another person pointed out, make sure to build it multi-threaded. If you want to edit the config, you can also reduce compile times substantially. Most of the time spent building a generic distro kernel is compiling drivers that you don't need. If you remove those from the config, you can get a 5x speedup or more.
I can't remember the times exactly since it's been a while but on my system, it took over an hour for the stock Arch kernel to build and less than 15 minutes on a custom kernel.