add an option to build.sh to change the number of CPU used for make jobs

Description

Add a command-line option --jobs <NPROC> to build.sh in order to control the number of parallel jobs used by make. This prevents builds from overwhelming systems with limited resources, where defaulting to all available CPUs (nproc) can lead to failures or slowdowns due to memory pressure.

Code version identification

Commit: @158239ba

Current behavior

The script currently runs:

make -j $(nproc) -C $BUILD_DIR >> "$CURDIR/build.log"

This uses all available CPU cores by default. On systems with limited resources like a Raspberry Pi this can lead to build crashes due to resource exhaustion.

Expected behavior

The script should allow the user to configure the number of jobs used by make with a command-line option. By default, it will still use nproc, but users can override it with:

./build.sh --jobs <NPROC>

For example, setting --jobs 1 ensures the build runs reliably on resource-constrained environments.

Security impact

No direct security impact. This enhancement only affects resource usage during build time and does not modify functional or security-related aspects of the software.

Implementation

Introduce a new command-line option --jobs <NPROC>

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information