From c74564086ca0540d2744861f7db2d8731da7ed41 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Fri, 25 Sep 2020 15:52:31 -0400 Subject: [PATCH] Buildsystem: permit to pass CPUS=X to make to force a number of CPUS to be used if desired, else the default is detected in Makefile and pushed to submodules. If nothing specified, uses nproc and pass it to submodules. CircleCI forced to CPUS=2 --- .circleci/config.yml | 16 ++++++++-------- Makefile | 2 +- modules/coreboot | 4 ++-- modules/linuxboot | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ba440d4..23d00724 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,7 +50,7 @@ jobs: # command: | # ./build/make-4.2.1/make \ # CROSS=/cross/bin/x86_64-linux-musl- \ -# --load 2 \ +# CPUS=2 \ # V=1 \ # BOARD=qemu-linuxboot \ # @@ -63,7 +63,7 @@ jobs: name: x230-flash #We delete build/make-4.2.1/ directory until issue #799 is fixed. command: | - rm -rf build/x230-flash/* build/log/* && make --load 2 \ + rm -rf build/x230-flash/* build/log/* && make CPUS=2 \ V=1 \ BOARD=x230-flash || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h @@ -81,7 +81,7 @@ jobs: - run: name: t430-flash command: | - rm -rf build/t430-flash/* build/log/* && make --load 2 \ + rm -rf build/t430-flash/* build/log/* && make CPUS=2 \ V=1 \ BOARD=t430-flash || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h @@ -99,7 +99,7 @@ jobs: - run: name: t430 command: | - rm -rf build/t430/* build/log/* && make --load 2 \ + rm -rf build/t430/* build/log/* && make CPUS=2 \ V=1 \ BOARD=t430 || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h @@ -117,7 +117,7 @@ jobs: - run: name: x230 command: | - rm -rf build/x230/* build/log/* && make --load 2 \ + rm -rf build/x230/* build/log/* && make CPUS=2 \ V=1 \ BOARD=x230 || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h @@ -135,7 +135,7 @@ jobs: - run: name: x230-hotp-verification command: | - rm -rf build/x230-hotp-verification/* build/log/* && make --load 2 \ + rm -rf build/x230-hotp-verification/* build/log/* && make CPUS=2 \ V=1 \ BOARD=x230-hotp-verification || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h @@ -153,7 +153,7 @@ jobs: - run: name: librem_mini-NoTPM command: | - rm -rf build/librem_mini-NoTPM/* build/log/* && make --load 2 \ + rm -rf build/librem_mini-NoTPM/* build/log/* && make CPUS=2 \ V=1 \ BOARD=librem_mini-NoTPM || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h @@ -171,7 +171,7 @@ jobs: - run: name: qemu-coreboot command: | - rm -rf build/qemu-coreboot/* build/log/* && make --load 2 \ + rm -rf build/qemu-coreboot/* build/log/* && make CPUS=2 \ V=1 \ BOARD=qemu-coreboot || (find ./build/ -name "*.log" -type f -mmin -1|while read log; do echo ""; echo '==>' "$log" '<=='; echo ""; cat $log;done; exit 1) \ no_output_timeout: 3h diff --git a/Makefile b/Makefile index fd76b057..42fad6e0 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ INSTALL := $(pwd)/install log_dir := $(build)/log # Controls how many parallel jobs are invoked in subshells -CPUS := $(shell nproc) +CPUS ?= $(shell nproc) #MAKE_JOBS ?= -j$(CPUS) --max-load 16 # Create the log directory if it doesn't already exist diff --git a/modules/coreboot b/modules/coreboot index f9134dac..04d8f943 100644 --- a/modules/coreboot +++ b/modules/coreboot @@ -67,12 +67,12 @@ $(COREBOOT_TOOLCHAIN): else COREBOOT_TOOLCHAIN="$(build)/$(coreboot_base_dir)/.xcompile" $(COREBOOT_TOOLCHAIN): $(build)/$(coreboot_base_dir)/.canary - $(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=`nproc` crossgcc-i386 + $(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=$$CPUS crossgcc-i386 endif $(build)/$(coreboot_dir)/.configured: $(COREBOOT_IASL) $(COREBOOT_TOOLCHAIN) $(COREBOOT_IASL): $(build)/$(coreboot_base_dir)/.canary - $(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=`nproc` iasl + $(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=$$CPUS iasl # Force a rebuild if the inputs have changed $(build)/$(coreboot_dir)/.build: \ diff --git a/modules/linuxboot b/modules/linuxboot index 4e04a9e3..57ea31a2 100644 --- a/modules/linuxboot +++ b/modules/linuxboot @@ -21,7 +21,7 @@ linuxboot_configure := \ if [ "$(linuxboot_board)" = "qemu" ]; then \ echo >&2 "Pre-building edk2 OVMF" ; \ ( cd $(build)/$(linuxboot_base_dir)/edk2/OvmfPkg ; \ - ./build.sh -n `nproc` \ + ./build.sh -n $$CPUS \ ) || exit 1 ; \ fi ; \ touch .config ; \