All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel@ziswiler.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 2/2] imx: mkimage: add size check to the u-boot.imx make target
Date: Wed,  7 Nov 2018 23:39:47 +0100	[thread overview]
Message-ID: <20181107223947.31783-2-marcel@ziswiler.com> (raw)
In-Reply-To: <20181107223947.31783-1-marcel@ziswiler.com>

From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

The make macro to check if the binary exceeds the board size limit is
taken straight from the root Makefile.

Without this and e.g. enabled EFI Vybrid fails booting as the regular
size limit check does not take the final u-boot.imx binary size into
account which is bigger due to alignment as well as IMX header stuff.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

---

 arch/arm/mach-imx/Makefile | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 72fe23a2b9..53d9e5f42b 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -58,6 +58,21 @@ obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
 obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o
 endif
 
+ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
+BOARD_SIZE_CHECK = \
+        @actual=`wc -c $@ | awk '{print $$1}'`; \
+        limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
+        if test $$actual -gt $$limit; then \
+                echo "$@ exceeds file size limit:" >&2 ; \
+                echo "  limit:  $$limit bytes" >&2 ; \
+                echo "  actual: $$actual bytes" >&2 ; \
+                echo "  excess: $$((actual - limit)) bytes" >&2; \
+                exit 1; \
+        fi
+else
+BOARD_SIZE_CHECK =
+endif
+
 PLUGIN = board/$(BOARDDIR)/plugin
 
 ifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y)
@@ -101,6 +116,7 @@ u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log
 
 u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE
 	$(call if_changed,mkimage)
+	$(BOARD_SIZE_CHECK)
 
 ifeq ($(CONFIG_OF_SEPARATE),y)
 MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
-- 
2.14.5

  reply	other threads:[~2018-11-07 22:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 22:39 [U-Boot] [PATCH v1 1/2] board: toradex: colibri_vf: efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION Marcel Ziswiler
2018-11-07 22:39 ` Marcel Ziswiler [this message]
2018-11-08  1:55   ` [U-Boot] [PATCH v1 2/2] imx: mkimage: add size check to the u-boot.imx make target Fabio Estevam
2018-11-08  8:43     ` Stefano Babic
2018-11-08 12:13       ` Tom Rini
2018-11-08 14:07     ` Stefano Babic
2018-11-09  9:18       ` Marcel Ziswiler
2018-11-09  9:41         ` Alexander Graf
2018-11-09 10:23           ` Marcel Ziswiler
2018-11-09 14:35       ` Marcel Ziswiler
2018-11-12 11:57         ` Stefano Babic
2018-11-07 23:37 ` [U-Boot] [PATCH v1 1/2] board: toradex: colibri_vf: efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181107223947.31783-2-marcel@ziswiler.com \
    --to=marcel@ziswiler.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.