mbox series

[v13,00/24] Modernize U-Boot shell

Message ID 20231222210244.91830-1-francis.laniel@amarulasolutions.com
Headers show
Series Modernize U-Boot shell | expand

Message

Francis Laniel Dec. 22, 2023, 9:02 p.m. UTC
Hi!


During 2021 summer, Sean Anderson wrote a contribution to add a new shell, based
on LIL, to U-Boot [1, 2].
While one of the goals of this contribution was to address the fact actual
U-Boot shell, which is based on Busybox hush, is old there was a discussion
about adding a new shell versus updating the actual one [3, 4].

So, in this series, with Harald Seiler, we updated the actual U-Boot shell to
reflect what is currently in Busybox source code.
Basically, this contribution is about taking a snapshot of Busybox shell/hush.c
file (as it exists in commit 37460f5da) and adapt it to suit U-Boot needs.

This contribution was written to be as backward-compatible as possible to avoid
breaking the existing.
So, the modern hush flavor offers the same as the actual, that is to say:
1. Variable expansion.
2. Instruction lists (;, && and ||).
3. If, then and else.
4. Loops (for, while and until).
No new features offered by Busybox hush were implemented (e.g. functions).

It is possible to change the parser at runtime using the "cli" command:
=> cli print
old
=> cli set modern
=> cli print
modern
=> cli set old
The default parser is the old one.
Note that to use both parser, you would need to set both
CONFIG_HUSH_MODERN_PARSER and CONFIG_HUSH_OLD_PARSER.

In terms of testing, new unit tests were added to ut to ensure the new behavior
is the same as the old one and it does not add regression.
Nonetheless, if old behavior was buggy and fixed upstream, the fix is then added
to U-Boot [5].
In sandbox, all of these tests pass smoothly:
=> printenv board
board=sandbox
=> ut hush
Running 20 hush tests
...
Failures: 0
=> cli set modern
=> ut hush
Running 20 hush tests
...
Failures: 0

Thanks to the effort of Harald Seiler, I was successful booting a board:
=> printenv fdtfile
fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb
=> cli get
old
=> boot
...
root@lepotato:~#
root@lepotato:~# reboot
...
=> cli set modern
=> cli get
modern
=> printenv fdtfile
fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb
=> boot
...
root@lepotato:~#

This contribution indeed adds a lot of code and there were concern about its
size [6, 7].
With regard to the amount of code added, the cli_hush_upstream.c is 13030 lines
long but it seems a smaller subset is really used:
gcc -D__U_BOOT__ -E common/cli_hush_upstream.c | wc -l
2870
Despite this, it is better to still have the whole upstream code for the sake of
easing maintenance.
With regard to memory size, I conducted some experiments for version 8 of this
series and for a subset of arm64 boards and found the worst case to be 4K [8].
Tom Rini conducted more research on this and also found the increase to be
acceptable [9].

If you want to review it - your review will really be appreciated - here are
some information regarding the commits:
* commits marked as "test:" deal with unit tests.
* commit "cli: Add Busybox upstream hush.c file." copies Busybox shell/hush.c
into U-Boot tree, this explain why this commit contains around 12000 additions.
* commit "cli: Port Busybox 2021 hush to U-Boot." modifies previously added file
to permit us to use this as new shell.
The really good idea of #include'ing Busybox code into a wrapper file to define
some particular functions while minimizing modifications to upstream code comes
from Harald Seiler.
* commit "cmd: Add new parser command" adds a new command which permits
selecting parser at runtime.
I am not really satisfied with the fact it calls cli_init() and cli_loop() each
time the parser is set, so your reviews would be welcomed.
* Other commits focus on enabling features we need (e.g. if).

Changes since:
 v2:
  * Added a small fix to compile sandbox with NO_SDL=1.
  * Added a command to change parser at runtime.
  * Added 2021 parser function to all run_command*().
 v3:
  * Various bug fixes pointed by the CI.
  * Added upstream busybox hush commits until 6th February 2022.
 v4:
  * Various cleaning.
  * Modified python test to accept failure output when the test are designed to
  fail.
  * Bumped upstream busybox hush commits until 24h March 2022.
 v5:
  * Bumped upstream busybox hush commits until 30th January 2023.
  * Fix how hush interprets '<' and '>', indeed we needed to escape them but I
  removed this behavior as tests are handled by test command and not hush
  itself. This permitted to have the ut fdt to pass.
  * Fix a problem with how exit was handled. This was reported by the ut exit
  test.
 v6:
  * There was no v6 and I got mixed up with version.
 v7:
  * Bumped upstream busybox hush commits until 9th May 2023.
  * Renamed parser command to change parser at runtime to cli and added
  documentation.
  * Added better separation of patches.
  * Removed code about __gnu_thumb1_case_si as it was merged in another series.
  * Various cleaning.
 v8:
  * Bumped upstream busybox hush commits until 25th May 2023.
 v9:
  * Bumped upstream busybox hush commits until 2nd October 2023.
 v10:
  * Fixed a build error in commit adding cli command.
  * Add new CONFIG_HUSH_SELECTABLE to only build cli command if the two shell
  flavors are selected.
 v11:
  * Renamed everything containing 2021 to modern.
  * Fixed cmd Kconfig indentation.
  * Set modern parser as default for majority of boards except some.
 v12:
  * Rebased on top of 36d3db6c2c06.
  * Fixed bootflow_scan_menu_boot for modern hush.

Francis Laniel (24):
  test: Add framework to test hush behavior
  test: hush: Test hush if/else
  test/py: hush_if_test: Remove the test file
  test: hush: Test hush variable expansion
  test: hush: Test hush commands list
  test: hush: Test hush loops
  cli: Add Busybox upstream hush.c file
  cli: Port upstream Busybox hush to U-Boot
  cli: Add menu for hush parser
  global_data.h: add GD_FLG_HUSH_OLD_PARSER flag
  cmd: Add new cli command
  cli: Enables using modern hush parser as command line parser
  cli: hush_modern: Enable variables expansion for modern hush
  cli: hush_modern: Add functions to be called from run_command()
  cli: add modern hush as parser for run_command*()
  test: hush: Fix instructions list tests for modern hush
  test: hush: Fix variable expansion tests for modern hush
  cli: hush_modern: Enable using < and > as string compare operators
  cli: hush_modern: Enable if keyword
  cli: hush_modern: Enable loops
  test: hush: Fix loop tests for modern hush
  cli: modern_hush: Add upstream commits up to 2nd October 2023.
  cmd: Set modern hush as default shell
  configs: Use old hush for several boards

 cmd/Kconfig                            |    21 +
 cmd/Makefile                           |     2 +
 cmd/cli.c                              |   134 +
 common/Makefile                        |     3 +-
 common/cli.c                           |    82 +-
 common/cli_hush_modern.c               |   324 +
 common/cli_hush_upstream.c             | 13030 +++++++++++++++++++++++
 configs/kmcent2_defconfig              |     1 +
 configs/kmcoge5ne_defconfig            |     1 +
 configs/kmeter1_defconfig              |     1 +
 configs/kmopti2_defconfig              |     1 +
 configs/kmsupx5_defconfig              |     1 +
 configs/kmtepr2_defconfig              |     1 +
 configs/pg_wcom_expu1_defconfig        |     1 +
 configs/pg_wcom_expu1_update_defconfig |     1 +
 configs/pg_wcom_seli8_defconfig        |     1 +
 configs/pg_wcom_seli8_update_defconfig |     1 +
 configs/socfpga_secu1_defconfig        |     1 +
 configs/tuge1_defconfig                |     1 +
 configs/tuxx1_defconfig                |     1 +
 doc/usage/cmd/cli.rst                  |    74 +
 doc/usage/index.rst                    |     1 +
 include/asm-generic/global_data.h      |     8 +
 include/cli_hush.h                     |    51 +-
 include/test/hush.h                    |    15 +
 include/test/suites.h                  |     1 +
 test/Makefile                          |     3 +
 test/boot/bootflow.c                   |    16 +-
 test/cmd_ut.c                          |     6 +
 test/hush/Makefile                     |    10 +
 test/hush/cmd_ut_hush.c                |    20 +
 test/hush/dollar.c                     |   226 +
 test/hush/if.c                         |   316 +
 test/hush/list.c                       |   140 +
 test/hush/loop.c                       |    91 +
 test/py/tests/test_hush_if_test.py     |   197 -
 test/py/tests/test_ut.py               |     8 +-
 37 files changed, 14580 insertions(+), 212 deletions(-)
 create mode 100644 cmd/cli.c
 create mode 100644 common/cli_hush_modern.c
 create mode 100644 common/cli_hush_upstream.c
 create mode 100644 doc/usage/cmd/cli.rst
 create mode 100644 include/test/hush.h
 create mode 100644 test/hush/Makefile
 create mode 100644 test/hush/cmd_ut_hush.c
 create mode 100644 test/hush/dollar.c
 create mode 100644 test/hush/if.c
 create mode 100644 test/hush/list.c
 create mode 100644 test/hush/loop.c
 delete mode 100644 test/py/tests/test_hush_if_test.py


Have a nice end of the year and thank you in advance!
---
[1] https://lists.denx.de/pipermail/u-boot/2021-July/453347.html
[2] https://runtimeterror.com/tech/lil/
[3] https://lists.denx.de/pipermail/u-boot/2021-July/453790.html
[4] https://lists.denx.de/pipermail/u-boot/2021-July/453848.html
[5] https://lists.denx.de/pipermail/u-boot/2021-August/458569.html
[6] https://lists.denx.de/pipermail/u-boot/2023-November/536768.html
[7] https://lists.denx.de/pipermail/u-boot/2023-May/518140.html
[8] https://lists.denx.de/pipermail/u-boot/2023-May/518147.html
[9] https://lists.denx.de/pipermail/u-boot/2023-November/536952.html
--
2.34.1

Comments

Tom Rini Dec. 28, 2023, 8:58 p.m. UTC | #1
On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:

> During 2021 summer, Sean Anderson wrote a contribution to add a new shell, based
> on LIL, to U-Boot [1, 2].
> While one of the goals of this contribution was to address the fact actual
> U-Boot shell, which is based on Busybox hush, is old there was a discussion
> about adding a new shell versus updating the actual one [3, 4].
> 
> So, in this series, with Harald Seiler, we updated the actual U-Boot shell to
> reflect what is currently in Busybox source code.
> Basically, this contribution is about taking a snapshot of Busybox shell/hush.c
> file (as it exists in commit 37460f5da) and adapt it to suit U-Boot needs.
> 
> [...]

Applied to u-boot/next, thanks!
Francis Laniel Dec. 29, 2023, 6:55 p.m. UTC | #2
Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> > During 2021 summer, Sean Anderson wrote a contribution to add a new shell,
> > based on LIL, to U-Boot [1, 2].
> > While one of the goals of this contribution was to address the fact actual
> > U-Boot shell, which is based on Busybox hush, is old there was a
> > discussion
> > about adding a new shell versus updating the actual one [3, 4].
> > 
> > So, in this series, with Harald Seiler, we updated the actual U-Boot shell
> > to reflect what is currently in Busybox source code.
> > Basically, this contribution is about taking a snapshot of Busybox
> > shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit
> > U-Boot needs.
> > 
> > [...]
> 
> Applied to u-boot/next, thanks!

Thank you for the merge!
If there is any problem, do not hesitate to mail me and I will take care of 
it!
Francesco Dolcini Jan. 11, 2024, 5:04 p.m. UTC | #3
Hello Tom, Francis

On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> > On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> > > During 2021 summer, Sean Anderson wrote a contribution to add a new shell,
> > > based on LIL, to U-Boot [1, 2].
> > > While one of the goals of this contribution was to address the fact actual
> > > U-Boot shell, which is based on Busybox hush, is old there was a
> > > discussion
> > > about adding a new shell versus updating the actual one [3, 4].
> > > 
> > > So, in this series, with Harald Seiler, we updated the actual U-Boot shell
> > > to reflect what is currently in Busybox source code.
> > > Basically, this contribution is about taking a snapshot of Busybox
> > > shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit
> > > U-Boot needs.
> > > 
> > > [...]
> > 
> > Applied to u-boot/next, thanks!
> 
> Thank you for the merge!
> If there is any problem, do not hesitate to mail me and I will take care of 
> it!

This change, specifically setting the modern hush shell as default, is
breaking our boot script, just noticed since the current U-Boot master
has a regression for us.

We still need to figure out the exact details, here [1] you can find the
boot script (that has some placeholder that is replaced during build).

and the error is something like:

```
## Executing script at 90280000
Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
69025 bytes read in 11 ms (6 MiB/s)
82 bytes read in 9 ms (8.8 KiB/s)
Working FDT set to 90200000
syntax error at 'done'HUSH died!
resetting ...
```

that I _assume_ comes from this line

    env set set_apply_overlays 'env set apply_overlays "for overlay_file in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt apply \\${loadaddr}; env set overlay_file; done; true"'

[1] https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in

Francesco
Patrice CHOTARD Jan. 15, 2024, 5:34 p.m. UTC | #4
On 1/11/24 18:04, Francesco Dolcini wrote:
> Hello Tom, Francis
> 
> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new shell,
>>>> based on LIL, to U-Boot [1, 2].
>>>> While one of the goals of this contribution was to address the fact actual
>>>> U-Boot shell, which is based on Busybox hush, is old there was a
>>>> discussion
>>>> about adding a new shell versus updating the actual one [3, 4].
>>>>
>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot shell
>>>> to reflect what is currently in Busybox source code.
>>>> Basically, this contribution is about taking a snapshot of Busybox
>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit
>>>> U-Boot needs.
>>>>
>>>> [...]
>>>
>>> Applied to u-boot/next, thanks!
>>
>> Thank you for the merge!
>> If there is any problem, do not hesitate to mail me and I will take care of 
>> it!
> 
> This change, specifically setting the modern hush shell as default, is
> breaking our boot script, just noticed since the current U-Boot master
> has a regression for us.
> 
> We still need to figure out the exact details, here [1] you can find the
> boot script (that has some placeholder that is replaced during build).
> 
> and the error is something like:
> 
> ```
> ## Executing script at 90280000
> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> 69025 bytes read in 11 ms (6 MiB/s)
> 82 bytes read in 9 ms (8.8 KiB/s)
> Working FDT set to 90200000
> syntax error at 'done'HUSH died!
> resetting ...
> ```
> 
> that I _assume_ comes from this line
> 
>     env set set_apply_overlays 'env set apply_overlays "for overlay_file in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt apply \\${loadaddr}; env set overlay_file; done; true"'
> 
> [1] https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in
> 
> Francesco
> 


Hi all

I observed a similar issue with STM32MP157c-DK2 board.
Since commit 78912cfde281 ("cmd: Set modern hush as default shell") U-Boot crashes :


U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)

CPU: STM32MP157CAC Rev.B
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
Board: MB1272 Var2.0 Rev.C-01
DRAM:  512 MiB
Clocks:
- MPU : 650 MHz
- MCU : 208.878 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
optee optee: OP-TEE: revision 4.0 (e92de4ca)
I/TC: Reserved shared memory is disabled
I/TC: Dynamic shared memory is enabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are disabled
Core:  311 devices, 40 uclasses, devicetree: board
WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
NAND:  0 MiB
MMC:   STM32 SD/MMC: 0
Loading Environment from MMC... OK
In:    No input devices available!
Out:   No output devices available!
Err:   No error devices available!
Net:   eth0: ethernet@5800a000
Hit any key to stop autoboot:  0 
Boot over mmc0!
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:8...
data abort
pc : [<ddb3f77a>]          lr : [<ddb44c95>]
reloc pc : [<c012777a>]    lr : [<c012cc95>]
sp : dbafc848  ip : ddbfc578     fp : ddbedf18
r10: 00000000  r9 : dbb15e70     r8 : 00000000
r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
Code: 3138 1c48 f854 0030 (eb04) 05c1 
Resetting CPU ...


It crashes in blkcache_fill() , i didn't investigate deeply into this issue yet, but i can reproduce this issue
by stopping autoboot by pressing a key and running a environment command as shown below :

U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)

CPU: STM32MP157CAC Rev.B
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
Board: MB1272 Var2.0 Rev.C-01
DRAM:  512 MiB
Clocks:
- MPU : 650 MHz
- MCU : 208.878 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
optee optee: OP-TEE: revision 4.0 (e92de4ca)
I/TC: Reserved shared memory is disabled
I/TC: Dynamic shared memory is enabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are disabled
Core:  311 devices, 40 uclasses, devicetree: board
WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
NAND:  0 MiB
MMC:   STM32 SD/MMC: 0
Loading Environment from MMC... OK
In:    No input devices available!
Out:   No output devices available!
Err:   No error devices available!
Net:   eth0: ethernet@5800a000
Hit any key to stop autoboot:  0 
STM32MP> 
STM32MP> 


Then i run "printenv" :

STM32MP> printenv 
arch=arm
autoload=0
baudrate=115200
board=stm32mp1
board_id=0x1272
board_name=stm32mp157c-dk2
board_rev=0x000c
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_auth=0
boot_device=mmc
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr -q ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_i
boot_efi_bootmgr=if fdt addr -q ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_instance=0
boot_net_usb_start=true
boot_part=1
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc1 ubifs0 mmc0 mmc2 usb0 pxe 
bootcmd=run bootcmd_stm32mp
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc2=devnum=2; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_stm32mp=echo "Boot over ${boot_device}${boot_instance}!";if test ${boot_device} = serial || test ${boot_device} = usb;then stm32prog ${boot_device} ${boot_ins;
bootcmd_ubifs0=bootubipart=UBI; bootubivol=boot; bootubioff=; run ubifs_boot
bootcmd_usb0=devnum=0; run usb_boot
bootdelay=1
console=ttySTM0
cpu=armv7
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
env_check=if env info -p -d -q; then env save; fi
ethaddr=00:80:e1:42:48:f9
fdt_addr_r=0xc4000000
fdtcontroladdr=dbafd730
fdtfile=stm32mp157c-dk2.dtb
fdtoverlay_addr_r=0xc4300000
kernel_addr_r=0xc2000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0xc2000000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
pxefile_addr_r=0xc4200000
ramdisk_addr_r=0xc4400000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; do;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype $t
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efe
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extli
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}$e
scriptaddr=0xc4100000
serial#=003700433338511634383330
serverip=192.168.1.1
soc=stm32mp
soc_pkg=AC
soc_rev=B
soc_type=157C
splashimage=0xc2000000
splashpos=m,m
ubifs_boot=if ubi part ${bootubipart} ${bootubioff} && ubifsmount ubi0:${bootubivol}; then devtype=ubi; devnum=ubi0; bootfstype=ubifs; distro_bootpart=${bootubivol}; i
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
usb_pgood_delay=2000
vendor=st

Environment size: 4321/8187 bytes


and after i execute "run bootcmd_mmc0"

STM32MP> run bootcmd_mmc0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:8...
data abort
pc : [<ddb3f7a4>]          lr : [<ddb44c95>]
reloc pc : [<c01277a4>]    lr : [<c012cc95>]
sp : dbafcad8  ip : ddbfc578     fp : ddbedf18
r10: 00000000  r9 : dbb15e70     r8 : 00000000
r7 : dbb5f700  r6 : dbb615b8     r5 : dbb5f700  r4 : ddbeda78
r3 : dbb613b0  r2 : 00005c50     r1 : 0000002e  r0 : 00005c51
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
Code: 315b e7e9 2954 d802 (0b11) 316e 
Resetting CPU ...

resetting ...


