[U-Boot] [PATCH] Enable expression support for CONFIG_BOARD_SIZE_LIMIT

Wolfgang Denk wd at denx.de
Wed Dec 5 09:52:01 UTC 2018


Dear Fabio,

In message <CAOMZO5Co8KPCBx+gPS8w02cYJR2Ci9cpSKVQm3zy+JRgD1mtLw at mail.gmail.com> you wrote:
>
> Still not working for me. I do see a warning now:
>
>   LD      spl/u-boot-spl
> /bin/sh: 1: arithmetic expression: expecting primary: ""((768 - 69) * 1024)""
>   COPY    u-boot.bin
>   MKIMAGE u-boot.img
>   OBJCOPY spl/u-boot-spl-nodtb.bin
>   COPY    spl/u-boot-spl.bin
>   CFGS    spl/u-boot-spl.cfgout
>   MKIMAGE SPL
>   CFGCHK  u-boot.cfg

I'm bulding with your modification:

diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 2bc42a04a0..67ca700a2f 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -134,7 +134,8 @@
 /* FLASH and environment organization */
 #define CONFIG_ENV_SIZE                        SZ_8K

-#define CONFIG_ENV_OFFSET                      (8 * SZ_64K)
+#define CONFIG_ENV_OFFSET              (768 * 1024)
+#define CONFIG_BOARD_SIZE_LIMIT                ((768 - 69) * 1024)
 #define CONFIG_SYS_FSL_USDHC_NUM               2

 #define CONFIG_SYS_MMC_ENV_DEV                 0

...
  LD      spl/common/spl/built-in.o
  CC      spl/lib/display_options.o
  LD      spl/lib/built-in.o
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  COPY    spl/u-boot-spl.bin
  MKIMAGE SPL
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin
  COPY    u-boot.bin
  SYM     u-boot.sym
  MKIMAGE u-boot.img
  CHK     include/config.h
  CFG     u-boot.cfg
===================== WARNING ======================
This board does not use CONFIG_DM_MMC. Please update
the board to use CONFIG_DM_MMC before the v2019.04 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================
  CFGCHK  u-boot.cfg


> It does allow the build to proceed, but it is not really detecting the
> overlap anymore.
>
> For example: let's force the overlap by setting a very small
> CONFIG_BOARD_SIZE_LIMIT of only 1K:
>
> #define CONFIG_ENV_OFFSET (768 * 1024)
> #define CONFIG_BOARD_SIZE_LIMIT (1 * 1024)

Please try it on the shell:

-> echo $(( ((768 - 69) * 1024) ))
715776
-> echo $(( (1 * 1024) ))
1024

> /bin/sh: 1: arithmetic expression: expecting primary: ""(1 * 1024)""

I tested this with /bin/bash, /bin/sh and even /bin/dash - they all
work fine here.

> It still allowed a successful build, but it should have thrown an
> error about the overlap.

It does for me, if I set the limit low:

  OBJCOPY spl/u-boot-spl-nodtb.bin
  COPY    spl/u-boot-spl.bin
  CFGS    spl/u-boot-spl.cfgout
  MKIMAGE SPL
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin
u-boot-nodtb.bin exceeds file size limit:
  limit:  1024 bytes
  actual: 480172 bytes
  excess: 479148 bytes
make: *** [Makefile:1071: u-boot-nodtb.bin] Error 1



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
                                                      -- Isaac Asimov


More information about the U-Boot mailing list