Browse Source

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 <dario.binacchi@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Dario Binacchi 1 year ago
parent
commit
6889056f1e
1 changed files with 11 additions and 0 deletions
  1. 11 0
      support/scripts/genimage.sh

+ 11 - 0
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