diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml
new file mode 100644
index 0000000..4055ca0
--- /dev/null
+++ b/.github/workflows/build-image.yml
@@ -0,0 +1,220 @@
+name: Build Image
+
+on:
+ # push:
+ pull_request:
+ workflow_dispatch:
+
+jobs:
+ build-artifacts:
+ runs-on: ubuntu-latest
+ name: Build Bootloader
+ steps:
+ - uses: actions/checkout@v3
+ name: Checkout submodules
+ with:
+ submodules: "recursive"
+
+ - name: Prepare esp_driver
+ working-directory: esp-hosted/esp_hosted_ng/esp/esp_driver
+ run: |
+ cmake .
+
+ - name: Build esp_driver
+ working-directory: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter
+ run: |
+ . ../esp-idf/export.sh
+ idf.py set-target esp32s3
+ cp sdkconfig.defaults.esp32s3 sdkconfig
+ idf.py build
+
+ - name: Upload partition-table.bin
+ uses: actions/upload-artifact@v3
+ with:
+ name: partitions-table
+ path: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/partition_table/partition-table.bin
+
+ - name: Upload bootloader.bin
+ uses: actions/upload-artifact@v3
+ with:
+ name: bootloader
+ path: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/bootloader/bootloader.bin
+
+ - name: Upload network_adapter.bin
+ uses: actions/upload-artifact@v3
+ with:
+ name: firmware
+ path: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/network_adapter.bin
+
+ # create-release:
+ # runs-on: ubuntu-latest
+ # name: Create release
+ # steps:
+ # - uses: actions/checkout@v3
+
+ - uses: actions/create-release@latest
+ if: github.ref_type == 'tag'
+ name: Create Release
+ id: create_release
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ github.ref_name }}
+ release_name: Release ${{ github.ref_name }}
+ body: |
+ Created automatically on tag creation.
+ Download all files into the same folder and run ./flash-all.sh script.
+ Connect ESP32-S3 board to any USB port prior to running script.
+ draft: false
+ prerelease: false
+
+ - name: Upload partition-table.bin to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-binary
+ asset_name: partition-table.bin
+ asset_path: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/partition_table/partition-table.bin
+
+ - name: Upload bootloader.bin to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-binary
+ asset_name: bootloader.bin
+ asset_path: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/bootloader/bootloader.bin
+
+ - name: Upload network_adapter.bin to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-binary
+ asset_name: network_adapter.bin
+ asset_path: esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/network_adapter.bin
+
+ # build-image:
+ # runs-on: ubuntu-latest
+ # name: Build Image
+ # steps:
+
+ - uses: awalsh128/cache-apt-pkgs-action@latest
+ with:
+ packages: help2man libtool-bin ninja-build
+ version: 1.0
+
+ - uses: actions/checkout@v3
+ name: Checkout submodules
+ with:
+ submodules: "recursive"
+
+ - name: Build dynconfig
+ run: |
+ make -C xtensa-dynconfig ORIG=1 CONF_DIR=`pwd` esp32s3.so
+
+ - name: Build crosstoll-NG
+ working-directory: crosstool-NG
+ run: |
+ ./bootstrap && ./configure --enable-local && make
+
+ - name: Prepare toolchain build
+ working-directory: crosstool-NG
+ run: |
+ ./ct-ng xtensa-esp32s3-linux-uclibcfdpic
+ sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config
+
+ - name: Build toolchain
+ working-directory: crosstool-NG
+ continue-on-error: true
+ run: |
+ CT_PREFIX=`pwd`/builds XTENSA_GNU_CONFIG=`pwd`/../xtensa-dynconfig/esp32s3.so ./ct-ng build --quiet
+
+ - name: Upload toolchain build log
+ uses: actions/upload-artifact@v3
+ with:
+ name: toolchain-build.log
+ path: |
+ crosstool-NG/build.log
+ crosstool-NG/.config
+ if: failure()
+
+ - name: Configure buildroot
+ run: |
+ make -C buildroot O=`pwd`/build-buildroot-esp32s3 esp32s3_defconfig
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PATH `pwd`/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+
+ - name: Build buildroot
+ run: |
+ XTENSA_GNU_CONFIG=`pwd`/xtensa-dynconfig/esp32s3.so make -C buildroot O=`pwd`/build-buildroot-esp32s3
+
+ - name: Upload xipImage
+ uses: actions/upload-artifact@v3
+ with:
+ name: xipImage
+ path: build-buildroot-esp32s3/images/xipImage
+
+ - name: Upload rootfs
+ uses: actions/upload-artifact@v3
+ with:
+ name: rootfs.cramfs
+ path: build-buildroot-esp32s3/images/rootfs.cramfs
+
+ - name: Upload etc.jffs2
+ uses: actions/upload-artifact@v3
+ with:
+ name: etc.jffs2
+ path: build-buildroot-esp32s3/images/etc.jffs2
+
+ - name: Upload linux-kernel to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-binary
+ asset_name: xipImage
+ asset_path: build-buildroot-esp32s3/images/xipImage
+
+ - name: Upload rootfs.cramfs to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-binary
+ asset_name: rootfs.cramfs
+ asset_path: build-buildroot-esp32s3/images/rootfs.cramfs
+
+ - name: Upload etc.jffs2 to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-binary
+ asset_name: etc.jffs2
+ asset_path: build-buildroot-esp32s3/images/etc.jffs2
+
+ - name: Upload flash-all.sh to release
+ if: github.ref_type == 'tag'
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_content_type: application/x-sh
+ asset_name: flash-all.sh
+ asset_path: output/flash-all.sh
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6b70588
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+autoconf-2.71/
+autoconf-2.71.tar.xz
+build-buildroot-esp32s3/
+output/*.bin
+output/xipImage
+output/rootfs.cramfs
+output/etc.jffs2
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..3b4c208
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,24 @@
+[submodule "xtensa-dynconfig"]
+ path = xtensa-dynconfig
+ url = https://github.com/jcmvbkbc/xtensa-dynconfig
+ branch = original
+[submodule "config-esp32s3"]
+ path = esp32s3
+ url = https://github.com/jcmvbkbc/config-esp32s3
+ branch = master
+[submodule "crosstool-NG"]
+ path = crosstool-NG
+ url = https://github.com/jcmvbkbc/crosstool-NG.git
+ branch = xtensa-fdpic
+[submodule "buildroot"]
+ path = buildroot
+ url = https://github.com/jcmvbkbc/buildroot
+ branch = xtensa-2023.08-fdpic
+[submodule "esp-hosted"]
+ path = esp-hosted
+ url = https://github.com/jcmvbkbc/esp-hosted
+ branch = ipc
+[submodule "esp-idf"]
+ path = esp-idf
+ url = https://github.com/jcmvbkbc/esp-idf
+ branch = linux-5.0.
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..744b214
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,14 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "bashdb",
+ "request": "launch",
+ "name": "Bash-Debug (simplest configuration)",
+ "program": "${file}"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..84ec73b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,6 @@
+{
+ "git.ignoredRepositories": [
+ "./esp-idf"
+ ],
+ "git.autoRepositoryDetection": "openEditors"
+}
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cc4abc5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,38 @@
+# ESP32-S3 Linux Build scripts and Web Installer
+
+This is a set of build scripts and web installer for [Linux on ESP32-S3](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3).
+
+[Visit web-installer page](https://anabolyc.github.io/esp32-linux-build/)
+
+## Disclaimer
+
+I'm not the author of this code. [Max Filippov](https://github.com/jcmvbkbc) is. But I admired his work so much, so I decided to add by 5 cents to it. Specifically
+
+- Added submodules for better dependencies tracking and better build stability
+- Added build pipeline, so anyone would have a reference build
+- Added release pipeline, so if you don't fancy building it yourself, can just pick up binaries
+- Finally, added web-installer, so you can flash to your ESP32-S3 board it with no tools but modern browser
+
+Hope that will help others to follow authors steps.
+
+## Links
+
+- [Docs](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3)
+- [Write-up](https://habr.com/en/articles/736408/) (Russian)
+- [Write-up](https://gojimmypi.github.io/ESP32-S3-Linux/) (English)
+
+## Code references
+
+- [xtensa-dynconfig](https://github.com/jcmvbkbc/xtensa-dynconfig/tree/original)
+- [config-esp32s3](https://github.com/jcmvbkbc/config-esp32s3)
+- [esp-idf](https://github.com/jcmvbkbc/esp-idf/tree/linux-5.0.1)
+- [linux-xtensa](https://github.com/jcmvbkbc/linux-xtensa/tree/xtensa-6.4-esp32)
+- [binutils-gdb-xtensa](https://github.com/jcmvbkbc/binutils-gdb-xtensa/tree/xtensa-2.40-fdpic)
+- [gcc-xtensa](https://github.com/jcmvbkbc/gcc-xtensa/tree/xtensa-14-fdpic)
+- [uclibc-ng-xtensa](https://github.com/jcmvbkbc/uclibc-ng-xtensa/tree/xtensa-fdpic)
+- [buildroot](https://github.com/jcmvbkbc/buildroot/tree/xtensa-2023.08-fdpic)
+- [crosstool-NG](https://github.com/jcmvbkbc/crosstool-NG/tree/xtensa-fdpic)
+
+## Demo
+
+
\ No newline at end of file
diff --git a/buildroot b/buildroot
new file mode 160000
index 0000000..1529ad8
--- /dev/null
+++ b/buildroot
@@ -0,0 +1 @@
+Subproject commit 1529ad84a32d23d4937e88996a0883fdb526b944
diff --git a/crosstool-NG b/crosstool-NG
new file mode 160000
index 0000000..c29b568
--- /dev/null
+++ b/crosstool-NG
@@ -0,0 +1 @@
+Subproject commit c29b56869c9e427aa9dd6995f53c2f8a1246df29
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..7e2be92
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,22 @@
+# ESP32-S3 Linux Installer
+
+This is a demo installer website for [Linux on ESP32-S3](http://wiki.osll.ru/doku.php/etc:users:jcmvbkbc:linux-xtensa:esp32s3).
+
+[Visit web-installer page](https://anabolyc.github.io/esp32-linux-build/)
+
+## Requirements
+
+
Some boards require manual download mode triggering, by pressing resetting the board while pressing IO0 button
+If your board has two USB ports, you might need to use both. One for flashing, other to see Linux serial output
+
+## Demo
+
+
\ No newline at end of file
diff --git a/docs/firmware/bootloader.bin b/docs/firmware/bootloader.bin
new file mode 100644
index 0000000..c6b8496
Binary files /dev/null and b/docs/firmware/bootloader.bin differ
diff --git a/docs/firmware/etc.jffs2 b/docs/firmware/etc.jffs2
new file mode 100644
index 0000000..4cce5c3
Binary files /dev/null and b/docs/firmware/etc.jffs2 differ
diff --git a/docs/firmware/network_adapter.bin b/docs/firmware/network_adapter.bin
new file mode 100644
index 0000000..3266e50
Binary files /dev/null and b/docs/firmware/network_adapter.bin differ
diff --git a/docs/firmware/partition-table.bin b/docs/firmware/partition-table.bin
new file mode 100644
index 0000000..746911f
Binary files /dev/null and b/docs/firmware/partition-table.bin differ
diff --git a/docs/firmware/rootfs.cramfs b/docs/firmware/rootfs.cramfs
new file mode 100644
index 0000000..09336c4
Binary files /dev/null and b/docs/firmware/rootfs.cramfs differ
diff --git a/docs/firmware/xipImage b/docs/firmware/xipImage
new file mode 100644
index 0000000..bc77f3b
Binary files /dev/null and b/docs/firmware/xipImage differ
diff --git a/docs/img/Screencast from 28.10.2023 21:54:48.gif b/docs/img/Screencast from 28.10.2023 21:54:48.gif
new file mode 100644
index 0000000..269ddc3
Binary files /dev/null and b/docs/img/Screencast from 28.10.2023 21:54:48.gif differ
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..5258254
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,120 @@
+
+
+
+
+
ESP32-S3 Linux installer
+
This is a web installer for Linux running on ESP32-S3. More information can be found here.
+
Requirements
+
+ - ESP32-S3 SoC, this board for example
+ - 8MB Flash (-N8)
+ - 8MB PSRAM (-R8)
+
+
Select your option
+
+
+
+
+
Notes
+
Some boards require manual download mode triggering, by pressing resetting the board while pressing IO0 button
+
If your board has two USB ports, you might need to use both. One for flashing, other to see Linux serial output
+
Demo
+

+
+
+
+
diff --git a/docs/manifest-full-8.json b/docs/manifest-full-8.json
new file mode 100644
index 0000000..d112b7c
--- /dev/null
+++ b/docs/manifest-full-8.json
@@ -0,0 +1,17 @@
+{
+ "name": "Linux on ESP32-S3",
+ "version": "1.0",
+ "builds": [
+ {
+ "chipFamily": "ESP32-S3",
+ "parts": [
+ { "path": "firmware/bootloader.bin", "offset": 0 },
+ { "path": "firmware/partition-table.bin", "offset": 32768 },
+ { "path": "firmware/network_adapter.bin", "offset": 65536 },
+ { "path": "firmware/etc.jffs2", "offset": 720896 },
+ { "path": "firmware/xipImage", "offset": 1179648 },
+ { "path": "firmware/rootfs.cramfs", "offset": 4718592 }
+ ]
+ }
+ ]
+}
diff --git a/docs/manifest-partial-8.json b/docs/manifest-partial-8.json
new file mode 100644
index 0000000..f0fa255
--- /dev/null
+++ b/docs/manifest-partial-8.json
@@ -0,0 +1,16 @@
+{
+ "name": "Linux on ESP32-S3",
+ "version": "1.0",
+ "builds": [
+ {
+ "chipFamily": "ESP32-S3",
+ "parts": [
+ { "path": "firmware/bootloader.bin", "offset": 0 },
+ { "path": "firmware/partition-table.bin", "offset": 32768 },
+ { "path": "firmware/network_adapter.bin", "offset": 65536 },
+ { "path": "firmware/xipImage", "offset": 1179648 },
+ { "path": "firmware/rootfs.cramfs", "offset": 4718592 }
+ ]
+ }
+ ]
+}
diff --git a/esp-hosted b/esp-hosted
new file mode 160000
index 0000000..328b5b9
--- /dev/null
+++ b/esp-hosted
@@ -0,0 +1 @@
+Subproject commit 328b5b9d29fe0a2e1b2d8176ab61b113f660d9bb
diff --git a/esp-idf b/esp-idf
new file mode 160000
index 0000000..fc1671b
--- /dev/null
+++ b/esp-idf
@@ -0,0 +1 @@
+Subproject commit fc1671b3cd3146b0fc32fb9076a69e1abddd2226
diff --git a/esp32s3 b/esp32s3
new file mode 160000
index 0000000..f595d86
--- /dev/null
+++ b/esp32s3
@@ -0,0 +1 @@
+Subproject commit f595d8653421eedced6bbe8f7822783d2fe2716d
diff --git a/output/flash-all.sh b/output/flash-all.sh
new file mode 100755
index 0000000..49f44f1
--- /dev/null
+++ b/output/flash-all.sh
@@ -0,0 +1,32 @@
+#! /bin/bash -x
+
+# KEEP_ETC=y
+
+SET_BAUDRATE='-b 460800'
+
+pushd esp-hosted/esp_hosted_ng/esp/esp_driver/esp-idf
+alias python='python3'
+. export.sh
+
+popd
+cd output
+
+#
+# flash wifi-driver
+#
+esptool.py $SET_BAUDRATE --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 8MB 0x0 bootloader.bin 0x10000 network_adapter.bin 0x8000 partition-table.bin
+
+#
+# flash partitions
+#
+parttool.py $SET_BAUDRATE write_partition --partition-name linux --input xipImage
+parttool.py $SET_BAUDRATE write_partition --partition-name rootfs --input rootfs.cramfs
+if [ -z $KEEP_ETC ] ; then
+ # read -p 'ready to flash /etc... press enter'
+ parttool.py $SET_BAUDRATE write_partition --partition-name etc --input etc.jffs2
+fi
+
+#
+# monitor
+#
+# idf.py monitor
\ No newline at end of file
diff --git a/rebuild-esp32s3-linux-wifi.sh b/rebuild-esp32s3-linux-wifi.sh
index 3682909..a5d9e6e 100755
--- a/rebuild-esp32s3-linux-wifi.sh
+++ b/rebuild-esp32s3-linux-wifi.sh
@@ -1,110 +1,69 @@
#! /bin/bash -x
-#
-# environment variables affecting the build:
-#
-# keep_toolchain=y -- don't rebuild the toolchain, but rebuild everything else
-# keep_rootfs=y -- don't reconfigure or rebuild rootfs from scratch. Would still apply overlay changes
-# keep_buildroot=y -- don't redownload the buildroot, only git pull any updates into it
-# keep_bootloader=y -- don't redownload the bootloader, only rebuild it
-# keep_etc=y -- don't overwrite the /etc partition
-#
-
-SET_BAUDRATE='-b 2000000'
+# REBUILD_TOOLCHAIN=y
+# REBUILD_KERNEL_ROOTFS=y
+# REBUILD_BOOTLOADER=y
-CTNG_VER=xtensa-fdpic
CTNG_CONFIG=xtensa-esp32s3-linux-uclibcfdpic
-BUILDROOT_VER=xtensa-2023.08-fdpic
BUILDROOT_CONFIG=esp32s3_defconfig
-ESP_HOSTED_VER=ipc
ESP_HOSTED_CONFIG=sdkconfig.defaults.esp32s3
-if [ ! -d autoconf-2.71/root/bin ] ; then
- wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz
- tar -xf autoconf-2.71.tar.xz
- pushd autoconf-2.71
- ./configure --prefix=`pwd`/root
- make && make install
- popd
-fi
-export PATH=`pwd`/autoconf-2.71/root/bin:$PATH
-
-if [ -z "$keep_toolchain$keep_buildroot$keep_rootfs$keep_bootloader" ] ; then
- rm -rf build
-else
- [ -n "$keep_rootfs" ] || rm -rf build/build-buildroot-esp32s3
- [ -n "$keep_buildroot" ] || rm -rf build/buildroot
- [ -n "$keep_bootloader" ] || rm -rf build/esp-hosted
-fi
-mkdir -p build
-cd build
-
#
# dynconfig
#
if [ ! -f xtensa-dynconfig/esp32s3.so ] ; then
- git clone https://github.com/jcmvbkbc/xtensa-dynconfig -b original
- git clone https://github.com/jcmvbkbc/config-esp32s3 esp32s3
make -C xtensa-dynconfig ORIG=1 CONF_DIR=`pwd` esp32s3.so
fi
export XTENSA_GNU_CONFIG=`pwd`/xtensa-dynconfig/esp32s3.so
#
-# toolchain
+# Build toolchain
#
-if [ ! -x crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] ; then
- git clone https://github.com/jcmvbkbc/crosstool-NG.git -b $CTNG_VER
+if [ ! -z $REBUILD_TOOLCHAIN ] || [ ! -x crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] ; then
pushd crosstool-NG
./bootstrap && ./configure --enable-local && make
./ct-ng $CTNG_CONFIG
- CT_PREFIX=`pwd`/builds nice ./ct-ng build
+ sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config
+ CT_PREFIX=`pwd`/builds ./ct-ng build
popd
[ -x crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] || exit 1
fi
#
-# kernel and rootfs
-#
-if [ ! -d buildroot ] ; then
- git clone https://github.com/jcmvbkbc/buildroot -b $BUILDROOT_VER
-else
- pushd buildroot
- git pull
- popd
-fi
-if [ ! -d build-buildroot-esp32s3 ] ; then
- nice make -C buildroot O=`pwd`/build-buildroot-esp32s3 $BUILDROOT_CONFIG
- buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PATH `pwd`/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic
- buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
- buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+# kernel and rootfs (buildroot)
+#
+if [ ! -z $REBUILD_KERNEL_ROOTFS ] || [ ! -f build-buildroot-esp32s3/images/xipImage ] || [ ! -f build-buildroot-esp32s3/images/rootfs.cramfs ] || [ ! -f build-buildroot-esp32s3/images/etc.jffs2 ] ; then
+ if [ ! -d build-buildroot-esp32s3 ] ; then
+ make -C buildroot O=`pwd`/build-buildroot-esp32s3 $BUILDROOT_CONFIG
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PATH `pwd`/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+ fi
+ make -C buildroot O=`pwd`/build-buildroot-esp32s3
+ [ -f build-buildroot-esp32s3/images/xipImage -a -f build-buildroot-esp32s3/images/rootfs.cramfs -a -f build-buildroot-esp32s3/images/etc.jffs2 ] || exit 1
fi
-nice make -C buildroot O=`pwd`/build-buildroot-esp32s3
-[ -f build-buildroot-esp32s3/images/xipImage -a -f build-buildroot-esp32s3/images/rootfs.cramfs -a -f build-buildroot-esp32s3/images/etc.jffs2 ] || exit 1
#
# bootloader
#
-[ -d esp-hosted ] || git clone https://github.com/jcmvbkbc/esp-hosted -b $ESP_HOSTED_VER
pushd esp-hosted/esp_hosted_ng/esp/esp_driver
-cmake .
-cd esp-idf
-. export.sh
-cd ../network_adapter
-idf.py set-target esp32s3
-cp $ESP_HOSTED_CONFIG sdkconfig
-idf.py build
-read -p 'ready to flash... press enter'
-while ! idf.py $SET_BAUDRATE flash ; do
- read -p 'failure... press enter to try again'
-done
+if [ ! -z $REBUILD_BOOTLOADER ] || [ ! -f ./network_adapter/build/network_adapter.bin ] || [ ! -f ./network_adapter/build/partition_table/partition-table.bin ] || [ ! -f ./network_adapter/build/bootloader/bootloader.bin ] ; then
+ cmake .
+ alias python='python3'
+ cd esp-idf
+ . export.sh
+ cd ../network_adapter
+ idf.py set-target esp32s3
+ cp $ESP_HOSTED_CONFIG sdkconfig
+ idf.py build
+fi
popd
#
-# flash
+# publish artifacts
#
-parttool.py $SET_BAUDRATE write_partition --partition-name linux --input build-buildroot-esp32s3/images/xipImage
-parttool.py $SET_BAUDRATE write_partition --partition-name rootfs --input build-buildroot-esp32s3/images/rootfs.cramfs
-if [ -z "$keep_etc" ] ; then
- read -p 'ready to flash /etc... press enter'
- parttool.py $SET_BAUDRATE write_partition --partition-name etc --input build-buildroot-esp32s3/images/etc.jffs2
-fi
+cp -v esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/bootloader/bootloader.bin ./output
+cp -v esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/partition_table/partition-table.bin ./output
+cp -v esp-hosted/esp_hosted_ng/esp/esp_driver/network_adapter/build/network_adapter.bin ./output
+
+cp -rv build-buildroot-esp32s3/images/* ./output
\ No newline at end of file
diff --git a/rebuild-esp32s3-linux.sh b/rebuild-esp32s3-linux.sh
index e0709bc..03f9ec8 100755
--- a/rebuild-esp32s3-linux.sh
+++ b/rebuild-esp32s3-linux.sh
@@ -1,63 +1,67 @@
#! /bin/bash -x
-if [ ! -d autoconf-2.71/root/bin ] ; then
- wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz
- tar -xf autoconf-2.71.tar.xz
- pushd autoconf-2.71
- ./configure --prefix=`pwd`/root
- make && make install
- popd
-fi
-export PATH=`pwd`/autoconf-2.71/root/bin:$PATH
-rm -rf build
-mkdir build && cd build
+# REBUILD_TOOLCHAIN=y
+# REBUILD_KERNEL_ROOTFS=y
+# REBUILD_BOOTLOADER=y
+
+CTNG_CONFIG=xtensa-esp32s3-linux-uclibcfdpic
+BUILDROOT_CONFIG=esp32s3_defconfig
+ESP_HOSTED_CONFIG=sdkconfig.defaults.esp32s3
#
# dynconfig
#
-git clone https://github.com/jcmvbkbc/xtensa-dynconfig -b original
-git clone https://github.com/jcmvbkbc/config-esp32s3 esp32s3
-make -C xtensa-dynconfig ORIG=1 CONF_DIR=`pwd` esp32s3.so
+if [ ! -f xtensa-dynconfig/esp32s3.so ] ; then
+ make -C xtensa-dynconfig ORIG=1 CONF_DIR=`pwd` esp32s3.so
+fi
export XTENSA_GNU_CONFIG=`pwd`/xtensa-dynconfig/esp32s3.so
#
-# toolchain
+# Build toolchain
#
-git clone https://github.com/jcmvbkbc/crosstool-NG.git -b xtensa-fdpic
-pushd crosstool-NG
-./bootstrap && ./configure --enable-local && make
-./ct-ng xtensa-esp32s3-linux-uclibcfdpic
-CT_PREFIX=`pwd`/builds nice ./ct-ng build
-popd
-[ -e crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] || exit 1
+if [ ! -z $REBUILD_TOOLCHAIN ] || [ ! -x crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] ; then
+ pushd crosstool-NG
+ ./bootstrap && ./configure --enable-local && make
+ ./ct-ng $CTNG_CONFIG
+ sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config
+ CT_PREFIX=`pwd`/builds ./ct-ng build
+ popd
+ [ -x crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic/bin/xtensa-esp32s3-linux-uclibcfdpic-gcc ] || exit 1
+fi
#
-# kernel and rootfs
+# kernel and rootfs (buildroot)
#
-git clone https://github.com/jcmvbkbc/buildroot -b xtensa-2023.02-fdpic
-nice make -C buildroot O=`pwd`/build-xtensa-2023.02-fdpic-esp32s3 esp32s3_defconfig
-buildroot/utils/config --file build-xtensa-2023.02-fdpic-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PATH `pwd`/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic
-buildroot/utils/config --file build-xtensa-2023.02-fdpic-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
-buildroot/utils/config --file build-xtensa-2023.02-fdpic-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
-nice make -C buildroot O=`pwd`/build-xtensa-2023.02-fdpic-esp32s3
-[ -f build-xtensa-2023.02-fdpic-esp32s3/images/xipImage -a -f build-xtensa-2023.02-fdpic-esp32s3/images/rootfs.cramfs ] || exit 1
+if [ ! -z $REBUILD_KERNEL_ROOTFS ] || [ ! -f build-buildroot-esp32s3/images/xipImage ] || [ ! -f build-buildroot-esp32s3/images/rootfs.cramfs ] || [ ! -f build-buildroot-esp32s3/images/etc.jffs2 ] ; then
+ if [ ! -d build-buildroot-esp32s3 ] ; then
+ make -C buildroot O=`pwd`/build-buildroot-esp32s3 $BUILDROOT_CONFIG
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PATH `pwd`/crosstool-NG/builds/xtensa-esp32s3-linux-uclibcfdpic
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+ buildroot/utils/config --file build-buildroot-esp32s3/.config --set-str TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX '$(ARCH)-esp32s3-linux-uclibcfdpic'
+ fi
+ make -C buildroot O=`pwd`/build-buildroot-esp32s3
+ [ -f build-buildroot-esp32s3/images/xipImage -a -f build-buildroot-esp32s3/images/rootfs.cramfs -a -f build-buildroot-esp32s3/images/etc.jffs2 ] || exit 1
+fi
#
# bootloader
#
-git clone https://github.com/jcmvbkbc/esp-idf -b linux-5.0.1
pushd esp-idf
-. export.sh
-cd examples/get-started/linux_boot
-idf.py set-target esp32s3
-cp sdkconfig.defaults.esp32s3 sdkconfig
-idf.py build
-read -p 'ready to flash... press enter'
-idf.py flash
+if [ ! -z $REBUILD_BOOTLOADER ] || [ ! -f ./examples/get-started/linux_boot/build/linux_boot.bin ] || [ ! -f ./examples/get-started/linux_boot/build/partition_table/partition-table.bin ] || [ ! -f ./examples/get-started/linux_boot/build/bootloader/bootloader.bin ] ; then
+ alias python='python3'
+ . export.sh
+ cd examples/get-started/linux_boot
+ idf.py set-target esp32s3
+ cp $ESP_HOSTED_CONFIG sdkconfig
+ idf.py build
+fi
popd
#
-# flash
+# publish artifacts
#
-parttool.py write_partition --partition-name linux --input build-xtensa-2023.02-fdpic-esp32s3/images/xipImage
-parttool.py write_partition --partition-name rootfs --input build-xtensa-2023.02-fdpic-esp32s3/images/rootfs.cramfs
+cp -v esp-idf/examples/get-started/linux_boot/build/bootloader/bootloader.bin ./output
+cp -v esp-idf/examples/get-started/linux_boot/build/partition_table/partition-table.bin ./output
+cp -v esp-idf/examples/get-started/linux_boot/build/linux_boot.bin ./output
+
+cp -rv build-buildroot-esp32s3/images/* ./output
\ No newline at end of file
diff --git a/xtensa-dynconfig b/xtensa-dynconfig
new file mode 160000
index 0000000..6615c33
--- /dev/null
+++ b/xtensa-dynconfig
@@ -0,0 +1 @@
+Subproject commit 6615c332f41ab2169bd68ff289c351181251a6fc