Skip to content

Commit 314bf7f

Browse files
Copilotsofthack007
andcommitted
Fix QEMU download URL - update to esp-develop-9.2.2-20250817
The old URL (esp-develop-20220919) was returning 404 errors. Updated to use the latest stable release with correct URL format: - Release tag includes date suffix (esp-develop-9.2.2-20250817) - File path includes version in filename - Binary location changed to bin/qemu-system-xtensa - Added fallback URLs for older versions - Added symlink creation for backward compatibility Co-authored-by: softhack007 <[email protected]>
1 parent 98accba commit 314bf7f

File tree

2 files changed

+78
-22
lines changed

2 files changed

+78
-22
lines changed

.github/scripts/run-qemu.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ if [ ! -d "$FIRMWARE_DIR" ]; then
1313
exit 1
1414
fi
1515

16-
if [ ! -f "${QEMU_DIR}/qemu-system-xtensa" ]; then
17-
echo "Error: QEMU not found at ${QEMU_DIR}/qemu-system-xtensa"
16+
if [ ! -f "${QEMU_DIR}/qemu-system-xtensa" ] && [ ! -f "${QEMU_DIR}/bin/qemu-system-xtensa" ]; then
17+
echo "Error: QEMU not found at ${QEMU_DIR}/qemu-system-xtensa or ${QEMU_DIR}/bin/qemu-system-xtensa"
1818
echo "Please run setup-qemu.sh first"
1919
exit 1
2020
fi
2121

22+
# Determine QEMU binary location
23+
if [ -f "${QEMU_DIR}/qemu-system-xtensa" ]; then
24+
QEMU_BIN="${QEMU_DIR}/qemu-system-xtensa"
25+
else
26+
QEMU_BIN="${QEMU_DIR}/bin/qemu-system-xtensa"
27+
fi
28+
2229
# Check for required firmware files
2330
BOOTLOADER="${FIRMWARE_DIR}/bootloader.bin"
2431
PARTITIONS="${FIRMWARE_DIR}/partitions.bin"
@@ -64,7 +71,7 @@ echo "Flash image created successfully"
6471
# Note: ESP32 in QEMU has limited peripheral support
6572
# Network configuration uses user-mode networking with port forwarding
6673
echo "Starting QEMU..."
67-
${QEMU_DIR}/qemu-system-xtensa \
74+
${QEMU_BIN} \
6875
-nographic \
6976
-machine esp32 \
7077
-drive file=${FLASH_IMAGE},if=mtd,format=raw \

.github/scripts/setup-qemu.sh

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,82 @@
44

55
set -e
66

7-
QEMU_VERSION="esp-develop-20220919"
8-
QEMU_URL="https://github.com/espressif/qemu/releases/download/${QEMU_VERSION}/qemu-${QEMU_VERSION}-x86_64-linux-gnu.tar.xz"
97
QEMU_DIR="qemu-esp32"
108

119
echo "Setting up QEMU ESP32..."
1210

1311
# Create directory for QEMU
1412
mkdir -p ${QEMU_DIR}
1513

16-
# Download QEMU ESP32 if not already present
17-
if [ ! -f "${QEMU_DIR}/qemu-system-xtensa" ]; then
18-
echo "Downloading QEMU ESP32 from ${QEMU_URL}..."
19-
wget -q ${QEMU_URL} -O qemu.tar.xz
20-
21-
echo "Extracting QEMU..."
22-
tar -xf qemu.tar.xz -C ${QEMU_DIR} --strip-components=1
23-
24-
# Cleanup
25-
rm qemu.tar.xz
26-
27-
echo "QEMU ESP32 installed successfully"
28-
else
14+
# Check if QEMU is already installed
15+
if [ -f "${QEMU_DIR}/qemu-system-xtensa" ]; then
2916
echo "QEMU ESP32 already installed"
17+
echo "QEMU binary: ${QEMU_DIR}/qemu-system-xtensa"
18+
exit 0
3019
fi
3120

32-
# Make QEMU executable
33-
chmod +x ${QEMU_DIR}/qemu-system-xtensa
21+
# Try multiple QEMU sources in order of preference
22+
echo "Attempting to download QEMU ESP32..."
3423

35-
echo "QEMU ESP32 setup complete"
36-
echo "QEMU binary: ${QEMU_DIR}/qemu-system-xtensa"
24+
# List of potential QEMU download URLs to try
25+
# Using the latest stable releases from Espressif
26+
QEMU_URLS=(
27+
"esp-develop-9.2.2-20250817|https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz"
28+
"esp-develop-9.1.0-20240606|https://github.com/espressif/qemu/releases/download/esp-develop-9.1.0-20240606/qemu-xtensa-softmmu-esp_develop_9.1.0_20240606-x86_64-linux-gnu.tar.xz"
29+
"esp-develop-9.0.0-20231220|https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20231220/qemu-xtensa-softmmu-esp_develop_9.0.0_20231220-x86_64-linux-gnu.tar.xz"
30+
)
31+
32+
DOWNLOAD_SUCCESS=false
33+
34+
for ENTRY in "${QEMU_URLS[@]}"; do
35+
VERSION="${ENTRY%%|*}"
36+
URL="${ENTRY##*|}"
37+
38+
echo "Trying version ${VERSION}..."
39+
echo "URL: ${URL}"
40+
41+
if wget --spider -q "${URL}" 2>/dev/null; then
42+
echo "Found available version: ${VERSION}"
43+
echo "Downloading from ${URL}..."
44+
45+
if wget -q "${URL}" -O qemu.tar.xz; then
46+
echo "Download successful, extracting..."
47+
if tar -xf qemu.tar.xz -C ${QEMU_DIR} --strip-components=1; then
48+
rm qemu.tar.xz
49+
DOWNLOAD_SUCCESS=true
50+
echo "QEMU ESP32 version ${VERSION} installed successfully"
51+
break
52+
else
53+
echo "Extraction failed, trying next source..."
54+
rm -f qemu.tar.xz
55+
fi
56+
else
57+
echo "Download failed, trying next source..."
58+
rm -f qemu.tar.xz
59+
fi
60+
else
61+
echo "Version ${VERSION} not available, trying next..."
62+
fi
63+
done
64+
65+
if [ "$DOWNLOAD_SUCCESS" = false ]; then
66+
echo "ERROR: Could not download QEMU ESP32 from any source"
67+
echo "Please check https://github.com/espressif/qemu/releases for available versions"
68+
exit 1
69+
fi
70+
71+
# Make QEMU executable (try both possible locations)
72+
if [ -f "${QEMU_DIR}/qemu-system-xtensa" ]; then
73+
chmod +x ${QEMU_DIR}/qemu-system-xtensa
74+
echo "QEMU ESP32 setup complete"
75+
echo "QEMU binary: ${QEMU_DIR}/qemu-system-xtensa"
76+
elif [ -f "${QEMU_DIR}/bin/qemu-system-xtensa" ]; then
77+
chmod +x ${QEMU_DIR}/bin/qemu-system-xtensa
78+
# Create symlink for easier access
79+
ln -sf bin/qemu-system-xtensa ${QEMU_DIR}/qemu-system-xtensa
80+
echo "QEMU ESP32 setup complete"
81+
echo "QEMU binary: ${QEMU_DIR}/bin/qemu-system-xtensa"
82+
else
83+
echo "ERROR: Could not find qemu-system-xtensa binary"
84+
exit 1
85+
fi

0 commit comments

Comments
 (0)