I have core i5 with 8gb RAM. I have VMware workstation 10.0.1 installed on my machine. I have fedora 20 Desktop Edition installed on VMware as guest OS.
I am working on Linux kernel source code v 3.14.1. I am developing an I/O scheduler for Linux kernel. After any modifications in code every time it takes around 1 hour and 30 minutes for compiling and installing the whole kernel code to see the changes.
Compilation and Installation commands: make menuconfig, make, make modules, make modules_install, make install
So my question is it possible to reduce 1 hour and 30 minutes time into only 10 to 15 minutes?
The Linux kernel takes around 5 minutes (without modules) to build on an Intel Core i5 Jasper Lake mini PC with 16 GB RAM and a fast SSD based on our recent review of Beelink GTi 11 mini PC. Kernel developers may have to build for different targets and configurations, plus all modules so the build times may add up.
Compilation can often be parallelized. As for the hardware: Pick a SSD to store the OS and source files, this should reduce startup times (the time that is needed to read the sources into the filesystem cache). Pick at least 8 GB RAM, 16 GB or more is recommended.
make -jn: The easier way to speed-up Linux kernel compilation is executing make with the option -j (jobs). This option specifies the number of parallel jobs that make will use to split the build process. Because the kernel Makefile have correct dependency information, one doesn’t have to use make’s default single process execution.
To use ccache to speedup Linux kernel compile, all I had to do was ‘yum install ccache’ on Fedora10 system. This automatically created all needed symlinks and PATH setting. After this do make O=build bzImage; make O=build modules as usual. First time you won’t notice any speed gain as ccache is simply building up its cache.
Based on OpenBenchmarking.org data, the selected test / test configuration ( Timed Linux Kernel Compilation 5.14 - Time To Compile) has an average run-time of 20 minutes.
EDIT: as it turns out I lived a very protected life so far. kernel compilation usually takes between 1-2 hour - exactly what you see. BUT: there is still things you can do, and they are all listed here
Do not do make menuconfig for every change you make to the sources, because it will trigger a full compilation of everything, no matter how trivial your change is. This is only needed when the configuration option of the kernel changes, and that should sheldom happen during your development.
Just do:
make or if you prefer the parallel compilation:
make -j4 or whatever number of concurrent tasks you fancy.
Then the make install, etc. may be needed for deploying the recently built binaries, of course.
Another trick is to configure the kernel to the minimum needed for your tests. I've found that for many tasks a UML compilation (User Mode Linux) is the fastest. You may also find useful make localmodconfig instead of make menuconfig to start with.
make parallel build with -j optioni.e. for eg instead of running:
make run:
make ARCH=<your architecture> -jN where N is the no of cores on your machine (cat /proc/cpuinfo lists the no of cores). For eg, for i386 target and host machine with 4 cores (output of cat /proc/cpuinfo):
make ARCH=i386 -j4 Similarly you can run the other make targets (modules, modules_install, install) with -jN flag.
Note: make does a check of the files modified and compiles only those files which have been modified so only the initial build should take time, subsequent builds will be faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With