瀏覽代碼

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 年之前
父節點
當前提交
6889056f1e
共有 1 個文件被更改,包括 11 次插入0 次删除
  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