[U-Boot] scan_peb ubi error sama5d36 nand flash v2019.01

Eugen.Hristev at microchip.com Eugen.Hristev at microchip.com
Wed Mar 27 07:01:21 UTC 2019



On 26.03.2019 18:40, Daniel Evans wrote:

> 
> After an install of Nand flash using an SD card and linux script on a 
> custom sama5d36 board, setup with the following partitions:
> 
> $ cat /proc/mtd
> dev:    size   erasesize  name
> mtd0: 00040000 00020000 "at91bootstrap"
> mtd1: 000c0000 00020000 "bootloader"
> mtd2: 00080000 00020000 "bootloader env"
> mtd3: 1fe80000 00020000 “rootfs”
> 
> And Uboot settings for version v2019.01
> 
> setenv loadImages "mtdparts default && ubi part rootfs && ubifsmount 
> ubi0:rootfs && ubifsload 0x22000000 /boot/vmlinuz && ubifsload 
> 0x21000000 /boot/sama5d3.dtb && bootz 0x22000000 - 0x21000000;”
> setenv kernelAddr 0x22000000
> setenv dtbAddr 0x21000000
> setenv bootcmd "run loadImages"
> 
> I get the following Uboot error after the ubi part rootfs command:
> 
> ubi0: attaching mtd4
> ubi0 error: scan_peb: bad image sequence number 115116184 in PEB 4080, 
> expected 273711372
> Erase counter header dump:
>          magic          0x55424923
>          version        1
>          ec             1
>          vid_hdr_offset 2048
>          data_offset    4096
>          image_seq      115116184
>          hdr_crc        0x8905e9e9
> erase counter header hexdump:
> ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
> UBI error: cannot attach mtd4
> UBI error: cannot initialize UBI, error -22
> UBI init error 22
> Please check, if the correct MTD partition is used (size big enough?)
> 
> If I do a nand erase.chip then do my SD card install everything works. 
>   The error shows up if I try to do a second SD card install.
> 
> Of note is the fact that I do not see this issue if I use an old version 
> of uboot (2014).
> 
> Any insight?

It looks like the MTD partitioning has changed as expected in u-boot 
2019 vs 2014, and maybe you need to use mtd5 instead of mtd4 ?
Check the layout and see if it's as expected...

About our current flash layout:

http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage#NAND_Flash_demo_Memory_map

maybe mtdparts default is not doing the proper thing ?

> 
> Dan
> 
> 


More information about the U-Boot mailing list