Skip to content

Commit

Permalink
image: improve UBI image sizing on NAND devices
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
  • Loading branch information
guidosarducci committed Nov 12, 2023
1 parent fb29dfd commit f84c4bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/image-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ define Build/append-md5sum-ascii-salted
rm $@.salted
endef

UBI_NAND_SIZE_LIMIT= ($(IMAGE_SIZE) - ($(NAND_SIZE) * 20 / 1024))

define Build/append-ubi
sh $(TOPDIR)/scripts/ubinize-image.sh \
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
Expand All @@ -146,6 +148,8 @@ define Build/append-ubi
$(UBINIZE_OPTS)
cat $@.tmp >> $@
rm $@.tmp
$(if $(and $(IMAGE_SIZE),$(NAND_SIZE)),\
$(call Build/check-size,$(UBI_NAND_SIZE_LIMIT)))
endef

define Build/ubinize-kernel
Expand Down
3 changes: 2 additions & 1 deletion include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ define Device/Init
DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
FACTORY_IMG_NAME :=
IMAGE_SIZE :=
NAND_SIZE :=
KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
KERNEL_SUFFIX := -kernel.bin
KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
Expand Down Expand Up @@ -446,7 +447,7 @@ DEFAULT_DEVICE_VARS := \
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UBOOT_PATH IMAGE_SIZE \
UBOOT_PATH IMAGE_SIZE NAND_SIZE \
FACTORY_IMG_NAME FACTORY_SIZE \
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
Expand Down

0 comments on commit f84c4bc

Please sign in to comment.