File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed
Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,33 @@ make BOARD=nordic_nrf7002dk
2828This uses Zephyr's cmake to generate Makefiles that then delegate to
2929` tools/cpbuild/build_circuitpython.py ` to build the CircuitPython bits in parallel.
3030
31+ ## Native simulator build container
32+
33+ Building the native sim requires ` libsdl2-dev:i386 ` and other 32bit dependencies that
34+ can cause conflicts on 64bit systems resulting in the removal of 64bit versions of critical
35+ software such as the display manager and network manager. A Containerfile and a few scripts
36+ are provided to set up a container to make the native sim build inside without affecting the
37+ host system.
38+
39+ The container automatically mounts this instance of the circuitpython repo inside at
40+ ` /home/dev/circuitpython ` . Changes made in the repo inside the container and on the host PC
41+ will sync automatically between host and container.
42+
43+ To use the container file:
44+
45+ 1 . Build the container with ` podman build -t zephyr-cp-dev -f native_sim_build_Containerfile . `
46+ 2 . Run/Start the container by running ` ./native_sim_build_run_container.sh ` on the host PC.
47+ The script will automatically run or start based on whether the container has been run before.
48+ 3 . Init requirements inside the container with ` ./native_sim_build_init_container.sh `
49+
50+ To delete the container and cleanup associated files:
51+ ``` sh
52+ podman ps -a --filter ancestor=zephyr-cp-dev -q | xargs -r podman rm -f
53+ podman rmi zephyr-cp-dev
54+ podman image prune -f
55+ podman rm -f zcp
56+ ```
57+
3158## Running the native simulator
3259
3360From ` ports/zephyr-cp ` , run:
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y --no-in
1212 protobuf-compiler sudo \
1313 && rm -rf /var/lib/apt/lists/*
1414
15- RUN useradd -m -s /bin/bash dev \
15+ # Remove the default ubuntu:24.04 'ubuntu' user (UID 1000) so 'dev' can take
16+ # UID 1000 — required for --userns=keep-id to map host UID 1000 to 'dev'.
17+ RUN userdel -r ubuntu 2>/dev/null || true \
18+ && useradd -m -u 1000 -s /bin/bash dev \
1619 && echo 'dev ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/dev \
1720 && chmod 440 /etc/sudoers.d/dev
1821USER dev
Original file line number Diff line number Diff line change 99# Safe to re-run; west/pip/etc. are idempotent.
1010set -euo pipefail
1111
12+ git config --global --add safe.directory /home/dev/circuitpython
13+
1214cd " $( dirname " ${BASH_SOURCE[0]} " ) "
1315
1416echo " ==> west init"
15- if [ ! -d ../../. west ]; then
17+ if [ ! -d .west ]; then
1618 west init -l zephyr-config
1719else
1820 echo " (already initialized, skipping)"
@@ -34,7 +36,6 @@ echo "==> west sdk install (x86_64-zephyr-elf)"
3436west sdk install -t x86_64-zephyr-elf
3537
3638echo " ==> fetch port submodules"
37- git config --global --add safe.directory /home/dev/circuitpython
3839python ../../tools/ci_fetch_deps.py zephyr-cp
3940
4041echo
You can’t perform that action at this time.
0 commit comments