diff options
author | Jeremy Bettis <jbettis@google.com> | 2022-09-12 10:34:55 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-12 18:36:19 +0000 |
commit | 338b2fa082a886c6134ca67586d38a83bd49fe6a (patch) | |
tree | 09bac841394d909104e62b860c1e321db93a4f62 | |
parent | 54a17155080c63f4654ec8729de593fcda721f87 (diff) | |
download | chrome-ec-338b2fa082a886c6134ca67586d38a83bd49fe6a.tar.gz |
zmake: Use vpython3 in cmake
Add cmake variable to force it to use vpython3 instead of auto-detecting
the path to python. This is slightly fragile due to logic in
zephyr/main/cmake/modules/python.cmake. You can pass in PYTHON_PREFER
but it will extract the version from that binary and run
/usr/bin/python${ver}, which is very strange. Pass Python3_EXECUTABLE
to bypass all of that logic, but it has to be exactly the version in
PYTHON_MINIMUM_REQUIRED or it will fail. We'll need to make sure we keep
the vpython version matched with PYTHON_MINIMUM_REQUIRED in the future.
Update the instructions to run ram_report because it works inside the
chroot now.
Added some missing packages to twister_launcher.py as well. I'm not sure
why this change made them start to be required, but they are.
BRANCH=None
BUG=b:243936551
TEST=zmake build -a
Cq-Depend: chromium:3892212
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: Ied285ce0b69b33a9a3b016c4bd07cab0b6a13b89
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891670
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | docs/reducing_ec_image_size.md | 13 | ||||
-rwxr-xr-x | util/twister_launcher.py | 14 | ||||
-rw-r--r-- | zephyr/zmake/zmake/zmake.py | 55 |
3 files changed, 41 insertions, 41 deletions
diff --git a/docs/reducing_ec_image_size.md b/docs/reducing_ec_image_size.md index 58ed66e25c..97bcb6a37a 100644 --- a/docs/reducing_ec_image_size.md +++ b/docs/reducing_ec_image_size.md @@ -117,19 +117,12 @@ The Cmake system utilized by Zephyr provides two build targets `rom_report` and This can be useful for identifying particular modules that contribute to the image size. -The `rom_report` and `ram_report` targets are currently only supported when -working outside the chroot. Follow the [instructions][1] for building zephyr-ec -images outside chroot before running the commands below. - ``` -# Configure the Herobrine zephyr project, storing the build files in /tmp/zephyr-herobrine -$ zmake configure -B /tmp/zephyr-herobrine herobrine - -# Build the RO image -$ ninja -C /tmp/zephyr-herobrine/herobrine/build-ro +# Build herobrine image +$ zmake build herobrine # Generate the ROM report, report sent to stdout -$ ninja -C /tmp/zephyr-herobrine/herobrine/build-ro rom_report +$ ninja -C build/zephyr/herobrine/build-ro rom_report ``` Please refer to the [Zephyr Optimization Tools][3] documentation for details on diff --git a/util/twister_launcher.py b/util/twister_launcher.py index 4dd520fa0f..d786105f52 100755 --- a/util/twister_launcher.py +++ b/util/twister_launcher.py @@ -1,6 +1,6 @@ #!/usr/bin/env vpython3 -# Copyright 2022 The ChromiumOS Authors. +# Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -60,6 +60,18 @@ parameters that may be used, please consult the Twister documentation. # name: "infra/python/wheels/six-py2_py3" # version: "version:1.16.0" # > +# wheel: < +# name: "infra/python/wheels/packaging-py2_py3" +# version: "version:16.8" +# > +# wheel: < +# name: "infra/python/wheels/pyparsing-py2_py3" +# version: "version:2.4.7" +# > +# wheel: < +# name: "infra/python/wheels/pyelftools-py2_py3" +# version: "version:0.29" +# > # [VPYTHON:END] import argparse diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py index d7af2575bf..4cc3e3ea34 100644 --- a/zephyr/zmake/zmake/zmake.py +++ b/zephyr/zmake/zmake/zmake.py @@ -1,4 +1,4 @@ -# Copyright 2020 The Chromium OS Authors. All rights reserved. +# Copyright 2020 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -391,36 +391,31 @@ class Zmake: shutil.rmtree(build_dir) generated_include_dir = (build_dir / "include").resolve() + cmake_defs = { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "DTS_ROOT": str(self.module_paths["ec"] / "zephyr"), + "SYSCALL_INCLUDE_DIRS": str( + self.module_paths["ec"] / "zephyr" / "include" / "drivers" + ), + "USER_CACHE_DIR": str( + self.module_paths["ec"] / "build" / "zephyr" / "user-cache" + ), + "ZEPHYR_BASE": str(self.zephyr_base), + "ZMAKE_INCLUDE_DIR": str(generated_include_dir), + "ZMAKE_PROJECT_NAME": project.config.project_name, + **( + {"EXTRA_EC_VERSION_FLAGS": "--static"} + if static_version + else {} + ), + **({"EXTRA_CFLAGS": "-save-temps=obj"} if save_temps else {}), + } + vpython = shutil.which("vpython3") + if vpython: + cmake_defs["Python3_EXECUTABLE"] = vpython + base_config = zmake.build_config.BuildConfig( - cmake_defs={ - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "DTS_ROOT": str(self.module_paths["ec"] / "zephyr"), - "SYSCALL_INCLUDE_DIRS": str( - self.module_paths["ec"] - / "zephyr" - / "include" - / "drivers" - ), - "USER_CACHE_DIR": str( - self.module_paths["ec"] - / "build" - / "zephyr" - / "user-cache" - ), - "ZEPHYR_BASE": str(self.zephyr_base), - "ZMAKE_INCLUDE_DIR": str(generated_include_dir), - "ZMAKE_PROJECT_NAME": project.config.project_name, - **( - {"EXTRA_EC_VERSION_FLAGS": "--static"} - if static_version - else {} - ), - **( - {"EXTRA_CFLAGS": "-save-temps=obj"} - if save_temps - else {} - ), - }, + cmake_defs=cmake_defs, ) # Prune the module paths to just those required by the project. |