Thanks
Patrice
Tom Rini Jan. 16, 2024, 12:46 a.m. UTC | #5
On Mon, Jan 15, 2024 at 06:34:24PM +0100, Patrice CHOTARD wrote:
> 
> 
> On 1/11/24 18:04, Francesco Dolcini wrote:
> > Hello Tom, Francis
> > 
> > On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> >> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> >>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> >>>> During 2021 summer, Sean Anderson wrote a contribution to add a new shell,
> >>>> based on LIL, to U-Boot [1, 2].
> >>>> While one of the goals of this contribution was to address the fact actual
> >>>> U-Boot shell, which is based on Busybox hush, is old there was a
> >>>> discussion
> >>>> about adding a new shell versus updating the actual one [3, 4].
> >>>>
> >>>> So, in this series, with Harald Seiler, we updated the actual U-Boot shell
> >>>> to reflect what is currently in Busybox source code.
> >>>> Basically, this contribution is about taking a snapshot of Busybox
> >>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit
> >>>> U-Boot needs.
> >>>>
> >>>> [...]
> >>>
> >>> Applied to u-boot/next, thanks!
> >>
> >> Thank you for the merge!
> >> If there is any problem, do not hesitate to mail me and I will take care of 
> >> it!
> > 
> > This change, specifically setting the modern hush shell as default, is
> > breaking our boot script, just noticed since the current U-Boot master
> > has a regression for us.
> > 
> > We still need to figure out the exact details, here [1] you can find the
> > boot script (that has some placeholder that is replaced during build).
> > 
> > and the error is something like:
> > 
> > ```
> > ## Executing script at 90280000
> > Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> > 69025 bytes read in 11 ms (6 MiB/s)
> > 82 bytes read in 9 ms (8.8 KiB/s)
> > Working FDT set to 90200000
> > syntax error at 'done'HUSH died!
> > resetting ...
> > ```
> > 
> > that I _assume_ comes from this line
> > 
> >     env set set_apply_overlays 'env set apply_overlays "for overlay_file in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt apply \\${loadaddr}; env set overlay_file; done; true"'
> > 
> > [1] https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in
> > 
> > Francesco
> > 
> 
> 
> Hi all
> 
> I observed a similar issue with STM32MP157c-DK2 board.
> Since commit 78912cfde281 ("cmd: Set modern hush as default shell") U-Boot crashes :

I wonder if:
https://patchwork.ozlabs.org/project/uboot/patch/20240115134656.50917-1-heinrich.schuchardt@canonical.com/
is relevant to this problem or not.
Patrice CHOTARD Jan. 16, 2024, 7:08 a.m. UTC | #6
On 1/16/24 01:46, Tom Rini wrote:
> On Mon, Jan 15, 2024 at 06:34:24PM +0100, Patrice CHOTARD wrote:
>>
>>
>> On 1/11/24 18:04, Francesco Dolcini wrote:
>>> Hello Tom, Francis
>>>
>>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
>>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
>>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
>>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new shell,
>>>>>> based on LIL, to U-Boot [1, 2].
>>>>>> While one of the goals of this contribution was to address the fact actual
>>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
>>>>>> discussion
>>>>>> about adding a new shell versus updating the actual one [3, 4].
>>>>>>
>>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot shell
>>>>>> to reflect what is currently in Busybox source code.
>>>>>> Basically, this contribution is about taking a snapshot of Busybox
>>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit
>>>>>> U-Boot needs.
>>>>>>
>>>>>> [...]
>>>>>
>>>>> Applied to u-boot/next, thanks!
>>>>
>>>> Thank you for the merge!
>>>> If there is any problem, do not hesitate to mail me and I will take care of 
>>>> it!
>>>
>>> This change, specifically setting the modern hush shell as default, is
>>> breaking our boot script, just noticed since the current U-Boot master
>>> has a regression for us.
>>>
>>> We still need to figure out the exact details, here [1] you can find the
>>> boot script (that has some placeholder that is replaced during build).
>>>
>>> and the error is something like:
>>>
>>> ```
>>> ## Executing script at 90280000
>>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
>>> 69025 bytes read in 11 ms (6 MiB/s)
>>> 82 bytes read in 9 ms (8.8 KiB/s)
>>> Working FDT set to 90200000
>>> syntax error at 'done'HUSH died!
>>> resetting ...
>>> ```
>>>
>>> that I _assume_ comes from this line
>>>
>>>     env set set_apply_overlays 'env set apply_overlays "for overlay_file in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt apply \\${loadaddr}; env set overlay_file; done; true"'
>>>
>>> [1] https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in
>>>
>>> Francesco
>>>
>>
>>
>> Hi all
>>
>> I observed a similar issue with STM32MP157c-DK2 board.
>> Since commit 78912cfde281 ("cmd: Set modern hush as default shell") U-Boot crashes :
> 
> I wonder if:
> https://patchwork.ozlabs.org/project/uboot/patch/20240115134656.50917-1-heinrich.schuchardt@canonical.com/
> is relevant to this problem or not.
> 

Hi Tom

Unfortunately, it doesn't help :-(

Thanks
Patrice
Francis Laniel Jan. 16, 2024, 5:20 p.m. UTC | #7
Hi!


Le vendredi 12 janvier 2024, 00:04:18 +07 Francesco Dolcini a écrit :
> Hello Tom, Francis
> 
> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> > Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> > > On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> > > > During 2021 summer, Sean Anderson wrote a contribution to add a new
> > > > shell,
> > > > based on LIL, to U-Boot [1, 2].
> > > > While one of the goals of this contribution was to address the fact
> > > > actual
> > > > U-Boot shell, which is based on Busybox hush, is old there was a
> > > > discussion
> > > > about adding a new shell versus updating the actual one [3, 4].
> > > > 
> > > > So, in this series, with Harald Seiler, we updated the actual U-Boot
> > > > shell
> > > > to reflect what is currently in Busybox source code.
> > > > Basically, this contribution is about taking a snapshot of Busybox
> > > > shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
> > > > suit
> > > > U-Boot needs.
> > > > 
> > > > [...]
> > > 
> > > Applied to u-boot/next, thanks!
> > 
> > Thank you for the merge!
> > If there is any problem, do not hesitate to mail me and I will take care
> > of
> > it!
> 
> This change, specifically setting the modern hush shell as default, is
> breaking our boot script, just noticed since the current U-Boot master
> has a regression for us.
> 
> We still need to figure out the exact details, here [1] you can find the
> boot script (that has some placeholder that is replaced during build).
> 
> and the error is something like:
> 
> ```
> ## Executing script at 90280000
> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> 69025 bytes read in 11 ms (6 MiB/s)
> 82 bytes read in 9 ms (8.8 KiB/s)
> Working FDT set to 90200000
> syntax error at 'done'HUSH died!
> resetting ...
> ```
> 
> that I _assume_ comes from this line
> 
>     env set set_apply_overlays 'env set apply_overlays "for overlay_file in
> \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
> ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt
> apply \\${loadaddr}; env set overlay_file; done; true"'

Sorry for the inconvenience, I tried to reproduce on my side and noticed some 
strange behavior.
For the moment, can you please try to only escape "$" with "\$ and not "\\$"?
I would like to confirm some insights I have.

> [1]
> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp/u
> -boot/u-boot-distro-boot/boot.cmd.in
> 
> Francesco

