diff --git a/system/manager/build.py b/system/manager/build.py index d4961850ca..93c0546c85 100755 --- a/system/manager/build.py +++ b/system/manager/build.py @@ -7,7 +7,7 @@ from pathlib import Path from openpilot.common.basedir import BASEDIR from openpilot.common.spinner import Spinner from openpilot.common.text_window import TextWindow -from openpilot.system.hardware import AGNOS +from openpilot.system.hardware import HARDWARE, AGNOS from openpilot.common.swaglog import cloudlog, add_file_handler from openpilot.system.version import get_build_metadata @@ -26,6 +26,10 @@ def build(spinner: Spinner, dirty: bool = False, minimal: bool = False) -> None: extra_args = ["--minimal"] if minimal else [] + if AGNOS: + HARDWARE.set_power_save(False) + os.sched_setaffinity(0, range(8)) # ensure we can use the isolcpus cores + # building with all cores can result in using too # much memory, so retry with less parallelism compile_output: list[bytes] = [] diff --git a/tools/op.sh b/tools/op.sh index 921627bb89..c6abde67a3 100755 --- a/tools/op.sh +++ b/tools/op.sh @@ -283,7 +283,13 @@ function op_build() { CDIR=$(pwd) op_before_cmd cd "$CDIR" - op_run_command scons $@ + if [[ -f "/AGNOS" ]]; then + # needed on AGNOS to not run out of memory + op_run_command system/manager/build.py + else + # scons is fine on PC + op_run_command scons $@ + fi } function op_juggle() {