From f08aa479271e6325932e947630d31b584b0f6ab1 Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Mon, 3 May 2021 13:46:46 +0100 Subject: [PATCH] tools/esp32/mk_qemu_img.sh: Refactor the dd commands and suppress all the status output. Signed-off-by: Abdelatif Guettouche --- tools/esp32/mk_qemu_img.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/esp32/mk_qemu_img.sh b/tools/esp32/mk_qemu_img.sh index 357b964792..12c9429c71 100755 --- a/tools/esp32/mk_qemu_img.sh +++ b/tools/esp32/mk_qemu_img.sh @@ -39,6 +39,10 @@ usage() { echo "" } +imgappend() { + dd of="${1}" if="${2}" bs=1 seek="$(printf '%d' ${3})" conv=notrunc status=none +} + while [ -n "${1}" ]; do case "${1}" in -b ) @@ -82,10 +86,10 @@ printf "Generating %s...\n" "${FLASH_IMG}" printf "\tBootloader: %s\n" "${BOOTLOADER_IMG}" printf "\tPartition Table: %s\n" "${PARTITION_IMG}" -dd if=/dev/zero bs=1024 count=4096 of="${FLASH_IMG}" && \ -dd if="${BOOTLOADER_IMG}" bs=1 seek="$(printf '%d' 0x1000)" of="${FLASH_IMG}" conv=notrunc && \ -dd if="${PARTITION_IMG}" bs=1 seek="$(printf '%d' 0x8000)" of="${FLASH_IMG}" conv=notrunc && \ -dd if="${NUTTX_IMG}" bs=1 seek="$(printf '%d' 0x10000)" of="${FLASH_IMG}" conv=notrunc +dd if=/dev/zero bs=1024 count=4096 of="${FLASH_IMG}" status=none +imgappend ${FLASH_IMG} ${BOOTLOADER_IMG} 0x1000 +imgappend ${FLASH_IMG} ${PARTITION_IMG} 0x8000 +imgappend ${FLASH_IMG} ${NUTTX_IMG} 0x10000 if [ ${?} -ne 0 ]; then printf "Failed to generate %s!\n" "${FLASH_IMG}"