├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── Dockerfile ├── README.md ├── screenshots ├── docker_build.jpg ├── docker_build_before_flash.jpg ├── docker_flashing.jpg └── gpio_via_devmem.jpg └── settings.cfg.default /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: hpsaturn 4 | liberapay: Hpsaturn 5 | buy_me_a_coffee: hpsaturn 6 | patreon: hpsaturn 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | settings.cfg 2 | *.swp 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "esp32-linux-build"] 2 | path = esp32-linux-build 3 | url = https://github.com/jcmvbkbc/esp32-linux-build.git 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update 4 | 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 python3.10-venv cpio bc virtualenv libusb-1.0 && \ 5 | ln -s /usr/bin/python3 /usr/bin/python 6 | 7 | WORKDIR /app 8 | 9 | # install autoconf 2.71: 10 | RUN wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz && \ 11 | tar -xf autoconf-2.71.tar.xz && \ 12 | cd autoconf-2.71 && \ 13 | ./configure --prefix=`pwd`/root && \ 14 | make && \ 15 | make install && \ 16 | cd .. && rm autoconf-2.71.tar.xz 17 | ENV PATH="$PATH:/app/autoconf-2.71/root/bin" 18 | 19 | # user config: 20 | ARG DOCKER_USER=default_user 21 | ARG DOCKER_USERID=default_userid 22 | # Cannot run as root, we'll just do everything else as a user 23 | # The dialup group maybe doesn't work in Docker. Please help. Issue #10 24 | RUN chmod a+rwx /app && \ 25 | useradd -d /app/build -u $DOCKER_USERID $DOCKER_USER && \ 26 | mkdir build && \ 27 | chown $DOCKER_USER:$DOCKER_USER build && \ 28 | usermod -a -G dialout $DOCKER_USER 29 | 30 | USER $DOCKER_USER 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # ESP32 S3 Linux - Docker builder 3 | 4 | The initial version was a Dockerfile ported by Adafruit from the work of [@jcmvbkbc](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3). The current version uses the last version of the build scripts like a git submodule and it has some improvements on the DockerFile to support USB flashing. 5 | 6 | 7 | 8 | 11 | 12 |
9 | Don't forget to star ⭐ this repository 10 |
13 | 14 | ## Build 15 | 16 | Please follow the next steps: 17 | 18 | 1. Download or clone this repo 19 | 20 | ```bash 21 | git clone --recursive https://github.com/hpsaturn/esp32s3-linux.git && cd esp32s3-linux 22 | ``` 23 | 24 | 2. Then build the docker image: 25 | 26 | ```bash 27 | docker build --build-arg DOCKER_USER=$USER --build-arg DOCKER_USERID=$UID -t esp32linuxbase . 28 | ``` 29 | 30 | 3. Copy settings sample: 31 | 32 | ```bash 33 | cp settings.cfg.default settings.cfg 34 | ``` 35 | 36 | (**Note**: For the first build and install, leave the same settings than the default, without parameters) 37 | 38 | 4. Run the build script of your preference, for example: 39 | 40 | ```bash 41 | docker run --rm -it --name esp32s3linux --user="$(id -u):$(id -g)" -v ./esp32-linux-build:/app --env-file settings.cfg --device=/dev/ttyACM0 esp32linuxbase ./rebuild-esp32s3-linux-wifi.sh 42 | ``` 43 | 44 | Keep in mind that you should change the **--device** to your USB device where is connected the ESP32S3. For a different script please check the directory `esp32-linux-build`. This step takes around ~35 minutes and needs ~20Gb. 45 | 46 | After that you should have this message: 47 | 48 | ![ESP32S3 Linux finish build](screenshots/docker_build_before_flash.jpg) 49 | 50 | ## Flashing 51 | 52 | Press the enter keys for upload the different partitions **And that's it!** 53 | 54 | ![ESP32S3 Linux final flashing](screenshots/docker_flashing.jpg) 55 | 56 | Please check the output, you should have the flashed of **/etc** partition at the end (only in the first install), with a final message like this: 57 | 58 | ```bash 59 | Written contents of file 'build-buildroot-esp32s3/images/etc.jffs2' at offset 0xb0000 60 | ``` 61 | 62 | --- 63 | 64 | ### Troubleshotting 65 | 66 | If you have problems after step 4, with permissions on the serial device, please repeat this step and before to press the enter key, do the next steps: 67 | 68 | 1. Open a different terminal and enter to the running container: 69 | 70 | ```bash 71 | docker exec -it -u root esp32s3linux bash 72 | ``` 73 | 74 | 2. Change the docker USB device permissions: 75 | 76 | ```bash 77 | chmod 666 /dev/ttyACM0 78 | ``` 79 | 80 | 3. Return to the main terminal and perform the flashing. 81 | 82 | # Linux boot 83 | 84 | For run it in a TTGO T7 S3 (LilyGO board), you should have a FTDI connection to the UART like is showed in the photos below. Some dev boards have a second USB-C for this, then you could omit that. 85 | 86 | ![ESP32 S3 TTGO T7](https://user-images.githubusercontent.com/423856/249864617-08cf71ac-8773-4c3b-b5a3-d8912b5b9c05.jpg) 87 | 88 | 90 | 91 | For the complete details of features and current restrictions, please review the official [wiki](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3). 92 | 93 | ## WiFi settings 94 | 95 | Only add your credentials on `/etc/wpa_supplicant.conf` using `vi` editor or from the command line, like this: 96 | 97 | ```bash 98 | cat > /etc/wpa_supplicant.conf < /etc/cmdline 114 | ``` 115 | 116 | ### Provisional GPIO handling 117 | 118 | ```bash 119 | devmem 0x60004020 32 2 # (output enable for gpio1) 120 | devmem 0x60004004 32 2 # (drive gpio1 high) 121 | ``` 122 | 123 | For other GPIO be careful the syntax and the addressing, for instance for the LilyGO TTGO T7S3 board and its LED, the GPIO is the IO17, then you should be pass the number in hexadecimal, like this: 124 | 125 | ```bash 126 | devmem 0x60004020 32 0x20000 # (ouput enable for GPIO 17) 127 | devmem 0x60004004 32 0x20000 # (set GPIO 17 high) 128 | ``` 129 | 130 | Also you can enable the LED on the startup in a simple `inet.d` service: 131 | 132 | ![GPIO working via devmem](screenshots/gpio_via_devmem.jpg) 133 | 134 | Complete guide of GPIO implementation [here](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3:gpio) 135 | More info in the [technical document](https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf) of the ESP32S3. 136 | 137 | # Updates 138 | 139 | After the first build and flashing, you can keep the sources and working directories changing the `settings.cfg` file and repeating the steps from the step 4. Also don't forget update before, the git submodules like this: 140 | 141 | ```bash 142 | git submodule update --init --recursive 143 | ``` 144 | 145 | ## Possible settings 146 | 147 | Put `y` to enable some one or nothing to disable, like this: 148 | 149 | ```bash 150 | # keep_toolchain=y -- don't rebuild the toolchain, but rebuild everything else 151 | # keep_rootfs=y -- don't reconfigure or rebuild rootfs from scratch. Would still apply overlay changes 152 | # keep_buildroot=y -- don't redownload the buildroot, only git pull any updates into it 153 | # keep_bootloader=y -- don't redownload the bootloader, only rebuild it 154 | # keep_etc=y -- don't overwrite the /etc partition 155 | ``` 156 | 157 | For fast re-builds, fast updates and also keep your **etc** and its config files, for instance configure it like this: 158 | 159 | ```bash 160 | keep_toolchain=y 161 | keep_rootfs=y 162 | keep_buildroot=y 163 | keep_bootloader=y 164 | keep_etc=y 165 | ``` 166 | 167 | ## Clean 168 | 169 | For clean the working directories, please enter to `esp32-linux-build` and remove the build directory and rebuild with the settings with empty parameters. 170 | 171 | # TODO 172 | 173 | - [x] Migrate to the last script version with build parameters 174 | - [x] Freezing repositories to specific commit 175 | - [x] Add provisioning stuff (etc partition) 176 | - [x] Improve the flashing step. Fix issue #10 177 | 178 | # Credits 179 | 180 | Main script and initial idea: [@jcmvbkbc](https://gist.github.com/jcmvbkbc/316e6da728021c8ff670a24e674a35e6) 181 | [Official Wiki](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3) 182 | [Build process explained](https://gojimmypi.github.io/ESP32-S3-Linux/) 183 | English/Spanish [ESP32 Telegram group](https://t.me/esp_es) 184 | -------------------------------------------------------------------------------- /screenshots/docker_build.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hpsaturn/esp32s3-linux/b7ec8a77901cc6f0c9d06323aa953bd963206ac6/screenshots/docker_build.jpg -------------------------------------------------------------------------------- /screenshots/docker_build_before_flash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hpsaturn/esp32s3-linux/b7ec8a77901cc6f0c9d06323aa953bd963206ac6/screenshots/docker_build_before_flash.jpg -------------------------------------------------------------------------------- /screenshots/docker_flashing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hpsaturn/esp32s3-linux/b7ec8a77901cc6f0c9d06323aa953bd963206ac6/screenshots/docker_flashing.jpg -------------------------------------------------------------------------------- /screenshots/gpio_via_devmem.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hpsaturn/esp32s3-linux/b7ec8a77901cc6f0c9d06323aa953bd963206ac6/screenshots/gpio_via_devmem.jpg -------------------------------------------------------------------------------- /settings.cfg.default: -------------------------------------------------------------------------------- 1 | keep_toolchain= 2 | keep_rootfs= 3 | keep_buildroot= 4 | keep_bootloader= 5 | keep_etc= 6 | --------------------------------------------------------------------------------