Parcourir la source

build: define check-kernel-size to remove unflashable images

Certain boards have limitations on U-Boot that prevent flashing
of images where the kernel size exceeds a threshold, yet
sysupgrade can sucessfully manage larger kernels. The current
check-size will remove the target artifact if its total size
exceeds the threshold. If applied after append-kernel,
it will remove the kernel, but the remaining image-assembly
steps will continue, resulting in an image without a kernel
that is likely unbootable.

By defining check-kernel-size, it is now possible to prevent release
of such unbootable images through a construct similar to:

  IMAGE/factory.img := append-kernel | pad-to $$$$(GL_UBOOT_UBI_OFFSET) | \
    append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET)

Cc: Chuanhong Guo <[email protected]>

Signed-off-by: Jeff Kletsky <[email protected]>
Jeff Kletsky il y a 6 ans
Parent
commit
f0b76d02e8
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      include/image-commands.mk

+ 7 - 0
include/image-commands.mk

@@ -275,6 +275,13 @@ define Build/check-size
 	}
 endef
 
+define Build/check-kernel-size
+	@[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $(IMAGE_KERNEL))" ] || { \
+		echo "WARNING: Kernel for $@ is too big > $(1)" >&2; \
+		rm -f $@; \
+	}
+endef
+
 define Build/combined-image
 	-sh $(TOPDIR)/scripts/combined-image.sh \
 		"$(IMAGE_KERNEL)" \