Compiling Linux Kernel is a boring job. It takes really long period of time. In my laptop, it took more than an hour.
Fortunately, there’s option you can make it faster. Actually, it’s not Kernel’s option. It is provided by ‘make’ command.
To speed up the compile, you can create more than one thread for commands in make with ‘-jX’ option. You can specify how many threads you want to launch after -j with the thread count.
For example, in my laptop, it has two cores. Look at the following command with -j option and without it.
$ time make -j4 real 41m5.329s user 56m39.896s sys 13m5.226s $ time make real 75m7.275s user 55m49.704s sys 12m56.468s
Before each test, I flushed out cache with the following command:
echo 3 > /proc/sys/vm/drop_pages
Even though user and sys times are similar, total time to execute the command shows very different number. It’s because most of the time is consumed to save the result to the disk. So, use multiple threads really can help speed up the compile time.
Leave a Reply