Problems with large amount of partitions on SD
I am having huge problems with my system *possibly* due to fact I have 10 partitions on a single SD card.
I'm getting an unreliable behavior (issuing the same commands do *not* result in consistent behavior) which *seem* to point to some overwrite/cache problem.
First of all: is a configuration with 10 partitions on SD supported?
I tried perusing files in disk/part*, but I failed to see where extended partitions are handled.
Here follows one (typical) example:
This is one example of a boot after a long time off, no key touched:
================================================================================
Quoted 27 lines
U-Boot SPL 2020.10-rc5 (Oct 01 2020 - 17:14:04 +0200) Trying to boot from NOR
U-Boot 2020.10-rc5 (Oct 01 2020 - 17:14:04 +0200)
CPU: MediaTek MT7628A ver:1 eco:2 Boot: DDR2, SPI-NOR 3-Byte Addr, CPU clock from XTAL Clock: CPU: 580MHz, Bus: 193MHz, XTAL: 40MHz DRAM: 128 MiB WDT: Started with servicing (60s timeout) MMC: mmc at 10130000: 0 Loading Environment from SPIFlash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB OK In: uart2 at e00 Out: uart2 at e00 Err: uart2 at e00 Model: VoCore2Net:
Warning: eth at 10110000 (eth0) using random MAC address - 0a:92:ae:d0:9b:c2
eth0: eth at 10110000
Hit any key to stop autoboot: 0
Loading System BPartition Map for MMC device 0 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type
Quoted 8 lines
1 2048 262144 30f8737b-01 0c 2 264192 4194304 30f8737b-02 83 3 4458496 32768 30f8737b-03 83 4 4491264 11268096 30f8737b-04 05 Extd** Can't read partition table on 0:4491264 **
** Can't read partition table on 0:4902912 **
** Invalid partition 7 **
Loading Recovery
================================================================================
here recovery system is loaded from Flash, not mmc. After a "reboot" from linux I get:
================================================================================
Quoted 21 lines
[48634.981029] reboot: Restarting system [48634.984764] ralink_restartU-Boot SPL 2020.10-rc5 (Oct 01 2020 - 17:14:04 +0200) Trying to boot from NOR
U-Boot 2020.10-rc5 (Oct 01 2020 - 17:14:04 +0200)
CPU: MediaTek MT7628A ver:1 eco:2 Boot: DDR2, SPI-NOR 3-Byte Addr, CPU clock from XTAL Clock: CPU: 580MHz, Bus: 193MHz, XTAL: 40MHz DRAM: 128 MiB WDT: Started with servicing (60s timeout) MMC: mmc at 10130000: 0 Loading Environment from SPIFlash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB OK In: uart2 at e00 Out: uart2 at e00 Err: uart2 at e00 Model: VoCore2
Quoted 4 lines
Net:
Warning: eth at 10110000 (eth0) using random MAC address - be:c5:7e:06:ca:a1
eth0: eth at 10110000
Hit any key to stop autoboot: 0
================================================================================
Here I stop autoboot.
This is my complete environment.
================================================================================
Quoted 32 lines
=> printenv
BOOT_CURRENT=B
SYSTEM_R=/dev/mtdblock5
arch=mips
baudrate=115200
board=vocore2
board_name=vocore2
boot_a=echo "Loading System A";part=6;runboot_x
boot_b=echo "Loading System B";part=7;runboot_x
boot_now=if test "${BOOT_CURRENT}" = A; then runboot_a; elif test "${BOOT_CURRENT}" = B; then runboot_b; fi; if env existsBOOT_A_GOOD; then runboot_a; fi; if env existsBOOT_B_GOOD; then runboot_b; fi; runboot_rboot_r=echo "Loading Recovery"; setenv bootargs "${default_bootargs} mtdparts=${mtdparts} root=/dev/mtdblock5"; bootmbc050000
boot_x=mmc rescan && mmc part && ls mmc 0:${part} && load mmc 0:${part} 85000000/boot/uImage&& setenv bootargs "${default_bootargs} mtdparts=${mtdparts} root=/dev/mmcblk0p${part}" && bootm ${fileaddr} bootcmd=mmc rescan && sleep 1 && rundo_boot
bootcount=1
bootdelay=2
cpu=mips32
default_bootargs=earlyprintk rootwait console=ttyS2,115200
do_boot=test ${bootcount} -gt 1 && runremove_boot; runboot_now
fdtcontroladdr=86f6d350
fileaddr=85000000
filesize=268c63
fupdate=mmc rescan && load mmc 0:1 84000000 uboot.scr && fatrm mmc 0:1 uboot.scr && source 84000000 && echo Flash updated
mtdids=nor0=spi0.0
mtdparts=spi0.0:312k(u-boot),4k(env),4k(factory),2368k(kernel),-(filesystem)
remove_boot=if env existsBOOT_CURRENT; then setenvBOOT_CURRENT; saveenv; elif env existsBOOT_A_GOOD; then setenvBOOT_A_GOOD; saveenv; elif env existsBOOT_B_GOOD; then setenvBOOT_B_GOOD; saveenv; fi soc=mt7628
stderr=uart2 at e00
stdin=uart2 at e00
stdout=uart2 at e00
vendor=vocore
ver=U-Boot 2020.10-rc5 (Oct 01 2020 - 17:14:04 +0200)
Quoted 1 line
Environment size: 1558/4092 bytes
================================================================================
I have two full systems on SD (partitions 6 and 7) and a fallback on Flash. Idea is to try to boot from BOOT_CURRENT System, if possible, fallback to the other, if "GOOD" and boot Recovery as last resort.
I modified "boot_x"to do some printouts before booting (first 3 commands) Here I manually start "B" system boot:
================================================================================
Quoted 35 lines
=> run
boot_b
Loading System BPartition Map for MMC device 0 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type
1 2048 262144 30f8737b-01 0c 2 264192 4194304 30f8737b-02 83 3 4458496 32768 30f8737b-03 83 4 4491264 11268096 30f8737b-04 05 Extd 5 4493312 409600 30f8737b-05 83 6 4904960 102400 30f8737b-06 83 7 5009408 102400 30f8737b-07 83 8 5113856 102400 30f8737b-08 83 9 5218304 102400 30f8737b-09 83 10 5322752 4194304 30f8737b-0a 83 bin/ boot/ dev/ etc/ lib/ <SYM> lib32 media/ mnt/ opt/ over/ proc/ root/ run/ sbin/ sys/ tmp/ usr/ var/
Quoted 4 lines
1 file(s), 17 dir(s)
Error: too many data blocks to be read.
Failed to load '/boot/uImage'
================================================================================
... which fails in a different way.
I do again the same command (nothing in between)
================================================================================
Quoted 35 lines
=> run
boot_b
Loading System BPartition Map for MMC device 0 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type
1 2048 262144 30f8737b-01 0c 2 264192 4194304 30f8737b-02 83 3 4458496 32768 30f8737b-03 83 4 4491264 11268096 30f8737b-04 05 Extd 5 4493312 409600 30f8737b-05 83 6 4904960 102400 30f8737b-06 83 7 5009408 102400 30f8737b-07 83 8 5113856 102400 30f8737b-08 83 9 5218304 102400 30f8737b-09 83 10 5322752 4194304 30f8737b-0a 83 bin/ boot/ dev/ etc/ lib/ <SYM> lib32 media/ mnt/ opt/ over/ proc/ root/ run/ sbin/ sys/ tmp/ usr/ var/
Quoted 6 lines
1 file(s), 17 dir(s)
2526307 bytes read in 260 ms (9.3 MiB/s)
## Booting kernel from Legacy Image at 85000000 ...
Image Name: Linux-5.8.0
Image Type: MIPS Linux Kernel Image (gzip compressed)
================================================================================
... and it succeeds.
I originally blamed this to my tweaks to SquashFS (part 6 and 7 are SquashFS), but it seems problem happens at partition level, before filesystem is touched.
Please advise.
Mauro