Best regards.
Francis Laniel Jan. 16, 2024, 5:25 p.m. UTC | #8
Hi!


Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
> On 1/11/24 18:04, Francesco Dolcini wrote:
> > Hello Tom, Francis
> > 
> > On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> >> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> >>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> >>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
> >>>> shell,
> >>>> based on LIL, to U-Boot [1, 2].
> >>>> While one of the goals of this contribution was to address the fact
> >>>> actual
> >>>> U-Boot shell, which is based on Busybox hush, is old there was a
> >>>> discussion
> >>>> about adding a new shell versus updating the actual one [3, 4].
> >>>> 
> >>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
> >>>> shell
> >>>> to reflect what is currently in Busybox source code.
> >>>> Basically, this contribution is about taking a snapshot of Busybox
> >>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
> >>>> suit
> >>>> U-Boot needs.
> >>>> 
> >>>> [...]
> >>> 
> >>> Applied to u-boot/next, thanks!
> >> 
> >> Thank you for the merge!
> >> If there is any problem, do not hesitate to mail me and I will take care
> >> of
> >> it!
> > 
> > This change, specifically setting the modern hush shell as default, is
> > breaking our boot script, just noticed since the current U-Boot master
> > has a regression for us.
> > 
> > We still need to figure out the exact details, here [1] you can find the
> > boot script (that has some placeholder that is replaced during build).
> > 
> > and the error is something like:
> > 
> > ```
> > ## Executing script at 90280000
> > Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> > 69025 bytes read in 11 ms (6 MiB/s)
> > 82 bytes read in 9 ms (8.8 KiB/s)
> > Working FDT set to 90200000
> > syntax error at 'done'HUSH died!
> > resetting ...
> > ```
> > 
> > that I _assume_ comes from this line
> > 
> >     env set set_apply_overlays 'env set apply_overlays "for overlay_file
> >     in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
> >     ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
> >     fdt apply \\${loadaddr}; env set overlay_file; done; true"'> 
> > [1]
> > https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp
> > /u-boot/u-boot-distro-boot/boot.cmd.in
> > 
> > Francesco
> 
> Hi all
> 
> I observed a similar issue with STM32MP157c-DK2 board.
> Since commit 78912cfde281 ("cmd: Set modern hush as default shell") U-Boot
> crashes :
> 
> 
> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> 
> CPU: STM32MP157CAC Rev.B
> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> Board: MB1272 Var2.0 Rev.C-01
> DRAM:  512 MiB
> Clocks:
> - MPU : 650 MHz
> - MCU : 208.878 MHz
> - AXI : 266.500 MHz
> - PER : 24 MHz
> - DDR : 533 MHz
> optee optee: OP-TEE: revision 4.0 (e92de4ca)
> I/TC: Reserved shared memory is disabled
> I/TC: Dynamic shared memory is enabled
> I/TC: Normal World virtualization support is disabled
> I/TC: Asynchronous notifications are disabled
> Core:  311 devices, 40 uclasses, devicetree: board
> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
> NAND:  0 MiB
> MMC:   STM32 SD/MMC: 0
> Loading Environment from MMC... OK
> In:    No input devices available!
> Out:   No output devices available!
> Err:   No error devices available!
> Net:   eth0: ethernet@5800a000
> Hit any key to stop autoboot:  0
> Boot over mmc0!
> switch to partitions #0, OK
> mmc0 is current device
> Scanning mmc 0:8...
> data abort
> pc : [<ddb3f77a>]          lr : [<ddb44c95>]
> reloc pc : [<c012777a>]    lr : [<c012cc95>]
> sp : dbafc848  ip : ddbfc578     fp : ddbedf18
> r10: 00000000  r9 : dbb15e70     r8 : 00000000
> r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
> r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> Code: 3138 1c48 f854 0030 (eb04) 05c1
> Resetting CPU ...
> 
> 
> It crashes in blkcache_fill() , i didn't investigate deeply into this issue
> yet, but i can reproduce this issue by stopping autoboot by pressing a key
> and running a environment command as shown below :
> 
> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> 
> CPU: STM32MP157CAC Rev.B
> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> Board: MB1272 Var2.0 Rev.C-01
> DRAM:  512 MiB
> Clocks:
> - MPU : 650 MHz
> - MCU : 208.878 MHz
> - AXI : 266.500 MHz
> - PER : 24 MHz
> - DDR : 533 MHz
> optee optee: OP-TEE: revision 4.0 (e92de4ca)
> I/TC: Reserved shared memory is disabled
> I/TC: Dynamic shared memory is enabled
> I/TC: Normal World virtualization support is disabled
> I/TC: Asynchronous notifications are disabled
> Core:  311 devices, 40 uclasses, devicetree: board
> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
> NAND:  0 MiB
> MMC:   STM32 SD/MMC: 0
> Loading Environment from MMC... OK
> In:    No input devices available!
> Out:   No output devices available!
> Err:   No error devices available!
> Net:   eth0: ethernet@5800a000
> Hit any key to stop autoboot:  0
> STM32MP>
> STM32MP>
> 
> 
> Then i run "printenv" :
> 
> STM32MP> printenv
> arch=arm
> autoload=0
> baudrate=115200
> board=stm32mp1
> board_id=0x1272
> board_name=stm32mp157c-dk2
> board_rev=0x000c
> boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr}
> ${prefix}${script}; source ${scriptaddr} boot_auth=0
> boot_device=mmc
> boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart}
> ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr -q ${fdt_addr_r}; then
> bootefi ${kernel_addr_r} ${fdt_i boot_efi_bootmgr=if fdt addr -q
> ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
> boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any
> ${scriptaddr} ${prefix}${boot_syslinux_conf} boot_instance=0
> boot_net_usb_start=true
> boot_part=1
> boot_prefixes=/ /boot/
> boot_script_dhcp=boot.scr.uimg
> boot_scripts=boot.scr.uimg boot.scr
> boot_syslinux_conf=extlinux/extlinux.conf
> boot_targets=mmc1 ubifs0 mmc0 mmc2 usb0 pxe
> bootcmd=run bootcmd_stm32mp
> bootcmd_mmc0=devnum=0; run mmc_boot
> bootcmd_mmc1=devnum=1; run mmc_boot
> bootcmd_mmc2=devnum=2; run mmc_boot
> bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
> bootcmd_stm32mp=echo "Boot over ${boot_device}${boot_instance}!";if test
> ${boot_device} = serial || test ${boot_device} = usb;then stm32prog
> ${boot_device} ${boot_ins; bootcmd_ubifs0=bootubipart=UBI; bootubivol=boot;
> bootubioff=; run ubifs_boot bootcmd_usb0=devnum=0; run usb_boot
> bootdelay=1
> console=ttySTM0
> cpu=armv7
> distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
> efi_dtb_prefixes=/ /dtb/ /dtb/current/
> env_check=if env info -p -d -q; then env save; fi
> ethaddr=00:80:e1:42:48:f9
> fdt_addr_r=0xc4000000
> fdtcontroladdr=dbafd730
> fdtfile=stm32mp157c-dk2.dtb
> fdtoverlay_addr_r=0xc4300000
> kernel_addr_r=0xc2000000
> load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r}
> ${prefix}${efi_fdtfile} loadaddr=0xc2000000
> mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part;
> fi pxefile_addr_r=0xc4200000
> ramdisk_addr_r=0xc4400000
> scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...;
> for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run
> scan_dev_for_scripts; do; scan_dev_for_boot_part=part list ${devtype}
> ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for
> distro_bootpart in ${devplist}; do if fstype $t scan_dev_for_efi=setenv
> efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv
> efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efe
> scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart}
> ${prefix}${boot_syslinux_conf}; then echo Found
> ${prefix}${boot_syslinux_conf}; run boot_extli scan_dev_for_scripts=for
> script in ${boot_scripts}; do if test -e ${devtype}
> ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot
> script ${prefix}$e scriptaddr=0xc4100000
> serial#=003700433338511634383330
> serverip=192.168.1.1
> soc=stm32mp
> soc_pkg=AC
> soc_rev=B
> soc_type=157C
> splashimage=0xc2000000
> splashpos=m,m
> ubifs_boot=if ubi part ${bootubipart} ${bootubioff} && ubifsmount
> ubi0:${bootubivol}; then devtype=ubi; devnum=ubi0; bootfstype=ubifs;
> distro_bootpart=${bootubivol}; i usb_boot=usb start; if usb dev ${devnum};
> then devtype=usb; run scan_dev_for_boot_part; fi usb_pgood_delay=2000
> vendor=st
> 
> Environment size: 4321/8187 bytes
> 
> 
> and after i execute "run bootcmd_mmc0"
> 
> STM32MP> run bootcmd_mmc0
> switch to partitions #0, OK
> mmc0 is current device
> Scanning mmc 0:8...
> data abort
> pc : [<ddb3f7a4>]          lr : [<ddb44c95>]
> reloc pc : [<c01277a4>]    lr : [<c012cc95>]
> sp : dbafcad8  ip : ddbfc578     fp : ddbedf18
> r10: 00000000  r9 : dbb15e70     r8 : 00000000
> r7 : dbb5f700  r6 : dbb615b8     r5 : dbb5f700  r4 : ddbeda78
> r3 : dbb613b0  r2 : 00005c50     r1 : 0000002e  r0 : 00005c51
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> Code: 315b e7e9 2954 d802 (0b11) 316e
> Resetting CPU ...
> 
> resetting ...
> 

Again, sorry for the troubles caused...
With regard to crashing in blkcache_fill() I suspect this is because some input 
data are wrong due to error in hush.
I am not really sure to understand how you reproduced it. Do you need to run 
printenv before to generate the bug?
Also, can you please check the value of scan_dev_for_boot_part? I am wondering 
if something is wrong with variable expansion and escaping character.

> Thanks
> Patrice


