tools/esp32/mk_qemu_img.sh: Refactor the dd commands and suppress all the

status output.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-05-03 13:46:46 +01:00 committed by Gustavo Henrique Nihei
parent d1d4237ac7
commit f08aa47927

View File

@ -39,6 +39,10 @@ usage() {
echo "" echo ""
} }
imgappend() {
dd of="${1}" if="${2}" bs=1 seek="$(printf '%d' ${3})" conv=notrunc status=none
}
while [ -n "${1}" ]; do while [ -n "${1}" ]; do
case "${1}" in case "${1}" in
-b ) -b )
@ -82,10 +86,10 @@ printf "Generating %s...\n" "${FLASH_IMG}"
printf "\tBootloader: %s\n" "${BOOTLOADER_IMG}" printf "\tBootloader: %s\n" "${BOOTLOADER_IMG}"
printf "\tPartition Table: %s\n" "${PARTITION_IMG}" printf "\tPartition Table: %s\n" "${PARTITION_IMG}"
dd if=/dev/zero bs=1024 count=4096 of="${FLASH_IMG}" && \ dd if=/dev/zero bs=1024 count=4096 of="${FLASH_IMG}" status=none
dd if="${BOOTLOADER_IMG}" bs=1 seek="$(printf '%d' 0x1000)" of="${FLASH_IMG}" conv=notrunc && \ imgappend ${FLASH_IMG} ${BOOTLOADER_IMG} 0x1000
dd if="${PARTITION_IMG}" bs=1 seek="$(printf '%d' 0x8000)" of="${FLASH_IMG}" conv=notrunc && \ imgappend ${FLASH_IMG} ${PARTITION_IMG} 0x8000
dd if="${NUTTX_IMG}" bs=1 seek="$(printf '%d' 0x10000)" of="${FLASH_IMG}" conv=notrunc imgappend ${FLASH_IMG} ${NUTTX_IMG} 0x10000
if [ ${?} -ne 0 ]; then if [ ${?} -ne 0 ]; then
printf "Failed to generate %s!\n" "${FLASH_IMG}" printf "Failed to generate %s!\n" "${FLASH_IMG}"