@@ -305,54 +305,11 @@ if [[ -n ${build_jade} ]]; then
305305 git submodule update --recursive --init
306306 fi
307307
308- # Deduce the relevant versions of esp-idf and qemu to use
308+ # Deduce the relevant version of esp-idf to use
309309 ESP_IDF_BRANCH=$( grep " ARG ESP_IDF_BRANCH=" Dockerfile | cut -d\= -f2)
310310 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)
313311 cd ..
314312
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-
356313 # We will install the esp-idf tools in a given location (otherwise defaults to user home dir)
357314 export IDF_TOOLS_PATH=" $( pwd) /esp-idf-tools"
358315
@@ -394,6 +351,13 @@ if [[ -n ${build_jade} ]]; then
394351 # Export the tools
395352 . ./esp-idf/export.sh
396353
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+
397361 # Build Blockstream Jade firmware configured for the emulator
398362 cd jade
399363 rm -fr sdkconfig
@@ -412,8 +376,8 @@ if [[ -n ${build_jade} ]]; then
412376 # Extract the minimal artifacts required to run the emulator
413377 rm -fr simulator
414378 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} / qemu simulator /pc-bios
417381 cp jade/main/qemu/flash_image.bin simulator/
418382 cp jade/main/qemu/qemu_efuse.bin simulator/
419383
0 commit comments