summaryrefslogtreecommitdiff
path: root/zephyr/zmake/zmake/util.py
Commit message (Collapse)AuthorAgeFilesLines
* Reland "zephyr: pull in the version string from zmake"Jack Rosenthal2021-08-201-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 93adb802c1a626fbb73d762124e90be4fee08a8b. This commit was reverted due to build failures with the chromeos-zephyr ebuild. The root cause of the build failures was that the ebuild uses different working directories between the configure and build phases, and so the path to the include directory we generate during the configure phase won't work in the build phase. Use the full path here so that we can run the diffrerent phases in different working directories. Diff from original commit: Change-Id: Idcbd0c0546f9fcb12fcd66c617e024b8aa2a893a > --- a/zephyr/zmake/zmake/zmake.py > +++ b/zephyr/zmake/zmake/zmake.py > @@ -235,7 +235,7 @@ class Zmake: > self.logger.info("Clearing old build directory %s", build_dir) > shutil.rmtree(build_dir) > > - generated_include_dir = build_dir / "include" > + generated_include_dir = (build_dir / "include").resolve() > base_config = zmake.build_config.BuildConfig( > environ_defs={"ZEPHYR_BASE": str(zephyr_base), "PATH": "/usr/bin"}, > cmake_defs={ BUG=b:197287679 BRANCH=none TEST=emerge-volteer chromeos-zephyr Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I80cec7a1622edcecc670b7dbeed56dadcdf71555 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3111305 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* Revert "zephyr: pull in the version string from zmake"Rob Barnes2021-08-201-23/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 10809eb023d475681b45863e68d906fae4667eda. Reason for revert: Causing build errors b/197287679 Original change's description: > zephyr: pull in the version string from zmake > > Zmake computes a version string and stores it in FRID/FWID, but this > was never plumbed all the way out into the version functionality in > the OS, which was reporting the version generated by > util/getversion.sh. > > Add a mechanism to generate the version header from zmake and replace > the getversion.sh generation with that. > > BUG=b:184832251 > BRANCH=none > TEST=provided unit tests > TEST=get this version string on posix-ec: > posix-ec_v2.6.73347-cmsis:c3bd20,ec:c814a9,hal_stm32:f8ff8d,os:efe095 > 2021-08-18 14:10:18 jrosenth@germania > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Change-Id: Idec1c5f8b5f014126706e4fdc1f3d158edf40a63 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104625 > Reviewed-by: Denis Brockus <dbrockus@chromium.org> Bug: b:184832251 Change-Id: Ifcc4830e3097c8dc8126bb76adfeb3ce75a7a667 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110293 Auto-Submit: Rob Barnes <robbarnes@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* zephyr: pull in the version string from zmakeJack Rosenthal2021-08-191-0/+23
| | | | | | | | | | | | | | | | | | | | | | Zmake computes a version string and stores it in FRID/FWID, but this was never plumbed all the way out into the version functionality in the OS, which was reporting the version generated by util/getversion.sh. Add a mechanism to generate the version header from zmake and replace the getversion.sh generation with that. BUG=b:184832251 BRANCH=none TEST=provided unit tests TEST=get this version string on posix-ec: posix-ec_v2.6.73347-cmsis:c3bd20,ec:c814a9,hal_stm32:f8ff8d,os:efe095 2021-08-18 14:10:18 jrosenth@germania Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Idec1c5f8b5f014126706e4fdc1f3d158edf40a63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104625 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: zmake: run black on all files, enable check in run_tests.shJack Rosenthal2021-07-121-35/+47
| | | | | | | | | | | | | | | Run black on all files. Enable check in run_tests.sh to enforce future formatting requirements. BUG=b:192389533 BRANCH=none TEST=run_tests.sh Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5d93ef61d32d0dab4fe4bf3a77faf3f6693be627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002839 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zmake: Add utility for getting value from autoconf.hYuval Peress2021-06-091-0/+17
| | | | | | | | | | | | | | | | | | | Kconfig generates an autoconf.h header from the various Kconfig files. These values (such as CONFIG_FLASH_SIZE) may not be obvious to find. This is especially true since some Kconfig values are passed in from zmake while others reside in Kconfig files. Add a utility to get the #define value from the autoconf.h that's generated during the build. BRANCH=none BUG=b:190435084 TEST=Added unit tests Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id2c1f05a809e17f67a435209e35606ffd7245174 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2948168 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: zmake: Always used the supplied build directorySimon Glass2021-02-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | If --build-dir is provided it seems better to always use it. The current logic in resolve_build_dir() assumes that the build will progress far enough that we recognise the build directory. If it doesn't, then the flag is ignored and we build in a default location. It isn't clear to me why that is better than always using the directory. Drop this unnecessary logic. BRANCH=none BUG=b:178731498 TEST=pytest zephyr/zmake/ zmake configure -B /tmp/z/vol zephyr/projects/volteer/ -t zephyr && zmake build /tmp/z/vol in the chroot: FEATURES=test sudo -E emerge -q zephyr-build-tools zmake testall Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I9e46d91e79cc946016cf8d33ed6ea1f3862c977e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2697123 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zepyhr: zmake: add a function to read zephyr version from $ZEPHYR_BASEJack Rosenthal2021-02-101-0/+22
| | | | | | | | | | | | | | This will be used to read the version from a non-CrOS checked-out zephyr base. BUG=b:179813084 BRANCH=none TEST=provided unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id6c3bdebbc5273df767f23115f00f2dac794e3a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685474 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: Fix zmake default build directory resolutionYuval Peress2021-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous changes to the zmake build system made the incorrect assumption that the build directory exists already as such, running `zmake configure -B $build_dir` with a new non-initialized director would fail since the resolve_build_dir function would fail to recognize it as a valid build directory. The new logic also allows for passing directories which do not yet exist. BRANCH=none BUG=none TEST=pytest zephyr/zmake/tests/test_util.py TEST=zmake configure -B /tmp/z/pos \ zephyr/projects/posix-ec/ \ && zmake -l DEBUG build /tmp/z/pos Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I754d4545f8d98cc65270b8d50f327cbb04ce3c87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2678927 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: allow zmake build/test to target project directoriesYuval Peress2021-02-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | Allows zmake to use the default platform/ec/build directory when running the build/test subcommand. Developers can now simply point to the actual projects without having to worry about where the build is being done. BRANCH=none BUG=none TEST=Added/modified unit tests TEST=zmake configure zephyr/test/system && \ zmake build zephyr/test/system && \ zmake test zephyr/test/system && \ echo SUCCESS TEST=rm -fr build/zephyr/test/system ; \ zmake build zephyr/test/system || echo SUCCESS Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id830f8dffc30f641fff0cd5ff50d30b2efedeece Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2665072 Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: enable default build directory for configure subcommandYuval Peress2021-02-041-0/+31
| | | | | | | | | | | | | | | | | Allow zmake to create a default build directory when running zmake configure. This provides a similar behavior to platform/ec's make system. Projects will be placed under platform/ec/build/zephyr/... BRANCH=none BUG=none TEST=Added unit test TEST=zmake configure -b zephyr/projects/volteer Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Icabed1b77cf5876a75898322d39806237e05d520 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2665071 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: copy zmake to platform/ecJack Rosenthal2021-01-091-0/+147
This copies zmake into platform/ec/zephyr/zmake, as explained in go/zephyr-fewer-repos. Follow-on CLs will be submitted to: - Update the chromeos-base/zephyr-build-tools ebuild to reference this directory instead of the one in zephyr-chrome. - Remove the copy of zmake in zephyr-chrome. Those interested in the git history of this code prior to it being moved to platform/ec can find it here: https://chromium.googlesource.com/chromiumos/platform/zephyr-chrome/+log/bacea2e3e62c41000e5bdb4ed6433f24386d14bf/util BUG=b:177003034 BRANCH=none TEST=emerge with new path (requires follow-on CL) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia957b3e35ce3b732968ebf8df603ef13298cc6b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2618501 Reviewed-by: Yuval Peress <peress@chromium.org>