aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Kletsky <git-commits@allycomm.com>2019-11-13 13:09:48 -0800
committerJohn Crispin <john@phrozen.org>2020-01-15 20:05:48 +0100
commitf0b76d02e8345022d417f02733504cfd862a2d6f (patch)
treea29beb84dc7feaa06b44e9feeceb2d9cb1665cc2
parent0da193ee6943fc7afd100d2378cd1989d1f1cc03 (diff)
downloadupstream-f0b76d02e8345022d417f02733504cfd862a2d6f.tar.gz
upstream-f0b76d02e8345022d417f02733504cfd862a2d6f.tar.bz2
upstream-f0b76d02e8345022d417f02733504cfd862a2d6f.zip
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 <gch981213@gmail.com> Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
-rw-r--r--include/image-commands.mk7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 3b091f26ac..37cb083bbf 100644
--- a/include/image-commands.mk
+++ b/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)" \