[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/12] roms/edk2-funcs.sh: add the qemu_edk2_get_thre
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PULL 05/12] roms/edk2-funcs.sh: add the qemu_edk2_get_thread_count() function |
Date: |
Sat, 16 Mar 2019 23:09:30 +0100 |
From: Laszlo Ersek <address@hidden>
The edk2 "build" utility natively supports building modules (that is, INF
files) in parallel. The feature is not useful when building a single
module (with the "-m" option), but it is useful for platform firmware
builds (which include many modules). Add a function that determines the
"-n" option argument for "build", from the MAKEFLAGS variable (i.e. based
on the presence of a make job server).
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Michal Privoznik <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Tested-by: Igor Mammedov <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
roms/edk2-funcs.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/roms/edk2-funcs.sh b/roms/edk2-funcs.sh
index d1cb1e4a11..a9fae7ee89 100644
--- a/roms/edk2-funcs.sh
+++ b/roms/edk2-funcs.sh
@@ -226,3 +226,28 @@ qemu_edk2_set_cross_env()
eval "export $cross_prefix_var=\$cross_prefix"
}
+
+
+# Determine the "-n" option argument (that is, the number of modules to build
+# in parallel) for the edk2 "build" utility. Print the result to the standard
+# output.
+#
+# Parameters:
+# $1: the value of the MAKEFLAGS variable
+qemu_edk2_get_thread_count()
+{
+ local makeflags="$1"
+
+ if [[ "$makeflags" == *--jobserver-auth=* ]] ||
+ [[ "$makeflags" == *--jobserver-fds=* ]]; then
+ # If there is a job server, allow the edk2 "build" utility to parallelize
+ # as many module builds as there are logical CPUs in the system. The "make"
+ # instances forked by "build" are supposed to limit themselves through the
+ # job server. The zero value below causes the edk2 "build" utility to fetch
+ # the logical CPU count with Python's multiprocessing.cpu_count() method.
+ printf '0\n'
+ else
+ # Build a single module at a time.
+ printf '1\n'
+ fi
+}
--
2.20.1
- [Qemu-devel] [PULL 00/12] EDK2 Firmware roms, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 12/12] MAINTAINERS: add the "EDK2 Firmware" subsystem, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 11/12] Makefile: install the edk2 firmware images and their descriptors, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 10/12] tests: add missing dependency to build QTEST_QEMU_BINARY, round 2, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 08/12] pc-bios: add edk2 firmware binaries and variable store templates, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 09/12] pc-bios: document the edk2 firmware images; add firmware descriptors, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 07/12] roms: build edk2 firmware binaries and variable store templates, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 06/12] roms/Makefile: replace the $(EFIROM) target with "edk2-basetools", Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 05/12] roms/edk2-funcs.sh: add the qemu_edk2_get_thread_count() function,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PULL 04/12] roms/edk2: advance to tag edk2-stable201903, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 03/12] tests/uefi-test-tools/build.sh: work around TianoCore#1607, Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 01/12] roms: lift "edk2-funcs.sh" from "tests/uefi-test-tools/build.sh", Philippe Mathieu-Daudé, 2019/03/16
- [Qemu-devel] [PULL 02/12] roms/edk2-funcs.sh: require gcc-4.8+ for building i386 and x86_64, Philippe Mathieu-Daudé, 2019/03/16
- Re: [Qemu-devel] [PULL 00/12] EDK2 Firmware roms, Peter Maydell, 2019/03/17