From 6889056f1eb4293de67c28b1ff6ee34be05d2ee4 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sun, 21 Apr 2024 11:53:52 +0200 Subject: [PATCH] support/scripts/genimage.sh: support creating a bmap image The patch adds the possibility to create, in addition to the usual image, an image of type bmap that drastically reduces the amount of data that needs to be written to an SD card, resulting in time savings. It looks at whether BR2_PACKAGE_HOST_BMAP_TOOLS is enabled to decide whether it should or not generate bmap tool images. It generates bmap images for all images referenced in the genimage configuration file, as long as they exist in $(BINARIES_DIR). Signed-off-by: Dario Binacchi Signed-off-by: Thomas Petazzoni --- support/scripts/genimage.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh index 2796e19eb7..b479ec9e0b 100755 --- a/support/scripts/genimage.sh +++ b/support/scripts/genimage.sh @@ -46,3 +46,14 @@ genimage \ --inputpath "${BINARIES_DIR}" \ --outputpath "${BINARIES_DIR}" \ --config "${GENIMAGE_CFG}" + +if grep -Eq "^BR2_PACKAGE_HOST_BMAP_TOOLS=y$" "${BR2_CONFIG}"; then + while IFS= read -r image; do + image_path="${BINARIES_DIR}/${image}" + if ! test -f "${image_path}"; then + continue + fi + bmaptool create "${image_path}" -o "${image_path}.bmap" + gzip -c "${image_path}" > "${image_path}.gz" + done < <(grep '^image ' "${GENIMAGE_CFG}" | cut -d ' ' -f 2) +fi