All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francis Laniel <francis.laniel@amarulasolutions.com>
To: Francesco Dolcini <francesco@dolcini.it>,
	Tom Rini <trini@konsulko.com>,
	Patrick DELAUNAY <patrick.delaunay@foss.st.com>,
	Patrice CHOTARD <patrice.chotard@foss.st.com>
Cc: u-boot@lists.denx.de,
	Michael Nazzareno Trimarchi <michael@amarulasolutions.com>,
	Harald Seiler <hws@denx.de>, Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v13 00/24] Modernize U-Boot shell
Date: Wed, 17 Jan 2024 00:25:26 +0700	[thread overview]
Message-ID: <2170847.irdbgypaU6@pwmachine> (raw)
In-Reply-To: <ce968882-f30b-4f49-85cf-c38f78bb6ff8@foss.st.com>

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.



  parent reply	other threads:[~2024-01-16 17:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 21:02 [PATCH v13 00/24] Modernize U-Boot shell Francis Laniel
2023-12-22 21:02 ` [PATCH v13 01/24] test: Add framework to test hush behavior Francis Laniel
2023-12-22 21:02 ` [PATCH v13 02/24] test: hush: Test hush if/else Francis Laniel
2023-12-22 21:02 ` [PATCH v13 03/24] test/py: hush_if_test: Remove the test file Francis Laniel
2023-12-22 21:02 ` [PATCH v13 04/24] test: hush: Test hush variable expansion Francis Laniel
2023-12-22 21:02 ` [PATCH v13 05/24] test: hush: Test hush commands list Francis Laniel
2023-12-22 21:02 ` [PATCH v13 06/24] test: hush: Test hush loops Francis Laniel
2023-12-22 21:02 ` [PATCH v13 07/24] cli: Add Busybox upstream hush.c file Francis Laniel
2023-12-22 21:02 ` [PATCH v13 08/24] cli: Port upstream Busybox hush to U-Boot Francis Laniel
2023-12-22 21:02 ` [PATCH v13 09/24] cli: Add menu for hush parser Francis Laniel
2023-12-22 21:02 ` [PATCH v13 10/24] global_data.h: add GD_FLG_HUSH_OLD_PARSER flag Francis Laniel
2023-12-22 21:02 ` [PATCH v13 11/24] cmd: Add new cli command Francis Laniel
2023-12-22 21:02 ` [PATCH v13 12/24] cli: Enables using modern hush parser as command line parser Francis Laniel
2023-12-22 21:02 ` [PATCH v13 13/24] cli: hush_modern: Enable variables expansion for modern hush Francis Laniel
2023-12-22 21:02 ` [PATCH v13 14/24] cli: hush_modern: Add functions to be called from run_command() Francis Laniel
2023-12-22 21:02 ` [PATCH v13 15/24] cli: add modern hush as parser for run_command*() Francis Laniel
2023-12-22 21:10   ` Francis Laniel
2023-12-22 21:23     ` Tom Rini
2023-12-26  9:46       ` Simon Glass
2023-12-29 18:55         ` Francis Laniel
2023-12-22 21:02 ` [PATCH v13 16/24] test: hush: Fix instructions list tests for modern hush Francis Laniel
2023-12-22 21:02 ` [PATCH v13 17/24] test: hush: Fix variable expansion " Francis Laniel
2023-12-22 21:02 ` [PATCH v13 18/24] cli: hush_modern: Enable using < and > as string compare operators Francis Laniel
2023-12-22 21:02 ` [PATCH v13 19/24] cli: hush_modern: Enable if keyword Francis Laniel
2023-12-22 21:02 ` [PATCH v13 20/24] cli: hush_modern: Enable loops Francis Laniel
2023-12-22 21:02 ` [PATCH v13 21/24] test: hush: Fix loop tests for modern hush Francis Laniel
2023-12-22 21:02 ` [PATCH v13 22/24] cli: modern_hush: Add upstream commits up to 2nd October 2023 Francis Laniel
2023-12-22 21:02 ` [PATCH v13 23/24] cmd: Set modern hush as default shell Francis Laniel
2023-12-22 21:02 ` [PATCH v13 24/24] configs: Use old hush for several boards Francis Laniel
2023-12-28 20:58 ` [PATCH v13 00/24] Modernize U-Boot shell Tom Rini
2023-12-29 18:55   ` Francis Laniel
2024-01-11 17:04     ` Francesco Dolcini
2024-01-15 17:34       ` Patrice CHOTARD
2024-01-16  0:46         ` Tom Rini
2024-01-16  7:08           ` Patrice CHOTARD
2024-01-16 17:25         ` Francis Laniel [this message]
2024-01-17 10:05           ` Patrice CHOTARD
2024-01-17 17:30             ` Francis Laniel
2024-01-17 17:39               ` Francesco Dolcini
2024-01-18  7:05                 ` Patrice CHOTARD
2024-01-18 14:09                   ` Tom Rini
2024-01-16 17:20       ` Francis Laniel

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=2170847.irdbgypaU6@pwmachine \
    --to=francis.laniel@amarulasolutions.com \
    --cc=francesco@dolcini.it \
    --cc=hws@denx.de \
    --cc=michael@amarulasolutions.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

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

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