Best regards.
Patrice CHOTARD Jan. 17, 2024, 10:05 a.m. UTC | #9
On 1/16/24 18:25, Francis Laniel wrote:
> Hi!
> 
> 
> Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
>> On 1/11/24 18:04, Francesco Dolcini wrote:
>>> Hello Tom, Francis
>>>
>>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
>>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
>>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
>>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
>>>>>> shell,
>>>>>> based on LIL, to U-Boot [1, 2].
>>>>>> While one of the goals of this contribution was to address the fact
>>>>>> actual
>>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
>>>>>> discussion
>>>>>> about adding a new shell versus updating the actual one [3, 4].
>>>>>>
>>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
>>>>>> shell
>>>>>> to reflect what is currently in Busybox source code.
>>>>>> Basically, this contribution is about taking a snapshot of Busybox
>>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
>>>>>> suit
>>>>>> U-Boot needs.
>>>>>>
>>>>>> [...]
>>>>>
>>>>> Applied to u-boot/next, thanks!
>>>>
>>>> Thank you for the merge!
>>>> If there is any problem, do not hesitate to mail me and I will take care
>>>> of
>>>> it!
>>>
>>> This change, specifically setting the modern hush shell as default, is
>>> breaking our boot script, just noticed since the current U-Boot master
>>> has a regression for us.
>>>
>>> We still need to figure out the exact details, here [1] you can find the
>>> boot script (that has some placeholder that is replaced during build).
>>>
>>> and the error is something like:
>>>
>>> ```
>>> ## Executing script at 90280000
>>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
>>> 69025 bytes read in 11 ms (6 MiB/s)
>>> 82 bytes read in 9 ms (8.8 KiB/s)
>>> Working FDT set to 90200000
>>> syntax error at 'done'HUSH died!
>>> resetting ...
>>> ```
>>>
>>> that I _assume_ comes from this line
>>>
>>>     env set set_apply_overlays 'env set apply_overlays "for overlay_file
>>>     in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
>>>     ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
>>>     fdt apply \\${loadaddr}; env set overlay_file; done; true"'> 
>>> [1]
>>> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp
>>> /u-boot/u-boot-distro-boot/boot.cmd.in
>>>
>>> Francesco
>>
>> Hi all
>>
>> I observed a similar issue with STM32MP157c-DK2 board.
>> Since commit 78912cfde281 ("cmd: Set modern hush as default shell") U-Boot
>> crashes :
>>
>>
>> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
>>
>> CPU: STM32MP157CAC Rev.B
>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
>> Board: MB1272 Var2.0 Rev.C-01
>> DRAM:  512 MiB
>> Clocks:
>> - MPU : 650 MHz
>> - MCU : 208.878 MHz
>> - AXI : 266.500 MHz
>> - PER : 24 MHz
>> - DDR : 533 MHz
>> optee optee: OP-TEE: revision 4.0 (e92de4ca)
>> I/TC: Reserved shared memory is disabled
>> I/TC: Dynamic shared memory is enabled
>> I/TC: Normal World virtualization support is disabled
>> I/TC: Asynchronous notifications are disabled
>> Core:  311 devices, 40 uclasses, devicetree: board
>> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
>> NAND:  0 MiB
>> MMC:   STM32 SD/MMC: 0
>> Loading Environment from MMC... OK
>> In:    No input devices available!
>> Out:   No output devices available!
>> Err:   No error devices available!
>> Net:   eth0: ethernet@5800a000
>> Hit any key to stop autoboot:  0
>> Boot over mmc0!
>> switch to partitions #0, OK
>> mmc0 is current device
>> Scanning mmc 0:8...
>> data abort
>> pc : [<ddb3f77a>]          lr : [<ddb44c95>]
>> reloc pc : [<c012777a>]    lr : [<c012cc95>]
>> sp : dbafc848  ip : ddbfc578     fp : ddbedf18
>> r10: 00000000  r9 : dbb15e70     r8 : 00000000
>> r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
>> r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
>> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
>> Code: 3138 1c48 f854 0030 (eb04) 05c1
>> Resetting CPU ...
>>
>>
>> It crashes in blkcache_fill() , i didn't investigate deeply into this issue
>> yet, but i can reproduce this issue by stopping autoboot by pressing a key
>> and running a environment command as shown below :
>>
>> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
>>
>> CPU: STM32MP157CAC Rev.B
>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
>> Board: MB1272 Var2.0 Rev.C-01
>> DRAM:  512 MiB
>> Clocks:
>> - MPU : 650 MHz
>> - MCU : 208.878 MHz
>> - AXI : 266.500 MHz
>> - PER : 24 MHz
>> - DDR : 533 MHz
>> optee optee: OP-TEE: revision 4.0 (e92de4ca)
>> I/TC: Reserved shared memory is disabled
>> I/TC: Dynamic shared memory is enabled
>> I/TC: Normal World virtualization support is disabled
>> I/TC: Asynchronous notifications are disabled
>> Core:  311 devices, 40 uclasses, devicetree: board
>> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
>> NAND:  0 MiB
>> MMC:   STM32 SD/MMC: 0
>> Loading Environment from MMC... OK
>> In:    No input devices available!
>> Out:   No output devices available!
>> Err:   No error devices available!
>> Net:   eth0: ethernet@5800a000
>> Hit any key to stop autoboot:  0
>> STM32MP>
>> STM32MP>
>>
>>
>> Then i run "printenv" :
>>
>> STM32MP> printenv
>> arch=arm
>> autoload=0
>> baudrate=115200
>> board=stm32mp1
>> board_id=0x1272
>> board_name=stm32mp157c-dk2
>> board_rev=0x000c
>> boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr}
>> ${prefix}${script}; source ${scriptaddr} boot_auth=0
>> boot_device=mmc
>> boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart}
>> ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr -q ${fdt_addr_r}; then
>> bootefi ${kernel_addr_r} ${fdt_i boot_efi_bootmgr=if fdt addr -q
>> ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
>> boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any
>> ${scriptaddr} ${prefix}${boot_syslinux_conf} boot_instance=0
>> boot_net_usb_start=true
>> boot_part=1
>> boot_prefixes=/ /boot/
>> boot_script_dhcp=boot.scr.uimg
>> boot_scripts=boot.scr.uimg boot.scr
>> boot_syslinux_conf=extlinux/extlinux.conf
>> boot_targets=mmc1 ubifs0 mmc0 mmc2 usb0 pxe
>> bootcmd=run bootcmd_stm32mp
>> bootcmd_mmc0=devnum=0; run mmc_boot
>> bootcmd_mmc1=devnum=1; run mmc_boot
>> bootcmd_mmc2=devnum=2; run mmc_boot
>> bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
>> bootcmd_stm32mp=echo "Boot over ${boot_device}${boot_instance}!";if test
>> ${boot_device} = serial || test ${boot_device} = usb;then stm32prog
>> ${boot_device} ${boot_ins; bootcmd_ubifs0=bootubipart=UBI; bootubivol=boot;
>> bootubioff=; run ubifs_boot bootcmd_usb0=devnum=0; run usb_boot
>> bootdelay=1
>> console=ttySTM0
>> cpu=armv7
>> distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
>> efi_dtb_prefixes=/ /dtb/ /dtb/current/
>> env_check=if env info -p -d -q; then env save; fi
>> ethaddr=00:80:e1:42:48:f9
>> fdt_addr_r=0xc4000000
>> fdtcontroladdr=dbafd730
>> fdtfile=stm32mp157c-dk2.dtb
>> fdtoverlay_addr_r=0xc4300000
>> kernel_addr_r=0xc2000000
>> load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r}
>> ${prefix}${efi_fdtfile} loadaddr=0xc2000000
>> mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part;
>> fi pxefile_addr_r=0xc4200000
>> ramdisk_addr_r=0xc4400000
>> scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...;
>> for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run
>> scan_dev_for_scripts; do; scan_dev_for_boot_part=part list ${devtype}
>> ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for
>> distro_bootpart in ${devplist}; do if fstype $t scan_dev_for_efi=setenv
>> efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv
>> efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efe
>> scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart}
>> ${prefix}${boot_syslinux_conf}; then echo Found
>> ${prefix}${boot_syslinux_conf}; run boot_extli scan_dev_for_scripts=for
>> script in ${boot_scripts}; do if test -e ${devtype}
>> ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot
>> script ${prefix}$e scriptaddr=0xc4100000
>> serial#=003700433338511634383330
>> serverip=192.168.1.1
>> soc=stm32mp
>> soc_pkg=AC
>> soc_rev=B
>> soc_type=157C
>> splashimage=0xc2000000
>> splashpos=m,m
>> ubifs_boot=if ubi part ${bootubipart} ${bootubioff} && ubifsmount
>> ubi0:${bootubivol}; then devtype=ubi; devnum=ubi0; bootfstype=ubifs;
>> distro_bootpart=${bootubivol}; i usb_boot=usb start; if usb dev ${devnum};
>> then devtype=usb; run scan_dev_for_boot_part; fi usb_pgood_delay=2000
>> vendor=st
>>
>> Environment size: 4321/8187 bytes
>>
>>
>> and after i execute "run bootcmd_mmc0"
>>
>> STM32MP> run bootcmd_mmc0
>> switch to partitions #0, OK
>> mmc0 is current device
>> Scanning mmc 0:8...
>> data abort
>> pc : [<ddb3f7a4>]          lr : [<ddb44c95>]
>> reloc pc : [<c01277a4>]    lr : [<c012cc95>]
>> sp : dbafcad8  ip : ddbfc578     fp : ddbedf18
>> r10: 00000000  r9 : dbb15e70     r8 : 00000000
>> r7 : dbb5f700  r6 : dbb615b8     r5 : dbb5f700  r4 : ddbeda78
>> r3 : dbb613b0  r2 : 00005c50     r1 : 0000002e  r0 : 00005c51
>> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
>> Code: 315b e7e9 2954 d802 (0b11) 316e
>> Resetting CPU ...
>>
>> resetting ...
>>
> 

Hi Francis

> Again, sorry for the troubles caused...
> With regard to crashing in blkcache_fill() I suspect this is because some input 
> data are wrong due to error in hush.

I got additionnal information, the crash occurs more precisely in blkcache_invalidate() 
when executing "free(node->cache);"

Another information, the issue doesn't occurs if the partition, on which we attempt to read,
is formatted in EXT4. In my case, the partition is formatted in FAT.


> I am not really sure to understand how you reproduced it. Do you need to run 
> printenv before to generate the bug?

No, the printenv is not necessary, it was just to give some clue just in case.

> Also, can you please check the value of scan_dev_for_boot_part? I am wondering 
> if something is wrong with variable expansion and escaping character.

I finally succeed to reproduce the issue with limited action :

U-Boot 2024.01-00486-g697758e7c81 (Jan 17 2024 - 09:14:46 +0100)

CPU: STM32MP157CAC Rev.B
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
Board: MB1272 Var2.0 Rev.C-01
DRAM:  512 MiB
Clocks:
- MPU : 650 MHz
- MCU : 208.878 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
optee optee: OP-TEE: revision 4.0 (a441cdcf)
I/TC: Reserved shared memory is disabled
I/TC: Dynamic shared memory is enabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are disabled
Core:  311 devices, 40 uclasses, devicetree: board
WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
NAND:  0 MiB
MMC:   STM32 SD/MMC: 0
Loading Environment from MMC... Invalid ENV offset in MMC, copy=0
In:    No input devices available!
Out:   No output devices available!
Err:   No error devices available!
Net:   eth0: ethernet@5800a000
Hit any key to stop autoboot:  0 
STM32MP> ls mmc 0:8
     5545   boot.scr.uimg
            mmc0_extlinux/
            mmc1_extlinux/
            nand0_extlinux/
    18244   splash.bmp
   384894   splash_yellow.bmp
  6243746   st-image-resize-initrd
    44390   stm32mp135f-dk.dtb
    98349   stm32mp157c-dk2-scmi.dtb
    97393   stm32mp157c-dk2.dtb
    98101   stm32mp157c-ev1-scmi.dtb
    97137   stm32mp157c-ev1.dtb
     1248   ubootefi.var
            uefi-certificates/
  8761856   zImage
  8057344   zImage-6.7.0-rt-rt1
  8763400   zImage.signed

13 file(s), 4 dir(s)

STM32MP> env set list 1 boot.scr.uimg splash.bmp
STM32MP> env print list
list=1 boot.scr.uimg splash.bmp
STM32MP> for i in ${list}; do if test -e mmc 0:8 ${i}; then echo ${i} found;else echo ${i} not found;fi; done;
1 not found
boot.scr.uimg found
splash.bmp found
data abort
pc : [<ddb3f72a>]          lr : [<ddb39da1>]
reloc pc : [<c012772a>]    lr : [<c0121da1>]
sp : dbafd370  ip : 00000000     fp : 00000017
r10: dbb5d5fc  r9 : dbb15e70     r8 : 0000001c
r7 : ddbedaa8  r6 : dbb5d640     r5 : 6873616c  r4 : ddbeda78
r3 : dbb5d5d0  r2 : 00000080     r1 : 00000000  r0 : 70733d69
Flags: NzcV  IRQs off  FIQs off  Mode SVC_32 (T)
Code: e7e9 2101 e7e7 68f5 (60c5) 60a8 
Resetting CPU ...


Hope it helps ;-)

Patrice

> 
>> Thanks
>> Patrice
> 
> 
> Best regards.
> 
>
Francis Laniel Jan. 17, 2024, 5:30 p.m. UTC | #10
Hi!


Le mercredi 17 janvier 2024, 17:05:28 +07 Patrice CHOTARD a écrit :
> On 1/16/24 18:25, Francis Laniel wrote:
> > Hi!
> > 
> > Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
> >> On 1/11/24 18:04, Francesco Dolcini wrote:
> >>> Hello Tom, Francis
> >>> 
> >>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> >>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> >>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> >>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
> >>>>>> shell,
> >>>>>> based on LIL, to U-Boot [1, 2].
> >>>>>> While one of the goals of this contribution was to address the fact
> >>>>>> actual
> >>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
> >>>>>> discussion
> >>>>>> about adding a new shell versus updating the actual one [3, 4].
> >>>>>> 
> >>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
> >>>>>> shell
> >>>>>> to reflect what is currently in Busybox source code.
> >>>>>> Basically, this contribution is about taking a snapshot of Busybox
> >>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
> >>>>>> suit
> >>>>>> U-Boot needs.
> >>>>>> 
> >>>>>> [...]
> >>>>> 
> >>>>> Applied to u-boot/next, thanks!
> >>>> 
> >>>> Thank you for the merge!
> >>>> If there is any problem, do not hesitate to mail me and I will take
> >>>> care
> >>>> of
> >>>> it!
> >>> 
> >>> This change, specifically setting the modern hush shell as default, is
> >>> breaking our boot script, just noticed since the current U-Boot master
> >>> has a regression for us.
> >>> 
> >>> We still need to figure out the exact details, here [1] you can find the
> >>> boot script (that has some placeholder that is replaced during build).
> >>> 
> >>> and the error is something like:
> >>> 
> >>> ```
> >>> ## Executing script at 90280000
> >>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> >>> 69025 bytes read in 11 ms (6 MiB/s)
> >>> 82 bytes read in 9 ms (8.8 KiB/s)
> >>> Working FDT set to 90200000
> >>> syntax error at 'done'HUSH died!
> >>> resetting ...
> >>> ```
> >>> 
> >>> that I _assume_ comes from this line
> >>> 
> >>>     env set set_apply_overlays 'env set apply_overlays "for overlay_file
> >>>     in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
> >>>     ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
> >>>     fdt apply \\${loadaddr}; env set overlay_file; done; true"'>
> >>> 
> >>> [1]
> >>> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bs
> >>> p
> >>> /u-boot/u-boot-distro-boot/boot.cmd.in
> >>> 
> >>> Francesco
> >> 
> >> Hi all
> >> 
> >> I observed a similar issue with STM32MP157c-DK2 board.
> >> Since commit 78912cfde281 ("cmd: Set modern hush as default shell")
> >> U-Boot
> >> crashes :
> >> 
> >> 
> >> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> >> 
> >> CPU: STM32MP157CAC Rev.B
> >> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> >> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> >> Board: MB1272 Var2.0 Rev.C-01
> >> DRAM:  512 MiB
> >> Clocks:
> >> - MPU : 650 MHz
> >> - MCU : 208.878 MHz
> >> - AXI : 266.500 MHz
> >> - PER : 24 MHz
> >> - DDR : 533 MHz
> >> optee optee: OP-TEE: revision 4.0 (e92de4ca)
> >> I/TC: Reserved shared memory is disabled
> >> I/TC: Dynamic shared memory is enabled
> >> I/TC: Normal World virtualization support is disabled
> >> I/TC: Asynchronous notifications are disabled
> >> Core:  311 devices, 40 uclasses, devicetree: board
> >> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s
> >> timeout)
> >> NAND:  0 MiB
> >> MMC:   STM32 SD/MMC: 0
> >> Loading Environment from MMC... OK
> >> In:    No input devices available!
> >> Out:   No output devices available!
> >> Err:   No error devices available!
> >> Net:   eth0: ethernet@5800a000
> >> Hit any key to stop autoboot:  0
> >> Boot over mmc0!
> >> switch to partitions #0, OK
> >> mmc0 is current device
> >> Scanning mmc 0:8...
> >> data abort
> >> pc : [<ddb3f77a>]          lr : [<ddb44c95>]
> >> reloc pc : [<c012777a>]    lr : [<c012cc95>]
> >> sp : dbafc848  ip : ddbfc578     fp : ddbedf18
> >> r10: 00000000  r9 : dbb15e70     r8 : 00000000
> >> r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
> >> r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
> >> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> >> Code: 3138 1c48 f854 0030 (eb04) 05c1
> >> Resetting CPU ...
> >> 
> >> 
> >> It crashes in blkcache_fill() , i didn't investigate deeply into this
> >> issue
> >> yet, but i can reproduce this issue by stopping autoboot by pressing a
> >> key
> >> and running a environment command as shown below :
> >> 
> >> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> >> 
> >> CPU: STM32MP157CAC Rev.B
> >> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> >> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> >> Board: MB1272 Var2.0 Rev.C-01
> >> DRAM:  512 MiB
> >> Clocks:
> >> - MPU : 650 MHz
> >> - MCU : 208.878 MHz
> >> - AXI : 266.500 MHz
> >> - PER : 24 MHz
> >> - DDR : 533 MHz
> >> optee optee: OP-TEE: revision 4.0 (e92de4ca)
> >> I/TC: Reserved shared memory is disabled
> >> I/TC: Dynamic shared memory is enabled
> >> I/TC: Normal World virtualization support is disabled
> >> I/TC: Asynchronous notifications are disabled
> >> Core:  311 devices, 40 uclasses, devicetree: board
> >> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s
> >> timeout)
> >> NAND:  0 MiB
> >> MMC:   STM32 SD/MMC: 0
> >> Loading Environment from MMC... OK
> >> In:    No input devices available!
> >> Out:   No output devices available!
> >> Err:   No error devices available!
> >> Net:   eth0: ethernet@5800a000
> >> Hit any key to stop autoboot:  0
> >> STM32MP>
> >> STM32MP>
> >> 
> >> 
> >> Then i run "printenv" :
> >> 
> >> STM32MP> printenv
> >> arch=arm
> >> autoload=0
> >> baudrate=115200
> >> board=stm32mp1
> >> board_id=0x1272
> >> board_name=stm32mp157c-dk2
> >> board_rev=0x000c
> >> boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr}
> >> ${prefix}${script}; source ${scriptaddr} boot_auth=0
> >> boot_device=mmc
> >> boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart}
> >> ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr -q ${fdt_addr_r}; then
> >> bootefi ${kernel_addr_r} ${fdt_i boot_efi_bootmgr=if fdt addr -q
> >> ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
> >> boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any
> >> ${scriptaddr} ${prefix}${boot_syslinux_conf} boot_instance=0
> >> boot_net_usb_start=true
> >> boot_part=1
> >> boot_prefixes=/ /boot/
> >> boot_script_dhcp=boot.scr.uimg
> >> boot_scripts=boot.scr.uimg boot.scr
> >> boot_syslinux_conf=extlinux/extlinux.conf
> >> boot_targets=mmc1 ubifs0 mmc0 mmc2 usb0 pxe
> >> bootcmd=run bootcmd_stm32mp
> >> bootcmd_mmc0=devnum=0; run mmc_boot
> >> bootcmd_mmc1=devnum=1; run mmc_boot
> >> bootcmd_mmc2=devnum=2; run mmc_boot
> >> bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
> >> bootcmd_stm32mp=echo "Boot over ${boot_device}${boot_instance}!";if test
> >> ${boot_device} = serial || test ${boot_device} = usb;then stm32prog
> >> ${boot_device} ${boot_ins; bootcmd_ubifs0=bootubipart=UBI;
> >> bootubivol=boot;
> >> bootubioff=; run ubifs_boot bootcmd_usb0=devnum=0; run usb_boot
> >> bootdelay=1
> >> console=ttySTM0
> >> cpu=armv7
> >> distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target};
> >> done efi_dtb_prefixes=/ /dtb/ /dtb/current/
> >> env_check=if env info -p -d -q; then env save; fi
> >> ethaddr=00:80:e1:42:48:f9
> >> fdt_addr_r=0xc4000000
> >> fdtcontroladdr=dbafd730
> >> fdtfile=stm32mp157c-dk2.dtb
> >> fdtoverlay_addr_r=0xc4300000
> >> kernel_addr_r=0xc2000000
> >> load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r}
> >> ${prefix}${efi_fdtfile} loadaddr=0xc2000000
> >> mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run
> >> scan_dev_for_boot_part; fi pxefile_addr_r=0xc4200000
> >> ramdisk_addr_r=0xc4400000
> >> scan_dev_for_boot=echo Scanning ${devtype}
> >> ${devnum}:${distro_bootpart}...;
> >> for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run
> >> scan_dev_for_scripts; do; scan_dev_for_boot_part=part list ${devtype}
> >> ${devnum} -bootable devplist; env exists devplist || setenv devplist 1;
> >> for
> >> distro_bootpart in ${devplist}; do if fstype $t scan_dev_for_efi=setenv
> >> efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then
> >> setenv
> >> efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efe
> >> scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart}
> >> ${prefix}${boot_syslinux_conf}; then echo Found
> >> ${prefix}${boot_syslinux_conf}; run boot_extli scan_dev_for_scripts=for
> >> script in ${boot_scripts}; do if test -e ${devtype}
> >> ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot
> >> script ${prefix}$e scriptaddr=0xc4100000
> >> serial#=003700433338511634383330
> >> serverip=192.168.1.1
> >> soc=stm32mp
> >> soc_pkg=AC
> >> soc_rev=B
> >> soc_type=157C
> >> splashimage=0xc2000000
> >> splashpos=m,m
> >> ubifs_boot=if ubi part ${bootubipart} ${bootubioff} && ubifsmount
> >> ubi0:${bootubivol}; then devtype=ubi; devnum=ubi0; bootfstype=ubifs;
> >> distro_bootpart=${bootubivol}; i usb_boot=usb start; if usb dev
> >> ${devnum};
> >> then devtype=usb; run scan_dev_for_boot_part; fi usb_pgood_delay=2000
> >> vendor=st
> >> 
> >> Environment size: 4321/8187 bytes
> >> 
> >> 
> >> and after i execute "run bootcmd_mmc0"
> >> 
> >> STM32MP> run bootcmd_mmc0
> >> switch to partitions #0, OK
> >> mmc0 is current device
> >> Scanning mmc 0:8...
> >> data abort
> >> pc : [<ddb3f7a4>]          lr : [<ddb44c95>]
> >> reloc pc : [<c01277a4>]    lr : [<c012cc95>]
> >> sp : dbafcad8  ip : ddbfc578     fp : ddbedf18
> >> r10: 00000000  r9 : dbb15e70     r8 : 00000000
> >> r7 : dbb5f700  r6 : dbb615b8     r5 : dbb5f700  r4 : ddbeda78
> >> r3 : dbb613b0  r2 : 00005c50     r1 : 0000002e  r0 : 00005c51
> >> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> >> Code: 315b e7e9 2954 d802 (0b11) 316e
> >> Resetting CPU ...
> >> 
> >> resetting ...
> 
> Hi Francis
> 
> > Again, sorry for the troubles caused...
> > With regard to crashing in blkcache_fill() I suspect this is because some
> > input data are wrong due to error in hush.
> 
> I got additionnal information, the crash occurs more precisely in
> blkcache_invalidate() when executing "free(node->cache);"
> 
> Another information, the issue doesn't occurs if the partition, on which we
> attempt to read, is formatted in EXT4. In my case, the partition is
> formatted in FAT.
> > I am not really sure to understand how you reproduced it. Do you need to
> > run printenv before to generate the bug?
> 
> No, the printenv is not necessary, it was just to give some clue just in
> case.
> > Also, can you please check the value of scan_dev_for_boot_part? I am
> > wondering if something is wrong with variable expansion and escaping
> > character.
> I finally succeed to reproduce the issue with limited action :
> 
> U-Boot 2024.01-00486-g697758e7c81 (Jan 17 2024 - 09:14:46 +0100)
> 
> CPU: STM32MP157CAC Rev.B
> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> Board: MB1272 Var2.0 Rev.C-01
> DRAM:  512 MiB
> Clocks:
> - MPU : 650 MHz
> - MCU : 208.878 MHz
> - AXI : 266.500 MHz
> - PER : 24 MHz
> - DDR : 533 MHz
> optee optee: OP-TEE: revision 4.0 (a441cdcf)
> I/TC: Reserved shared memory is disabled
> I/TC: Dynamic shared memory is enabled
> I/TC: Normal World virtualization support is disabled
> I/TC: Asynchronous notifications are disabled
> Core:  311 devices, 40 uclasses, devicetree: board
> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s timeout)
> NAND:  0 MiB
> MMC:   STM32 SD/MMC: 0
> Loading Environment from MMC... Invalid ENV offset in MMC, copy=0
> In:    No input devices available!
> Out:   No output devices available!
> Err:   No error devices available!
> Net:   eth0: ethernet@5800a000
> Hit any key to stop autoboot:  0
> STM32MP> ls mmc 0:8
>      5545   boot.scr.uimg
>             mmc0_extlinux/
>             mmc1_extlinux/
>             nand0_extlinux/
>     18244   splash.bmp
>    384894   splash_yellow.bmp
>   6243746   st-image-resize-initrd
>     44390   stm32mp135f-dk.dtb
>     98349   stm32mp157c-dk2-scmi.dtb
>     97393   stm32mp157c-dk2.dtb
>     98101   stm32mp157c-ev1-scmi.dtb
>     97137   stm32mp157c-ev1.dtb
>      1248   ubootefi.var
>             uefi-certificates/
>   8761856   zImage
>   8057344   zImage-6.7.0-rt-rt1
>   8763400   zImage.signed
> 
> 13 file(s), 4 dir(s)
> 
> STM32MP> env set list 1 boot.scr.uimg splash.bmp
> STM32MP> env print list
> list=1 boot.scr.uimg splash.bmp
> STM32MP> for i in ${list}; do if test -e mmc 0:8 ${i}; then echo ${i}
> found;else echo ${i} not found;fi; done; 1 not found
> boot.scr.uimg found
> splash.bmp found
> data abort
> pc : [<ddb3f72a>]          lr : [<ddb39da1>]
> reloc pc : [<c012772a>]    lr : [<c0121da1>]
> sp : dbafd370  ip : 00000000     fp : 00000017
> r10: dbb5d5fc  r9 : dbb15e70     r8 : 0000001c
> r7 : ddbedaa8  r6 : dbb5d640     r5 : 6873616c  r4 : ddbeda78
> r3 : dbb5d5d0  r2 : 00000080     r1 : 00000000  r0 : 70733d69
> Flags: NzcV  IRQs off  FIQs off  Mode SVC_32 (T)
> Code: e7e9 2101 e7e7 68f5 (60c5) 60a8
> Resetting CPU ...
> 
> 
> Hope it helps ;-)

