build: drop implicit gzip of ext4 images

With CONFIG_TARGET_IMAGES_GZIP enabled, which is the default, ext4
images are gzipped when they are copied to $(BIN_DIR), unless their
name ends with .gz or .dtb. This causes several problems:

- The JSON info contains the uncompressed name and hash, so
  profiles.json lists images which don't exist on the download server:

    profiles.json: openwrt-at91-sam9x-atmel_at91sam9263ek-ext4-root.ubi
    sha256sums:    openwrt-at91-sam9x-atmel_at91sam9263ek-ext4-root.ubi.gz

- The image is gzipped as a whole, including the metadata and signature
  added by append-metadata. fwtool looks for them at the end of the
  file, so sysupgrade rejects these images. Explicitly gzipped images
  run append-metadata after gzip instead.

- A rule for the gzipped name is defined for every image, which clashes
  with images that are built both plain and gzipped, as it was the case
  for malta.

The previous commits removed the ext4 images which can't be used and
gzip the remaining ones explicitly, so drop the implicit gzip. The file
name in $(BIN_DIR) is now always the one from IMAGES. Targets wanting
gzipped images define them explicitly, e.g. sdcard.img.gz, or select
them via CONFIG_TARGET_IMAGES_GZIP like x86, armsr, loongarch64 and
malta. Limit the option to these targets.

The ext4 kernel.bin and factory.bin of ixp4xx, which only contain the
kernel, and the optional ext4 VM images of x86 and armsr are now stored
uncompressed, like their squashfs counterparts.

Link: https://github.com/openwrt/openwrt/pull/25658
Signed-off-by: Paul Spooren <mail@aparcar.org>
This commit is contained in:
Paul Spooren committed 2026-10-06 11:32:34 +02:00
1 parent 6a0fc5d8be
commit 3760244fae
2 files changed
+4 -8

No files matched your search

+1 -1
View File
@@ -332,7 +332,7 @@ menu "Target Images"
config TARGET_IMAGES_GZIP
bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armsr || TARGET_malta || TARGET_loongarch64
depends on TARGET_x86 || TARGET_armsr || TARGET_malta || TARGET_loongarch64
default y
comment "Image Options"
+3 -7
View File
@@ -737,12 +737,11 @@ define Device/Build/kernel
endef
define Device/Build/image
GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
$$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
$(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
$(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2)))
$(eval $(call Device/Export,$(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)),$(1)))
$(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
$(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))
ROOTFS/$(1)/$(3) := \
$(KDIR)/root.$(1)$$(strip \
@@ -760,13 +759,10 @@ define Device/Build/image
.IGNORE: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))
$(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2)).gz: $(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2))
gzip -c -9n $$^ > $$@
$(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2)): $(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2))
cp $$^ $$@
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))
@mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(DEVICE_NAME)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \