What is the BB_NUMBER_THREADS variable in Yocto Project?

Yocto Project takes few hours to complete the build process. Build time depends on your host PC CPU core and internet speed.
bitbake uses parallelism during the build process and this variable BB_NUMBER_THREADS is used to define the maximum number of the tasks run parallel during the build process.
How many tasks bitbake runs parallel during the build. it depends on the number of CPU cores available on the host machine. so we can set the number of CPU cores to utilize during the build process and this way we can speed up the build process.

Where to set BB_NUMBER_THREADS variable in Yocto Project?

You can set this variable BB_NUMBER_THREADS in local.conf file with the following ways.

1-Method

After environment setup, the build directory is auto-generated. in build/local.conf file set BB_NUMBER_THREADS variable as per your host CPU cores.

Example - for Quadcore CPU BB_NUMBER_THREADS ="4"

# open local.conf file
$ vim conf/local.conf

# for Quadcore CPU 
BB_NUMBER_THREADS = "4"

 

2-Method

You can also set automatically based on the CPU count using the below macro.
It reads the number of CPU cores available from the host and assigns them to BB_NUMBER_THREADS variable.

# Set automatically cpu count
BB_NUMBER_THREADS = "${@oe.utils.cpu_count()}"

 

Note- Sometimes you observed after running bitbake your host machine restart To resolve this type of issue you need to reduce parallel task run during the bitbake build process by using BB_NUMBER_THREADS variable.

 

Add comment


Security code
Refresh