Thank you for the reproducer!
Here is my hypothesis: something is definitely wrong with the new version which 
then leads to some script misbehaving which then leads to the problem in 
blkcache_invalidate().

I will take a look at the issue, trying to reproduce it and understand the 
root cause.
I cannot give you any ETA for the fix, so for now I can only advise you to 
stick with the old parser.

> Patrice
> 
> >> Thanks
> >> Patrice
> > 
> > Best regards.


Best regards.
Francesco Dolcini Jan. 17, 2024, 5:39 p.m. UTC | #11
On Thu, Jan 18, 2024 at 12:30:42AM +0700, Francis Laniel wrote:
> Le mercredi 17 janvier 2024, 17:05:28 +07 Patrice CHOTARD a écrit :
> > On 1/16/24 18:25, Francis Laniel wrote:
> > > Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
> > >> On 1/11/24 18:04, Francesco Dolcini wrote:
> > >>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> > >>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> > >>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> > >>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
> > >>>>>> shell,
> > >>>>>> based on LIL, to U-Boot [1, 2].
> > >>>>>> While one of the goals of this contribution was to address the fact
> > >>>>>> actual
> > >>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
> > >>>>>> discussion
> > >>>>>> about adding a new shell versus updating the actual one [3, 4].
> > >>>>>> 
> > >>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
> > >>>>>> shell
> > >>>>>> to reflect what is currently in Busybox source code.
> > >>>>>> Basically, this contribution is about taking a snapshot of Busybox
> > >>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
> > >>>>>> suit
> > >>>>>> U-Boot needs.
> > >>>>>> 
> > >>>>>> [...]
> > >>>>> 
> > >>>>> Applied to u-boot/next, thanks!
> > >>>> 
> > >>>> Thank you for the merge!
> > >>>> If there is any problem, do not hesitate to mail me and I will take
> > >>>> care
> > >>>> of
> > >>>> it!
> > >>> 
> > >>> This change, specifically setting the modern hush shell as default, is
> > >>> breaking our boot script, just noticed since the current U-Boot master
> > >>> has a regression for us.
> > >>> 
> > >>> We still need to figure out the exact details, here [1] you can find the
> > >>> boot script (that has some placeholder that is replaced during build).
> > >>> 
> > >>> and the error is something like:
> > >>> 
> > >>> ```
> > >>> ## Executing script at 90280000
> > >>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> > >>> 69025 bytes read in 11 ms (6 MiB/s)
> > >>> 82 bytes read in 9 ms (8.8 KiB/s)
> > >>> Working FDT set to 90200000
> > >>> syntax error at 'done'HUSH died!
> > >>> resetting ...
> > >>> ```
> > >>> 
> > >>> that I _assume_ comes from this line
> > >>> 
> > >>>     env set set_apply_overlays 'env set apply_overlays "for overlay_file
> > >>>     in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
> > >>>     ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
> > >>>     fdt apply \\${loadaddr}; env set overlay_file; done; true"'>
> > >>> 
> > >>> [1]
> > >>> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bs
> > >>> p
> > >>> /u-boot/u-boot-distro-boot/boot.cmd.in
> > >>> 
> > >>> Francesco
> > >> 
> > >> Hi all
> > >> 
> > >> I observed a similar issue with STM32MP157c-DK2 board.
> > >> Since commit 78912cfde281 ("cmd: Set modern hush as default shell")
> > >> U-Boot
> > >> crashes :
> > >> 
> > >> 
> > >> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> > >> 
> > >> CPU: STM32MP157CAC Rev.B
> > >> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> > >> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> > >> Board: MB1272 Var2.0 Rev.C-01
> > >> DRAM:  512 MiB
> > >> Clocks:
> > >> - MPU : 650 MHz
> > >> - MCU : 208.878 MHz
> > >> - AXI : 266.500 MHz
> > >> - PER : 24 MHz
> > >> - DDR : 533 MHz
> > >> optee optee: OP-TEE: revision 4.0 (e92de4ca)
> > >> I/TC: Reserved shared memory is disabled
> > >> I/TC: Dynamic shared memory is enabled
> > >> I/TC: Normal World virtualization support is disabled
> > >> I/TC: Asynchronous notifications are disabled
> > >> Core:  311 devices, 40 uclasses, devicetree: board
> > >> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s
> > >> timeout)
> > >> NAND:  0 MiB
> > >> MMC:   STM32 SD/MMC: 0
> > >> Loading Environment from MMC... OK
> > >> In:    No input devices available!
> > >> Out:   No output devices available!
> > >> Err:   No error devices available!
> > >> Net:   eth0: ethernet@5800a000
> > >> Hit any key to stop autoboot:  0
> > >> Boot over mmc0!
> > >> switch to partitions #0, OK
> > >> mmc0 is current device
> > >> Scanning mmc 0:8...
> > >> data abort
> > >> pc : [<ddb3f77a>]          lr : [<ddb44c95>]
> > >> reloc pc : [<c012777a>]    lr : [<c012cc95>]
> > >> sp : dbafc848  ip : ddbfc578     fp : ddbedf18
> > >> r10: 00000000  r9 : dbb15e70     r8 : 00000000
> > >> r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
> > >> r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
> > >> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> > >> Code: 3138 1c48 f854 0030 (eb04) 05c1
> > >> Resetting CPU ...
> 
> I will take a look at the issue, trying to reproduce it and understand the 
> root cause.
> I cannot give you any ETA for the fix, so for now I can only advise you to 
> stick with the old parser.

Should we revert the change that set the modern hush shell as default
till this is fixed?

This is preventing us to run our automated test suite against current
master. Whatever other issue might be introduced we will not be able to
report.

Tom?

