mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-06-28 01:06:16 -04:00
[GCC toolchain builder] Provide means of throttling parallel builds. (#1680)
This commit is contained in:
parent
c0a30e1c85
commit
2745f3edcf
2 changed files with 18 additions and 4 deletions
|
@ -162,6 +162,14 @@ located under `util/gcc-toolchain-builder`. Please make sure beforehand that yo
|
||||||
installed all the required *toolchain build* dependencies (see
|
installed all the required *toolchain build* dependencies (see
|
||||||
[the toolchain README file](file:util/gcc-toolchain-builder/README.md).)
|
[the toolchain README file](file:util/gcc-toolchain-builder/README.md).)
|
||||||
|
|
||||||
|
To control the load of your host machine when building the toolchain, you can use
|
||||||
|
the environment variable `NUM_JOBS` to limit the number of concurrent jobs launched
|
||||||
|
by `make`:
|
||||||
|
- if left undefined, `NUM_JOBS` will default to 1, resulting in a sequential execution
|
||||||
|
of `make` jobs;
|
||||||
|
- when setting `NUM_JOBS` to an explicit value, it is recommended not to exceed 2/3 of
|
||||||
|
the total nuber of virtual cores available on your system.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Set environment variable RISCV to the desired installation location.
|
# Set environment variable RISCV to the desired installation location.
|
||||||
# The toolchain can be installed in any user-writable directory.
|
# The toolchain can be installed in any user-writable directory.
|
||||||
|
|
|
@ -37,6 +37,12 @@ ROOT_DIR=$(dirname $(readlink -f $0))
|
||||||
# Builds of individual tools are performed under the matching
|
# Builds of individual tools are performed under the matching
|
||||||
# build/... subdirectories
|
# build/... subdirectories
|
||||||
|
|
||||||
|
# Provide a means of throttling parallel 'make' executions.
|
||||||
|
# Use a conservative setting to avoid overloading the host machine.
|
||||||
|
if [ -z "$NUM_JOBS" ]; then
|
||||||
|
NUM_JOBS=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Helper function to print usage information.
|
# Helper function to print usage information.
|
||||||
print_usage()
|
print_usage()
|
||||||
{
|
{
|
||||||
|
@ -163,7 +169,7 @@ cd $ROOT_DIR/build/binutils-gdb
|
||||||
{ echo "Could not configure binutils-gdb, bailing out!" ; \
|
{ echo "Could not configure binutils-gdb, bailing out!" ; \
|
||||||
exit 2 ; } ; } && \
|
exit 2 ; } ; } && \
|
||||||
{ [ -d gas/doc ] || mkdir -p gas/doc; } && \
|
{ [ -d gas/doc ] || mkdir -p gas/doc; } && \
|
||||||
make -j all && make install || \
|
make -j"$NUM_JOBS" all && make install || \
|
||||||
{ echo "*** Could not build binutils, bailing out!" ; exit 2; }
|
{ echo "*** Could not build binutils, bailing out!" ; exit 2; }
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
@ -182,8 +188,8 @@ cd $ROOT_DIR/build/gcc
|
||||||
../../$GCC_DIR/configure $GCC_CONFIGURE_OPTS || \
|
../../$GCC_DIR/configure $GCC_CONFIGURE_OPTS || \
|
||||||
{ echo "Could not configure GCC, bailing out!" ; \
|
{ echo "Could not configure GCC, bailing out!" ; \
|
||||||
exit 2 ; } ; } && \
|
exit 2 ; } ; } && \
|
||||||
make -j all || { rm -rf $TARGET && \
|
make -j"$NUM_JOBS" all || { rm -rf $TARGET && \
|
||||||
make -j all ; } && make install || \
|
make -j"$NUM_JOBS" all ; } && make install || \
|
||||||
{ echo "*** Could not build GCC (even after removing target dirs), bailing out!" ; exit 2; }
|
{ echo "*** Could not build GCC (even after removing target dirs), bailing out!" ; exit 2; }
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
@ -209,7 +215,7 @@ export CFLAGS="-mcmodel=medium"
|
||||||
../../$NEWLIB_DIR/configure $NEWLIB_CONFIGURE_OPTS || \
|
../../$NEWLIB_DIR/configure $NEWLIB_CONFIGURE_OPTS || \
|
||||||
{ echo "Could not configure newlib, bailing out!" ; \
|
{ echo "Could not configure newlib, bailing out!" ; \
|
||||||
exit 2 ; } ; } && \
|
exit 2 ; } ; } && \
|
||||||
make -j all && make install || \
|
make -j"$NUM_JOBS" all && make install || \
|
||||||
{ echo "*** Could not build newlib, bailing out!" ; exit 2; }
|
{ echo "*** Could not build newlib, bailing out!" ; exit 2; }
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue