Natively building L4T kernel with multiple CPU cores of TX2

I was able to build L4T 28.1 kernel natively on TX2, but it took 12 minutes.
I used “make zImage -j9” but only one CPU core ran at 100%, other 3 CPU cores stayed at 0%.
“make zImage -j9” worked for multiple cores of Intel CPUs.
What do I need to build kernel on TX2 using all 4 CPU cores?

Thanks in advance for any input.

You only use at most a “-j#” of the same number of cpu cores available. By default this is 4…with jetson_clocks.sh or nvpmodel you can crank it up to 6 cores because then the Denver cores kick in. So at absolute most you’d use “-j6”…just “-j4” if you didn’t enable all 6 cores.

I don’t know why only one core would be used under “-j9”, but perhaps if you specify more threads than cores it reverts back to a single core…or perhaps it detects running low on RAM with too many concurrent threads…I have not tested.

Because CPU0 is critical for hardware I/O I typically use “-j5”.

FYI, since only Image is used, and not a compressed zImage, you can just “make Image” and skip the extra disk space and time of compressing this.

Try:

sudo ~ubuntu/jetson_clocks.sh
make -j6 Image

I tried “make -j4 Image” and “make -j2 Image”, still got only CPU 0 running.

When I run my multi-threaded apps, I have all 4 CPU running.

The Linux kernel source Makefile is configured such that it should take advantage of multiple cores when the “-j” (jobserver) option is used. I typically use htop to monitor this (“sudo apt-get install htop”). If this were not kernel source I would suspect that the Makefile lacks job server setup. Since this is kernel source (I assume standard NVIDIA kernel source), is there anything unusual aobut the “make” software or development environment?

If you run “sudo ~ubuntu/jetson_clocks.sh” you should have 6 CPU, not 4. Either way the “-j#” should be honored if there is enough RAM…and “-j6” does not require all that much RAM so it shouldn’t be a problem.

It’s L4T28.1 OS installed from Jetpack 3.1 (OS only, no Cuda and other software packages).
I was able to build multi-threaded apps running on all 4 CPUs using the same “make” and native compilers.
I did not install any other packages except “libv4l-dev” for V4L apps.
For some reasons, the “make” for Tegra could not use “j” for multi threaded processing.

“make” itself can be told to allow multiple threads via the “-j” job server option. It won’t actually use this unless the Makefile being used precedes something with the “+” sign…this is how it knows this can be done in parallel…“make -j6” for example will be only a single thread if the Makefile doesn’t set up for multiple threads. The kernel source normally has multiple threads available during build and so “-j4” or “-j6” should work. There may be exceptions if the make target was something odd.

“make -j4 Image” or “make -j4 zImage” should use multiple threads unless intermediate file compile was already done…in which case linking would proceed and linking is only single-threaded. Normally I would tell you you can just “make clean” and build again, but source_sync.sh directories may require more cleaning than just this after a “make clean”…however, you might want to try this.

When you say using native compilers, are you using the default gcc during kernel source build?