Cold boot consistently fails to load file from SD

Hi, I'm facing a new problem for my Mt7628/vocore2 target.
I moved the Linux kernel from a ext4 partition to the "proper" SquashFS partition (I say "proper" because I'm using a dual-system with fallback to avoid updating the currently working rootFS and kernel lies into rootFS).
I am using u-boot v2020.10-rc3 plus the attached patches (one pertains SquashFS).
Problem is a real cold boot (target off for more than one minute) leads to a load failure for the kernel. A warm boot ("reboot" from a running Linux) or a not-so-cold boot (turn target off and power it on again after a few seconds) seems to work as expected.
I tried to insert delays and/or "mmc rescan", but that does not seem to have any effect. Also error message is not always the same; sometimes I get:
Error: too many data blocks to be read. Failed to load '/boot/uImage'
other times:
** fs_devread read error - block Failed to mount ext2 filesystem... ** Unrecognized filesystem type **
My full environment is:
BOOT_CURRENT=A SYSTEM_R=/dev/mtdblock5 arch=mips baudrate=115200 board=vocore2 board_name=vocore2 boot_a=echo "Loading System A";part=6;run boot_x boot_b=echo "Loading System B";part=7;run boot_x boot_now=if test "${BOOT_CURRENT}" = A; then run boot_a; elif test "${BOOT_CURRENT}" = B; then run boot_b; fi; if env exists BOOT_A_GOOD; then run boot_a; fi; if env exists BOOT_B_GOOD; then run boot_b; fi; run boot_r boot_r=echo "Loading Recovery"; setenv bootargs "${default_bootargs} mtdparts=${mtdparts} root=/dev/mtdblock5"; bootm bc050000 boot_x=load mmc 0:${part} 85000000 /boot/uImage && setenv bootargs "${default_bootargs} mtdparts=${mtdparts} root=/dev/mmcblk0p${part}" && bootm ${fileaddr} bootcmd=run do_boot bootcount=1 bootdelay=2 cpu=mips32 default_bootargs=earlyprintk rootwait console=ttyS2,115200 do_boot=test ${bootcount} -gt 1 && run remove_boot; run boot_now fdtcontroladdr=86f6d340 fileaddr=84000000 filesize=154 fupdate=mmc rescan && load mmc 0:1 84000000 uboot.scr && fatrm mmc 0:1 uboot.scr && source 84000000 && echo Flash updated || Flash update FAILED! mtdids=nor0=spi0.0 mtdparts=spi0.0:312k(u-boot),4k(env),4k(factory),2368k(kernel),-(filesystem) remove_boot=if env exists BOOT_CURRENT; then setenv BOOT_CURRENT; saveenv; elif env exists BOOT_A_GOOD; then setenv BOOT_A_GOOD; saveenv; elif env exists BOOT_B_GOOD; then setenv BOOT_B_GOOD; saveenv; fi soc=mt7628 stderr=uart2@e00 stdin=uart2@e00 stdout=uart2@e00 vendor=vocore ver=U-Boot 2020.10-rc3 (Sep 16 2020 - 19:43:03 +0200)
It was suggested (on IRC) it could be a cache problem. unfortunately trying to enable cache control (CONFIG_CMD_CACHE) raises error in compilation:
... LD u-boot /home/valeria/MyProject/VoCore/Buildroot-2/recov/per-package/uboot/host/bin/mipsel-linux-ld.bfd: cmd/built-in.o: in function `do_icache': cmd/cache.c:(.text.do_icache+0x5c): undefined reference to `icache_disable' /home/valeria/MyProject/VoCore/Buildroot-2/recov/per-package/uboot/host/bin/mipsel-linux-ld.bfd: cmd/cache.c:(.text.do_icache+0x6c): undefined reference to `icache_enable' /home/valeria/MyProject/VoCore/Buildroot-2/recov/per-package/uboot/host/bin/mipsel-linux-ld.bfd: cmd/cache.c:(.text.do_icache+0x8c): undefined reference to `icache_status' Makefile:1753: recipe for target 'u-boot' failed make[2]: *** [u-boot] Error 1 package/pkg-generic.mk:266 http://pkg-generic.mk:266: recipe for target '/home/valeria/MyProject/VoCore/Buildroot-2/recov/build/uboot-v2020.10-rc3/.stamp_built' failed make[1]: *** [/home/valeria/MyProject/VoCore/Buildroot-2/recov/build/uboot-v2020.10-rc3/.stamp_built] Error 2 Makefile:23: recipe for target '_all' failed make: *** [_all] Error 2
and I have no idea how to fix this.
Any hint would be very welcome as this is a real show-stopper for me.
Thanks in Advance Mauro

Hi Mauro,
Am Samstag, den 19.09.2020, 15:39 +0200 schrieb Mauro Condarelli:
Hi, I'm facing a new problem for my Mt7628/vocore2 target.
I moved the Linux kernel from a ext4 partition to the "proper" SquashFS partition (I say "proper" because I'm using a dual-system with fallback to avoid updating the currently working rootFS and kernel lies into rootFS).
I am using u-boot v2020.10-rc3 plus the attached patches (one pertains SquashFS).
Problem is a real cold boot (target off for more than one minute) leads to a load failure for the kernel. A warm boot ("reboot" from a running Linux) or a not-so-cold boot (turn target off and power it on again after a few seconds) seems to work as expected.
which distro or Linux version do you use? Can you provide a full boot log?
Linux MIPS had a bug with setting up memory for its exception vectors and handlers if the CPU didn't report support for vectored interrupts. mtmips is one of those CPUs. AFAIK this should have been fixed in mainline since some months. Could be one reason.
You could also try to disable CONFIG_RESTORE_EXCEPTION_VECTOR_BASE in U-Boot.
Stefan also had cache issues on the Gardena board. He solved it with some memory allocation and copying, see arch/mips/mach-mtmips/cpu.c.
The cmd_cache interface is not supported on MIPS as there is no reliable way to disable or enable caches or to separately control i- cache and d-cache.
Can you send patches 0001 and 0002 to the mailing list in the proper way so that patchwork can pick them up? I'd like to prepare a small bugfix pull request for v2020.10. Thanks.

Hi Daniel, comments inline below.
On 9/19/20 9:15 PM, Daniel Schwierzeck wrote:
Hi Mauro,
Am Samstag, den 19.09.2020, 15:39 +0200 schrieb Mauro Condarelli:
Hi, I'm facing a new problem for my Mt7628/vocore2 target.
I moved the Linux kernel from a ext4 partition to the "proper" SquashFS partition (I say "proper" because I'm using a dual-system with fallback to avoid updating the currently working rootFS and kernel lies into rootFS).
I am using u-boot v2020.10-rc3 plus the attached patches (one pertains SquashFS).
Problem is a real cold boot (target off for more than one minute) leads to a load failure for the kernel. A warm boot ("reboot" from a running Linux) or a not-so-cold boot (turn target off and power it on again after a few seconds) seems to work as expected.
which distro or Linux version do you use? Can you provide a full boot log?
I am using a self-compiled Buildroot RootFS, but this is hardly a problem. Error is in pain u-boot. I try to load Linux kernel in memory (from SD, from SquashFS) and this fails. Linux has no chance to start at all.
Linux MIPS had a bug with setting up memory for its exception vectors and handlers if the CPU didn't report support for vectored interrupts. mtmips is one of those CPUs. AFAIK this should have been fixed in mainline since some months. Could be one reason.
I am using v2020.10-rc3 which should be "recent enough"... or am I wrong?
You could also try to disable CONFIG_RESTORE_EXCEPTION_VECTOR_BASE in U-Boot.
Stefan also had cache issues on the Gardena board. He solved it with some memory allocation and copying, see arch/mips/mach-mtmips/cpu.c.
The cmd_cache interface is not supported on MIPS as there is no reliable way to disable or enable caches or to separately control i- cache and d-cache.
Can you send patches 0001 and 0002 to the mailing list in the proper way so that patchwork can pick them up? I'd like to prepare a small bugfix pull request for v2020.10. Thanks.
I'll do that tomorrow 'couse I'm too groggy now to be reliable ;)
Thanks Mauro
participants (2)
-
Daniel Schwierzeck
-
Mauro Condarelli