Francesco
Patrice CHOTARD Jan. 18, 2024, 7:05 a.m. UTC | #12
On 1/17/24 18:39, Francesco Dolcini wrote:
> On Thu, Jan 18, 2024 at 12:30:42AM +0700, Francis Laniel wrote:
>> Le mercredi 17 janvier 2024, 17:05:28 +07 Patrice CHOTARD a écrit :
>>> On 1/16/24 18:25, Francis Laniel wrote:
>>>> Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
>>>>> On 1/11/24 18:04, Francesco Dolcini wrote:
>>>>>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
>>>>>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
>>>>>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
>>>>>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
>>>>>>>>> shell,
>>>>>>>>> based on LIL, to U-Boot [1, 2].
>>>>>>>>> While one of the goals of this contribution was to address the fact
>>>>>>>>> actual
>>>>>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
>>>>>>>>> discussion
>>>>>>>>> about adding a new shell versus updating the actual one [3, 4].
>>>>>>>>>
>>>>>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
>>>>>>>>> shell
>>>>>>>>> to reflect what is currently in Busybox source code.
>>>>>>>>> Basically, this contribution is about taking a snapshot of Busybox
>>>>>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
>>>>>>>>> suit
>>>>>>>>> U-Boot needs.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>>
>>>>>>>> Applied to u-boot/next, thanks!
>>>>>>>
>>>>>>> Thank you for the merge!
>>>>>>> If there is any problem, do not hesitate to mail me and I will take
>>>>>>> care
>>>>>>> of
>>>>>>> it!
>>>>>>
>>>>>> This change, specifically setting the modern hush shell as default, is
>>>>>> breaking our boot script, just noticed since the current U-Boot master
>>>>>> has a regression for us.
>>>>>>
>>>>>> We still need to figure out the exact details, here [1] you can find the
>>>>>> boot script (that has some placeholder that is replaced during build).
>>>>>>
>>>>>> and the error is something like:
>>>>>>
>>>>>> ```
>>>>>> ## Executing script at 90280000
>>>>>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
>>>>>> 69025 bytes read in 11 ms (6 MiB/s)
>>>>>> 82 bytes read in 9 ms (8.8 KiB/s)
>>>>>> Working FDT set to 90200000
>>>>>> syntax error at 'done'HUSH died!
>>>>>> resetting ...
>>>>>> ```
>>>>>>
>>>>>> that I _assume_ comes from this line
>>>>>>
>>>>>>     env set set_apply_overlays 'env set apply_overlays "for overlay_file
>>>>>>     in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
>>>>>>     ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
>>>>>>     fdt apply \\${loadaddr}; env set overlay_file; done; true"'>
>>>>>>
>>>>>> [1]
>>>>>> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bs
>>>>>> p
>>>>>> /u-boot/u-boot-distro-boot/boot.cmd.in
>>>>>>
>>>>>> Francesco
>>>>>
>>>>> Hi all
>>>>>
>>>>> I observed a similar issue with STM32MP157c-DK2 board.
>>>>> Since commit 78912cfde281 ("cmd: Set modern hush as default shell")
>>>>> U-Boot
>>>>> crashes :
>>>>>
>>>>>
>>>>> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
>>>>>
>>>>> CPU: STM32MP157CAC Rev.B
>>>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
>>>>> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
>>>>> Board: MB1272 Var2.0 Rev.C-01
>>>>> DRAM:  512 MiB
>>>>> Clocks:
>>>>> - MPU : 650 MHz
>>>>> - MCU : 208.878 MHz
>>>>> - AXI : 266.500 MHz
>>>>> - PER : 24 MHz
>>>>> - DDR : 533 MHz
>>>>> optee optee: OP-TEE: revision 4.0 (e92de4ca)
>>>>> I/TC: Reserved shared memory is disabled
>>>>> I/TC: Dynamic shared memory is enabled
>>>>> I/TC: Normal World virtualization support is disabled
>>>>> I/TC: Asynchronous notifications are disabled
>>>>> Core:  311 devices, 40 uclasses, devicetree: board
>>>>> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s
>>>>> timeout)
>>>>> NAND:  0 MiB
>>>>> MMC:   STM32 SD/MMC: 0
>>>>> Loading Environment from MMC... OK
>>>>> In:    No input devices available!
>>>>> Out:   No output devices available!
>>>>> Err:   No error devices available!
>>>>> Net:   eth0: ethernet@5800a000
>>>>> Hit any key to stop autoboot:  0
>>>>> Boot over mmc0!
>>>>> switch to partitions #0, OK
>>>>> mmc0 is current device
>>>>> Scanning mmc 0:8...
>>>>> data abort
>>>>> pc : [<ddb3f77a>]          lr : [<ddb44c95>]
>>>>> reloc pc : [<c012777a>]    lr : [<c012cc95>]
>>>>> sp : dbafc848  ip : ddbfc578     fp : ddbedf18
>>>>> r10: 00000000  r9 : dbb15e70     r8 : 00000000
>>>>> r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
>>>>> r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
>>>>> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
>>>>> Code: 3138 1c48 f854 0030 (eb04) 05c1
>>>>> Resetting CPU ...
>>
>> I will take a look at the issue, trying to reproduce it and understand the 
>> root cause.
>> I cannot give you any ETA for the fix, so for now I can only advise you to 
>> stick with the old parser.
> 
> Should we revert the change that set the modern hush shell as default
> till this is fixed?
> 
> This is preventing us to run our automated test suite against current
> master. Whatever other issue might be introduced we will not be able to
> report.
> 
> Tom?
> 
> Francesco
> 
> 

Hi 

fully agree with Francesco's proposal.

Thanks
Patrice
Tom Rini Jan. 18, 2024, 2:09 p.m. UTC | #13
On Thu, Jan 18, 2024 at 08:05:15AM +0100, Patrice CHOTARD wrote:
> 
> 
> On 1/17/24 18:39, Francesco Dolcini wrote:
> > On Thu, Jan 18, 2024 at 12:30:42AM +0700, Francis Laniel wrote:
> >> Le mercredi 17 janvier 2024, 17:05:28 +07 Patrice CHOTARD a écrit :
> >>> On 1/16/24 18:25, Francis Laniel wrote:
> >>>> Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
> >>>>> On 1/11/24 18:04, Francesco Dolcini wrote:
> >>>>>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> >>>>>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> >>>>>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> >>>>>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
> >>>>>>>>> shell,
> >>>>>>>>> based on LIL, to U-Boot [1, 2].
> >>>>>>>>> While one of the goals of this contribution was to address the fact
> >>>>>>>>> actual
> >>>>>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
> >>>>>>>>> discussion
> >>>>>>>>> about adding a new shell versus updating the actual one [3, 4].
> >>>>>>>>>
> >>>>>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
> >>>>>>>>> shell
> >>>>>>>>> to reflect what is currently in Busybox source code.
> >>>>>>>>> Basically, this contribution is about taking a snapshot of Busybox
> >>>>>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
> >>>>>>>>> suit
> >>>>>>>>> U-Boot needs.
> >>>>>>>>>
> >>>>>>>>> [...]
> >>>>>>>>
> >>>>>>>> Applied to u-boot/next, thanks!
> >>>>>>>
> >>>>>>> Thank you for the merge!
> >>>>>>> If there is any problem, do not hesitate to mail me and I will take
> >>>>>>> care
> >>>>>>> of
> >>>>>>> it!
> >>>>>>
> >>>>>> This change, specifically setting the modern hush shell as default, is
> >>>>>> breaking our boot script, just noticed since the current U-Boot master
> >>>>>> has a regression for us.
> >>>>>>
> >>>>>> We still need to figure out the exact details, here [1] you can find the
> >>>>>> boot script (that has some placeholder that is replaced during build).
> >>>>>>
> >>>>>> and the error is something like:
> >>>>>>
> >>>>>> ```
> >>>>>> ## Executing script at 90280000
> >>>>>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> >>>>>> 69025 bytes read in 11 ms (6 MiB/s)
> >>>>>> 82 bytes read in 9 ms (8.8 KiB/s)
> >>>>>> Working FDT set to 90200000
> >>>>>> syntax error at 'done'HUSH died!
> >>>>>> resetting ...
> >>>>>> ```
> >>>>>>
> >>>>>> that I _assume_ comes from this line
> >>>>>>
> >>>>>>     env set set_apply_overlays 'env set apply_overlays "for overlay_file
> >>>>>>     in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
> >>>>>>     ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
> >>>>>>     fdt apply \\${loadaddr}; env set overlay_file; done; true"'>
> >>>>>>
> >>>>>> [1]
> >>>>>> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bs
> >>>>>> p
> >>>>>> /u-boot/u-boot-distro-boot/boot.cmd.in
> >>>>>>
> >>>>>> Francesco
> >>>>>
> >>>>> Hi all
> >>>>>
> >>>>> I observed a similar issue with STM32MP157c-DK2 board.
> >>>>> Since commit 78912cfde281 ("cmd: Set modern hush as default shell")
> >>>>> U-Boot
> >>>>> crashes :
> >>>>>
> >>>>>
> >>>>> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> >>>>>
> >>>>> CPU: STM32MP157CAC Rev.B
> >>>>> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> >>>>> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> >>>>> Board: MB1272 Var2.0 Rev.C-01
> >>>>> DRAM:  512 MiB
> >>>>> Clocks:
> >>>>> - MPU : 650 MHz
> >>>>> - MCU : 208.878 MHz
> >>>>> - AXI : 266.500 MHz
> >>>>> - PER : 24 MHz
> >>>>> - DDR : 533 MHz
> >>>>> optee optee: OP-TEE: revision 4.0 (e92de4ca)
> >>>>> I/TC: Reserved shared memory is disabled
> >>>>> I/TC: Dynamic shared memory is enabled
> >>>>> I/TC: Normal World virtualization support is disabled
> >>>>> I/TC: Asynchronous notifications are disabled
> >>>>> Core:  311 devices, 40 uclasses, devicetree: board
> >>>>> WDT:   Started watchdog@5a002000 with servicing every 1000ms (32s
> >>>>> timeout)
> >>>>> NAND:  0 MiB
> >>>>> MMC:   STM32 SD/MMC: 0
> >>>>> Loading Environment from MMC... OK
> >>>>> In:    No input devices available!
> >>>>> Out:   No output devices available!
> >>>>> Err:   No error devices available!
> >>>>> Net:   eth0: ethernet@5800a000
> >>>>> Hit any key to stop autoboot:  0
> >>>>> Boot over mmc0!
> >>>>> switch to partitions #0, OK
> >>>>> mmc0 is current device
> >>>>> Scanning mmc 0:8...
> >>>>> data abort
> >>>>> pc : [<ddb3f77a>]          lr : [<ddb44c95>]
> >>>>> reloc pc : [<c012777a>]    lr : [<c012cc95>]
> >>>>> sp : dbafc848  ip : ddbfc578     fp : ddbedf18
> >>>>> r10: 00000000  r9 : dbb15e70     r8 : 00000000
> >>>>> r7 : dbb5bf98  r6 : dbb5de10     r5 : dbb5bf98  r4 : ddbeda78
> >>>>> r3 : dbb5dc08  r2 : 000033f8     r1 : 00000071  r0 : ddbede00
> >>>>> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> >>>>> Code: 3138 1c48 f854 0030 (eb04) 05c1
> >>>>> Resetting CPU ...
> >>
> >> I will take a look at the issue, trying to reproduce it and understand the 
> >> root cause.
> >> I cannot give you any ETA for the fix, so for now I can only advise you to 
> >> stick with the old parser.
> > 
> > Should we revert the change that set the modern hush shell as default
> > till this is fixed?
> > 
> > This is preventing us to run our automated test suite against current
> > master. Whatever other issue might be introduced we will not be able to
> > report.
> > 
> > Tom?
> > 
> > Francesco
> > 
> > 
> 
> Hi 
> 
> fully agree with Francesco's proposal.

OK, I'll revert the default change for the moment, hopefully we can get
this fixed soon however.