@@ -305,54 +305,11 @@ if [[ -n ${build_jade} ]]; then
305
305
git submodule update --recursive --init
306
306
fi
307
307
308
- # Deduce the relevant versions of esp-idf and qemu to use
308
+ # Deduce the relevant version of esp-idf to use
309
309
ESP_IDF_BRANCH=$( grep " ARG ESP_IDF_BRANCH=" Dockerfile | cut -d\= -f2)
310
310
ESP_IDF_COMMIT=$( grep " ARG ESP_IDF_COMMIT=" Dockerfile | cut -d\= -f2)
311
- ESP_QEMU_BRANCH=$( grep " ARG ESP_QEMU_BRANCH=" Dockerfile | cut -d\= -f2)
312
- ESP_QEMU_COMMIT=$( grep " ARG ESP_QEMU_COMMIT=" Dockerfile | cut -d\= -f2)
313
311
cd ..
314
312
315
- # Build the qemu emulator if required
316
-
317
- # If the directory exists, see if it is at the expected commit
318
- # If not, remove the entire directory (it will be re-cloned below)
319
- if [ -d " qemu" ]; then
320
- cd qemu
321
- LOCAL=$( git rev-parse @)
322
- if [ $LOCAL = $ESP_QEMU_COMMIT ]; then
323
- echo " esp-qemu up-to-date"
324
- cd ..
325
- else
326
- cd ..
327
- rm -fr qemu
328
- fi
329
- fi
330
-
331
- # Clone the upstream if the directory does not exist
332
- # Then build the emulator
333
- if [ ! -d " qemu" ]; then
334
- git clone --quiet --depth 1 --branch ${ESP_QEMU_BRANCH} --single-branch --shallow-submodules https://github.com/espressif/qemu.git ./qemu
335
- cd qemu
336
-
337
- git checkout ${ESP_QEMU_COMMIT}
338
- ./configure \
339
- --target-list=xtensa-softmmu \
340
- --enable-gcrypt \
341
- --disable-sanitizers \
342
- --disable-strip \
343
- --disable-user \
344
- --disable-capstone \
345
- --disable-vnc \
346
- --disable-sdl \
347
- --disable-gtk \
348
- --enable-slirp \
349
- --extra-cflags=-Wno-array-parameter
350
- ninja -C build
351
- cd ..
352
- fi
353
-
354
- # Build the esp-idf toolchain if required
355
-
356
313
# We will install the esp-idf tools in a given location (otherwise defaults to user home dir)
357
314
export IDF_TOOLS_PATH=" $( pwd) /esp-idf-tools"
358
315
@@ -394,6 +351,13 @@ if [[ -n ${build_jade} ]]; then
394
351
# Export the tools
395
352
. ./esp-idf/export.sh
396
353
354
+ # Install the emulator
355
+ idf_tools.py install qemu-xtensa
356
+ QEMU_EXE=$( find ${IDF_TOOLS_PATH} -type f -name qemu-system-xtensa)
357
+ QEMU_BIOS_DIR=$( dirname " ${QEMU_EXE} " ) /../share/qemu
358
+ echo " Installed qemu emulator: ${QEMU_EXE} "
359
+ echo " Installed qemu bios files: ${QEMU_BIOS_DIR} "
360
+
397
361
# Build Blockstream Jade firmware configured for the emulator
398
362
cd jade
399
363
rm -fr sdkconfig
@@ -412,8 +376,8 @@ if [[ -n ${build_jade} ]]; then
412
376
# Extract the minimal artifacts required to run the emulator
413
377
rm -fr simulator
414
378
mkdir simulator
415
- cp qemu/build/qemu-system-xtensa simulator/
416
- cp -R qemu /pc-bios simulator/
379
+ cp ${QEMU_EXE} simulator/
380
+ cp -R ${QEMU_BIOS_DIR} simulator /pc-bios
417
381
cp jade/main/qemu/flash_image.bin simulator/
418
382
cp jade/main/qemu/qemu_efuse.bin simulator/
419
383
0 commit comments