Skip to content

Instantly share code, notes, and snippets.

@WeirdTreeThing
Created October 8, 2025 02:51
Show Gist options
  • Select an option

  • Save WeirdTreeThing/f5cb8368258eedd254e38d2dbbde45fc to your computer and use it in GitHub Desktop.

Select an option

Save WeirdTreeThing/f5cb8368258eedd254e38d2dbbde45fc to your computer and use it in GitHub Desktop.

Revisions

  1. WeirdTreeThing renamed this gist Oct 8, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. WeirdTreeThing created this gist Oct 8, 2025.
    49 changes: 49 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    make a directory to store everything
    ```
    mkdir ~/cros-ec
    cd ~/cros-ec
    ```

    build coreboot's arm toolchain as google also uses that
    ```
    git clone https://review.coreboot.org/coreboot.git
    cd coreboot
    make crossgcc-arm CPUS=$(nproc)
    ```

    setup a python venv
    ```
    python3 -m venv venv
    source venv/bin/activate
    pip install pyyaml setuptools pykwalify pylibfdt packaging pyelftools colorama
    ```

    clone all the repos
    ```
    mkdir -p src/platform
    mkdir -p src/third_party/zephyr

    git clone https://chromium.googlesource.com/chromiumos/platform/ec src/platform/ec -b stabilize-15964.9.B-main
    git clone https://chromium.googlesource.com/chromiumos/third_party/zephyr src/third_party/zephyr/main -b stabilize-15964.9.B
    git clone https://chromium.googlesource.com/chromiumos/third_party/zephyr/cmsis src/third_party/zephyr/cmsis -b stabilize-15964.9.B
    git clone https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay src/third_party/chromiumos-overlay -b stabilize-15964.9.B
    # create .repo to trick the build system into thinking this is a full chromeos checkout
    mkdir .repo
    ```

    install zmake
    ```
    cd src/platform/ec
    pip install -e zephyr/zmake
    ```

    build the ec image

    ```
    export CROS_WORKON_SRCROOT=~/cros-ec
    export COREBOOT_SDK_ROOT=~/cros-ec/coreboot/util/crossgcc/xgcc

    zmake -j$(nproc) build <board>
    ```

    output binary is `build/zephyr/<board>/output/ec.bin`