-
-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathbuild_qemu_all.sh
More file actions
72 lines (59 loc) · 1.97 KB
/
build_qemu_all.sh
File metadata and controls
72 lines (59 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
# Build both libqemu-xtensa.dll and libqemu-riscv32.dll with slirp (WiFi)
# and copy them to backend/app/services/.
#
# Run from MSYS2 MINGW64 shell:
# cd /e/Hardware/wokwi_clon
# bash build_qemu_all.sh
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
QEMU_DIR="${REPO_ROOT}/third-party/qemu-lcgamboa"
BACKEND_SERVICES="${REPO_ROOT}/backend/app/services"
echo "=== Building QEMU ESP32 DLLs (Xtensa + RISC-V) with slirp ==="
echo " QEMU source: ${QEMU_DIR}"
echo " Output dir: ${BACKEND_SERVICES}"
echo ""
cd "${QEMU_DIR}"
# Step 1: Build both targets
echo "--- Running build script ---"
bash build_libqemu-esp32-win.sh
# Step 2: Copy DLLs to backend
echo ""
echo "=== Copying DLLs to backend ==="
if [ -f build/libqemu-xtensa.dll ]; then
cp build/libqemu-xtensa.dll "${BACKEND_SERVICES}/"
echo " Copied libqemu-xtensa.dll ($(du -h build/libqemu-xtensa.dll | cut -f1))"
else
echo " WARNING: libqemu-xtensa.dll not found!"
fi
if [ -f build/libqemu-riscv32.dll ]; then
cp build/libqemu-riscv32.dll "${BACKEND_SERVICES}/"
echo " Copied libqemu-riscv32.dll ($(du -h build/libqemu-riscv32.dll | cut -f1))"
else
echo " WARNING: libqemu-riscv32.dll not found!"
fi
# Step 3: Verify slirp in both DLLs
echo ""
echo "=== Verifying slirp support ==="
for dll in libqemu-xtensa.dll libqemu-riscv32.dll; do
path="${BACKEND_SERVICES}/${dll}"
if [ -f "$path" ]; then
if objdump -p "$path" 2>/dev/null | grep -q "libslirp"; then
echo " ${dll}: slirp OK"
else
echo " ${dll}: WARNING - slirp NOT found!"
fi
fi
done
# Step 4: Verify picsimlab exports
echo ""
echo "=== Verifying picsimlab exports ==="
for dll in libqemu-xtensa.dll libqemu-riscv32.dll; do
path="${BACKEND_SERVICES}/${dll}"
if [ -f "$path" ]; then
count=$(objdump -p "$path" 2>/dev/null | grep -c "picsimlab" || true)
echo " ${dll}: ${count} picsimlab exports"
fi
done
echo ""
echo "=== Done ==="