
Dear Mike Frysinger,
In message 1287025103-26681-1-git-send-email-vapier@gentoo.org you wrote:
Boards often have a reserved size limit on the flash where they're stored. Sometimes during upgrades or config changes, those limits are exceeded, but no one notices until they try to upgrade and the limit screws things up. Either not enough of U-Boot is written to flash (and so the reboot fails), or too much is written (and so things after it get clobbered).
So allow boards to declare a size limit (in bytes) and have the build system check it while building.
Signed-off-by: Mike Frysinger vapier@gentoo.org
Makefile | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile index de4ceb9..ca12d78 100644 --- a/Makefile +++ b/Makefile @@ -304,6 +304,21 @@ __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD)) ######################################################################### #########################################################################
+ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) +BOARD_SIZE_CHECK = \
- @actual=`wc -c $@ | awk '{print $$1}'`; \
How about using
stat -c '%s'
to get the file size in a single command, without need to actually read all the data?
Best regards,
Wolfgang Denk