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

Fabio Estevam festevam at gmail.com
Thu Dec 6 14:41:34 UTC 2018


Hi Wolfgang,

On Thu, Dec 6, 2018 at 12:23 PM Wolfgang Denk <wd at denx.de> wrote:

> This makes really no sense to me.  Can you please send me (off list)
> a git diff of the tree that is not building for you against the
> nearest mainline commit?

I am running top of tree mainline U-Boot + your patch from this thread, plus:

--- 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                (1 * 1024)
 #define CONFIG_SYS_FSL_USDHC_NUM               2

 #define CONFIG_SYS_MMC_ENV_DEV                 0

It does build fine, but as I have intentionally forced a small
CONFIG_BOARD_SIZE_LIMIT  I wanted it to fail, but it does not fail as
shown below:

  OBJCOPY u-boot-nodtb.bin
/bin/sh: 1: arithmetic expression: expecting primary: ""(1 * 1024)""
  SYM     u-boot.sym
  COPY    u-boot.bin
  MKIMAGE u-boot.img
===================== 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

As you can see there are two issues:

1. The warnin: /bin/sh: 1: arithmetic expression: expecting primary:
""(1 * 1024)""

2. It should have not built in this case. It should have detected the
overlap and signalized the error

> And please also the output of /"bin/sh --version".

$ /bin/sh --version
/bin/sh: 0: Illegal option --

In my system /bin/sh points to bash:
$ ls -al /bin/sh
lrwxrwxrwx 1 root root 4 mai  2  2018 /bin/sh -> dash

/bin/bash --version
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I am able to reproduce this problem with a standalone script:

$ cat random.sh
#!/bin/bash
echo $(($RANDOM % 10))
$ ./random.sh
3

Worked fine with bash.

Now if I force it to dash:

$ cat random.sh
#!/bin/dash
echo $(($RANDOM % 10))
$ ./random.sh
./random.sh: 2: ./random.sh: arithmetic expression: expecting primary: " % 10"

Which is the same warning I get in U-Boot.


More information about the U-Boot mailing list