Skip to content

Commit 16497b2

Browse files
authored
Merge pull request #2589 from ladyada/main
dox 4 tux
2 parents 0206a1b + b75b68d commit 16497b2

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

ESP32S3_Linux/Dockerfile

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Dockerfile port of https://gist.github.com/jcmvbkbc/316e6da728021c8ff670a24e674a35e6
2+
# wifi details http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3wifi
3+
4+
# we need python 3.10 not 3.11
5+
FROM ubuntu:22.04
6+
7+
RUN apt-get update
8+
RUN apt-get -y install gperf bison flex texinfo help2man gawk libtool-bin git unzip ncurses-dev rsync zlib1g zlib1g-dev xz-utils cmake wget bzip2 g++ python3 python3-dev python3-pip cpio bc virtualenv libusb-1.0 && \
9+
ln -s /usr/bin/python3 /usr/bin/python
10+
11+
WORKDIR /app
12+
13+
# install autoconf 2.71
14+
RUN wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz && \
15+
tar -xf autoconf-2.71.tar.xz && \
16+
cd autoconf-2.71 && \
17+
./configure --prefix=`pwd`/root && \
18+
make && \
19+
make install
20+
ENV PATH="$PATH:/app/autoconf-2.71/root/bin"
21+
22+
# dynconfig
23+
RUN git clone https://github.com/jcmvbkbc/xtensa-dynconfig -b original --depth=1 && \
24+
git clone https://github.com/jcmvbkbc/config-esp32s3 esp32s3 --depth=1 && \
25+
make -C xtensa-dynconfig ORIG=1 CONF_DIR=`pwd` esp32s3.so
26+
ENV XTENSA_GNU_CONFIG="/app/xtensa-dynconfig/esp32s3.so"
27+
28+
# ct-ng cannot run as root, we'll just do everything else as a user
29+
RUN useradd -d /app/build -u 3232 esp32 && mkdir build && chown esp32:esp32 build
30+
USER esp32
31+
32+
# toolchain
33+
RUN cd build && \
34+
git clone https://github.com/jcmvbkbc/crosstool-NG.git -b xtensa-fdpic --depth=1 && \
35+
cd crosstool-NG && \
36+
./bootstrap && \
37+
./configure --enable-local && \
38+
make && \
39+
./ct-ng xtensa-esp32s3-linux-uclibcfdpic && \
40+
CT_PREFIX=`pwd`/builds ./ct-ng build || echo "Completed" # the complete ct-ng build fails but we still get what we wanted!
41+
RUN [ -e build/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] || exit 1
42+
43+
# kernel and rootfs
44+
RUN cd build && \
45+
git clone https://github.com/jcmvbkbc/buildroot -b xtensa-2023.02-fdpic --depth=1 && \
46+
make -C buildroot O=`pwd`/build-xtensa-2023.02-fdpic-esp32s3 esp32s3wifi_defconfig && \
47+
buildroot/utils/config --file build-xtensa-2023.02-fdpic-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PATH `pwd`/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic && \
48+
buildroot/utils/config --file build-xtensa-2023.02-fdpic-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic' && \
49+
buildroot/utils/config --file build-xtensa-2023.02-fdpic-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic' && \
50+
make -C buildroot O=`pwd`/build-xtensa-2023.02-fdpic-esp32s3
51+
RUN [ -f build/build-xtensa-2023.02-fdpic-esp32s3/images/xipImage -a -f build/build-xtensa-2023.02-fdpic-esp32s3/images/rootfs.cramfs ] || exit 1
52+
53+
54+
# bootloader
55+
ENV IDF_PATH="/app/build/esp-hosted/esp_hosted_ng/esp/esp_driver/esp-idf"
56+
RUN cd build && \
57+
git clone https://github.com/jcmvbkbc/esp-hosted -b shmem --depth=1 && \
58+
cd esp-hosted/esp_hosted_ng/esp/esp_driver && cmake . && \
59+
cd esp-idf && . ./export.sh && \
60+
cd ../network_adapter && idf.py set-target esp32s3 && \
61+
cp sdkconfig.defaults.esp32s3 sdkconfig && idf.py build
62+
63+
64+
# move files over
65+
RUN cd build && mkdir release && \
66+
cp esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/bootloader/bootloader.bin release && \
67+
cp esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/partition_table/partition-table.bin release && \
68+
cp esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/network_adapter.bin release && \
69+
cp build-xtensa-2023.02-fdpic-esp32s3/images/xipImage release && \
70+
cp build-xtensa-2023.02-fdpic-esp32s3/images/rootfs.cramfs release
71+
72+
# keep docker running so we can debug/rebuild :)
73+
USER root
74+
ENTRYPOINT ["tail", "-f", "/dev/null"]
75+
76+
77+
# grab the files with `docker cp CONTAINER_NAME:/app/build/release/\* .`
78+
# now you can burn the files from the 'release' folder with:
79+
# python esptool.py --chip esp32s3 -p /dev/ttyUSB0 -b 921600 --before=default_reset --after=hard_reset write_flash 0x0 bootloader.bin 0x10000 network_adapter.bin 0x8000 partition-table.bin
80+
# next we can burn in the kernel and filesys with parttool, which is part of esp-idf
81+
# parttool.py write_partition --partition-name linux --input xipImage
82+
# parttool.py write_partition --partition-name rootfs --input rootfs.cramfs

0 commit comments

Comments
 (0)