initial commit
This commit is contained in:
92
libraries/FastLED/ci/dockerfiles/Dockerfile.qemu-esp32-lite
Normal file
92
libraries/FastLED/ci/dockerfiles/Dockerfile.qemu-esp32-lite
Normal file
@@ -0,0 +1,92 @@
|
||||
# Lightweight Dockerfile for ESP32 QEMU emulation
|
||||
# Uses pre-built QEMU binaries without full ESP-IDF
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
# Install minimal dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget \
|
||||
xz-utils \
|
||||
python3 \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install esptool for flash image creation
|
||||
RUN pip3 install --no-cache-dir esptool
|
||||
|
||||
# Create workspace
|
||||
WORKDIR /workspace
|
||||
|
||||
# Download and install ESP32 QEMU binaries
|
||||
ENV QEMU_VERSION=esp-develop-8.2.0-20240122
|
||||
RUN mkdir -p /opt/qemu && \
|
||||
cd /opt/qemu && \
|
||||
wget -q https://github.com/espressif/qemu/releases/download/${QEMU_VERSION}/qemu-xtensa-softmmu-${QEMU_VERSION}-x86_64-linux-gnu.tar.xz && \
|
||||
tar -xf qemu-xtensa-softmmu-${QEMU_VERSION}-x86_64-linux-gnu.tar.xz && \
|
||||
rm qemu-xtensa-softmmu-${QEMU_VERSION}-x86_64-linux-gnu.tar.xz && \
|
||||
mv qemu /usr/local/
|
||||
|
||||
# Add QEMU to PATH
|
||||
ENV PATH=/usr/local/qemu/bin:$PATH
|
||||
|
||||
# Download ESP32 ROM files
|
||||
RUN mkdir -p /opt/esp-rom && \
|
||||
cd /opt/esp-rom && \
|
||||
wget -q https://github.com/espressif/qemu/raw/esp-develop/pc-bios/esp32-v3-rom.bin && \
|
||||
wget -q https://github.com/espressif/qemu/raw/esp-develop/pc-bios/esp32c3-rom.bin && \
|
||||
wget -q https://github.com/espressif/qemu/raw/esp-develop/pc-bios/esp32s2-rom.bin && \
|
||||
wget -q https://github.com/espressif/qemu/raw/esp-develop/pc-bios/esp32s3-rom.bin
|
||||
|
||||
# Set ROM path environment variable
|
||||
ENV ESP_ROM_PATH=/opt/esp-rom
|
||||
|
||||
# Create entrypoint script
|
||||
RUN cat > /entrypoint.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Default values
|
||||
FIRMWARE=${FIRMWARE:-/workspace/firmware.bin}
|
||||
MACHINE=${MACHINE:-esp32}
|
||||
FLASH_SIZE=${FLASH_SIZE:-4}
|
||||
TIMEOUT=${TIMEOUT:-30}
|
||||
|
||||
# Select ROM based on machine type
|
||||
case "$MACHINE" in
|
||||
esp32) ROM_FILE=/opt/esp-rom/esp32-v3-rom.bin ;;
|
||||
esp32c3) ROM_FILE=/opt/esp-rom/esp32c3-rom.bin ;;
|
||||
esp32s2) ROM_FILE=/opt/esp-rom/esp32s2-rom.bin ;;
|
||||
esp32s3) ROM_FILE=/opt/esp-rom/esp32s3-rom.bin ;;
|
||||
*) echo "Unknown machine: $MACHINE"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Check if firmware exists
|
||||
if [ ! -f "$FIRMWARE" ]; then
|
||||
echo "ERROR: Firmware not found: $FIRMWARE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create flash image
|
||||
FLASH_IMG=/tmp/flash.bin
|
||||
dd if=/dev/zero of=$FLASH_IMG bs=1M count=$FLASH_SIZE 2>/dev/null
|
||||
dd if=$FIRMWARE of=$FLASH_IMG bs=1 seek=$((0x10000)) conv=notrunc 2>/dev/null
|
||||
|
||||
# Run QEMU with timeout
|
||||
timeout $TIMEOUT qemu-system-xtensa \
|
||||
-nographic \
|
||||
-machine $MACHINE \
|
||||
-bios $ROM_FILE \
|
||||
-drive file=$FLASH_IMG,if=mtd,format=raw \
|
||||
-global driver=timer.esp32.timg,property=wdt_disable,value=true \
|
||||
"$@"
|
||||
EOF
|
||||
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Set entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Labels
|
||||
LABEL maintainer="FastLED Team"
|
||||
LABEL description="Lightweight ESP32 QEMU Docker image"
|
||||
LABEL version="1.0.0"
|
||||
Reference in New Issue
Block a user