Computing resources required for kernel development

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Sun May 31 04:16:33 EDT 2020


On Sat, 30 May 2020 20:56:21 +0530, Harsh chopra said:

> I have been following the Kernel Hacking steps to submit my first patch but
> I am facing problem in the kernel compilation as its taking more than a day
> may be due to low computing resources..

On a Raspberry Pi 4 with 4G of RAM, overclocked to 2Ghz, and using a 256G USB3
SSD as the system disk instead of an SD card, a 'make allmodconfig' has to
build 28,302 .o files and from a tree that had a 'make clean', a 'make' takes:

real	585m58.387s
user	537m15.917s
sys	65m59.296s

Note that the RPi4 has 4 cores, so a 'make -j4' will go even faster, but you
will need a case that provides cooling for the CPU/GPU, especially if
overclocked. (And just a few days ago, the RPi crew dropped a new firmware that
allows booting straight from a USB device, so no SD card is needed at all)

Meanwhile, a config for my laptop that's been somewhat minimized by
using 'make localmodconfig' only has to build 4,996 .o files (and I could probably
trim that back a whole bunch), which makes kernel builds about 8 times faster than
an 'allmodconfig' :)

How to:
Step 1 - boot a current kernel.
Step 2 - plug in any and all USB disks, cameras, keyboards/mice and anything
else that you might have, so their drivers get loaded. Make sure that you get
everything, because if you miss something, the device won't work because there
won't be a driver.
Step 3 - cd to wherever you're doing your kernel builds
Step 4 - 'make localmodconfig'
Step 5 - make and install your new kernel config.

Note that if you're doing patches for code in modules you don't have loaded, you
may need to go do 'make menuconfig' to enable building the the module. 

> I have Ubuntu 20.04 LTS with 4GB  DDR3 ram 1 TB HDD, Intel i3  2.GHZ and 4
> cores but I have been using virt-manager for the kernel development with
> CentOS 8.1 (minimal req.) and  resources 70 GB storage, 2 GB ram and 2
> cores.

That's not that much different from the RPi I mentioned above except for the
HDD rather than an SSD.  Note that even a smaller SSD for just your kernel
source will get you most of the bang for your buck, because gcc, the most
heavily used *.h files, and other stuff like that should remain in memory so
after the first few modules are compiled, pretty much all your disk I/O is for
*.c files from the source tree.   And although USB3 is preferable, you'll get
a speedup even if you only have USB2 ports available.

> Thus if anyone could suggest how much computing power to have or any other
> method so that I could make my development process smooth.

Work smarter, not harder.

The two biggest things you can do to speed things up are getting an SSD for
your system disk, and 'localmodconfig' to minimize the amount of extraneous
stuff you have to build.  The SSD may be more money than you're willing
to spend, but the other suggestion is essentially free.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200531/a4bba0ad/attachment.sig>


More information about the Kernelnewbies mailing list