-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.zephyr_base
86 lines (75 loc) · 3.36 KB
/
Dockerfile.zephyr_base
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# To build Docker image, call `docker build` from the current directory of this
# file
#
# Reference:
# - Secure boot: https://docs.mcuboot.com/readme-espressif.html
# - Zephyr dev: https://docs.zephyrproject.org/latest/develop/getting_started/index.html
FROM ubuntu:22.04@sha256:965fbcae990b0467ed5657caceaec165018ef44a4d2d46c7cdea80a9dff0d1ea
# 20230301
ENV MCUBOOT_COMMIT_SHA="b56a65f5cb32898a20da101ca0e3d97f8c0a3d48"
# 20230121
ENV ESPIDF_COMMIT_SHA="49551cc48cb3cdd5563059028749616de313f0ec"
# 20230307. This revision has https://github.com/zephyrproject-rtos/zephyr/pull/55291
ENV ZEPHYR_MR_COMMIT_SHA="e26bf578c6746d3800f1d62c803bbee3cb12390d"
ENV HOME /home/esp
WORKDIR ${HOME}/
SHELL ["/bin/bash", "-c"]
# Install dependencies
RUN apt update && apt upgrade -y && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y \
git wget flex bison gperf vim xxd xz-utils file \
python3-dev python3-venv python3-pip python3-setuptools python3-tk python3-wheel \
cmake ninja-build make gcc gcc-multilib g++-multilib \
ccache libffi-dev libssl-dev dfu-util device-tree-compiler libusb-1.0-0 \
libsdl2-dev libmagic1 udev libarchive-zip-perl vbindiff
# Create user "esp". Group dialout is for USB access from container
RUN useradd -g dialout -m esp && \
cp /root/.bashrc /home/esp/ && \
chown -R --from=root esp /home/esp
USER esp
#############################
# MCUboot development
#############################
RUN git clone https://github.com/mcu-tools/mcuboot.git && \
cd mcuboot && \
git checkout ${MCUBOOT_COMMIT_SHA} && \
pip3 install -r scripts/requirements.txt && \
git submodule update --init --recursive --checkout boot/espressif/hal/esp-idf && \
git submodule update --init --recursive ext/mbedtls && \
cd boot/espressif/hal/esp-idf && \
./install.sh esp32,esp32s2,esp32s3
#############################
# Zephyr development
#############################
RUN cd ${HOME} && \
mkdir -p ${HOME}/zephyrproject && \
python3 -m venv ${HOME}/zephyrproject/.venv
# Get Zephyr and install python deps
RUN source ${HOME}/zephyrproject/.venv/bin/activate && \
pip install west && \
cd ${HOME}/zephyrproject && \
mkdir -p zephyr && \
cd zephyr && \
git init && \
git remote add origin https://github.com/zephyrproject-rtos/zephyr.git && \
git fetch --depth 1 origin ${ZEPHYR_MR_COMMIT_SHA} && \
git checkout FETCH_HEAD && \
cd .. && \
# Init with local manifest repo
west init -l ${HOME}/zephyrproject/zephyr && \
west update && \
west zephyr-export && \
pip install -r ${HOME}/zephyrproject/zephyr/scripts/requirements.txt && \
west blobs fetch hal_espressif && \
pip install kconfiglib && deactivate
# Install Zephyr SDK
RUN source ${HOME}/zephyrproject/.venv/bin/activate && \
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64.tar.xz && \
wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/sha256.sum | shasum --check --ignore-missing && \
mkdir zephyr-sdk && \
tar xf zephyr-sdk-0.16.1_linux-x86_64.tar.xz --strip=1 --directory zephyr-sdk && \
rm zephyr-sdk-0.16.1_linux-x86_64.tar.xz && \
cd zephyr-sdk && \
# Install esp32 toolchain and host tools; register cmake package
echo | ./setup.sh -t xtensa-espressif_esp32_zephyr-elf -h -c && deactivate
CMD ["/bin/bash"]