AnsweredAssumed Answered

i.mx6q - corrupt empty space at LEB 1:2180 with booting from NAND

Question asked by Alexander Novikov on Nov 10, 2016
Latest reply on Dec 8, 2016 by Alexander Novikov

Hi all. I have custom imx6q board with MT29F16G08 NAND. Now I can boot u-boot and linux from SD-card. I can successfully copy UBIFS image from SD card to NAND in u-boot, but when I try to boot linux from NAND there are some errors with UBIFS mounting. Sometimes I get corrupt empty space at LEB 1:**** (random number), sometimes there is a CRC error. UBIFS image made with this command:
sudo mkfs.ubifs -U -d ./rootfs -o ubifs.bin -m 2048 -e 126976 -c $((95*1020*1024*1024/131072/100)) -x zlib 2>&1 >/dev/null

The most strange thing that we have one similar board in our office with exatcly same imx and NAND, but there is no such issues. The board .c and .h is almost identical.

We tried to change NAND chip with hardware guy, but we don't get any effect. I'm struggling with this problem for five weeks.

 


U-Boot 2014.07 (Nov 10 2016 - 14:23:19)

CPU: Freescale i.MX6Q rev1.5 at 792 MHz
Reset cause: POR
Board: IVM3
I2C: ready
DRAM: 2 GiB
NAND: 2048 MiB
MMC: ok sd
Status: 0
ok emmc
Status: 0
FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

No panel detected: default to HDMI
Display: HDMI (1024x768)
In: serial
Out: serial
Err: serial
Net: Phy not found
using phy at 4
FEC [PRIME]
Warning: failed to set MAC address

Hit any key to stop autoboot: 0
U-Boot > pri
addcon=setenv bootargs ${bootargs} console=${console},${baudrate}
addmtd=setenv bootargs ${bootargs} ${mtdparts}
baudrate=115200
boot_fdt=try
boot_mmc=run loadimage mmcboot
boot_nand=run nand_ubifs
boot_vol=0
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
bootdelay=5
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc3
disp_res_hdmi=1920x1080M
disp_res_ldb=1280x800MR
dtb_addr=0x12800000
dtb_fs=/boot/imx6q-ms21.dtb
enetaddr=06:72:A7:00:0A:91
ethact=FEC
ethprime=FEC
fdt_addr=0x18000000
fdt_file=imx6q-ms21.dtb
fdt_high=0xffffffff
gatewayip=192.168.1.1
image=zImage
init_ubi=nand erase.part ubi;ubi part ${part};ubi create ${vol} 400000
initrd_high=0xffffffff
ip_dyn=no
ipaddr=192.168.1.18
kernel_addr=0x11000000
kernel_fs=/boot/zImage
load_dtb=fatload mmc ${mmcdev}:${mmcpart} ${dtb_addr} ${fdt_file}
load_kernel=fatload mmc ${mmcdev}:${mmcpart} ${kernel_addr} ${image}
load_ubifs=ext2load mmc ${mmcdev}:2 ${loadaddr} /var/ubifs.bin
loadaddr=0x11000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}; run videoargs
mmcboot=echo Booting from mmc ...; run mmcargs; run loadfdt;run load_kernel;bootz ${loadaddr} - ${fdt_addr};
mmcdev=0
mmcpart=1
mmcroot=/dev/mmcblk0p2 rootwait rw
mtdids=nand0=gpmi-nand
mtdparts=mtdparts=gpmi-nand:4M(uboot),1020M(rootfs),1024M(data)
nand_ubifs=run ubifs_mount ubifs_load ubifsargs addcon addmtd;bootz ${kernel_addr} - ${dtb_addr}
netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
netmask=255.255.255.1
part=rootfs
script=boot.scr
serverip=192.168.1.1
splashpos=m,m
ubifs_load=ubifsload ${kernel_addr} ${kernel_fs};ubifsload ${dtb_addr} ${dtb_fs};
ubifs_mount=ubi part rootfs;ubifsmount ubi:rootfs${boot_vol}
ubifsargs=setenv bootargs ubi.mtd=rootfs root=ubi:rootfs${boot_vol} rootfstype=ubifs
upd_ubifs=nand erase.part rootfs; run load_ubifs update_ubifs
update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_firmware_filename}; then setexpr fw_sz ${filesize} / 0x200; setexpr fw_sz ${fw_sz} + 1; mmc write ${loadaddr} 0x2 ${fw_sz}; fi; fi
update_sd_firmware_filename=u-boot.imx
update_ubifs=ubi part ${part};ubi create ${vol};ubi write ${loadaddr} ${vol} ${filesize}
videoargs=setenv nextcon 0; if hdmidet; then setenv bootargs ${bootargs} video=mxcfb${nextcon}:dev=hdmi,${disp_res_hdmi}@60,if=RGB24; setenv fbmen fbmem=28M; setexpr nextcon ${nextcon} + 1; else echo - no HDMI monitor;fi; i2c dev 2; if i2c probe 0x38; then setenv bootargs ${bootargs} video=mxcfb${nextcon}:dev=ldb,${disp_res_ldb}@60,if=RGB666 ft5x06_ts.screenres=1280,800; if test 0 -eq ${nextcon}; then setenv fbmem fbmem=10M; else setenv fbmem ${fbmem},10M; fi; setexpr nextcon ${nextcon} + 1; else echo '- no Hannstar-1280x800 display';fi; setenv bootargs ${bootargs} ${fbmem}
vol=rootfs0

Environment size: 3746/8188 bytes
U-Boot > run upd_ubifs

NAND erase.part: device 0 offset 0x400000, size 0x3fc00000
Erasing at 0x3ffe0000 -- 100% complete.
OK
101453824 bytes read in 7147 ms (13.5 MiB/s)
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: attached mtd1 to ubi0
UBI: MTD device name: "mtd=1"
UBI: MTD device size: 1020 MiB
UBI: number of good PEBs: 8160
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 8075
UBI: total number of reserved PEBs: 85
UBI: number of PEBs reserved for bad PEB handling: 81
UBI: max/mean erase counter: 1/0
No size specified -> Using max size (1025331200)
Creating dynamic volume rootfs0 of size 1025331200
101453824 bytes written to volume rootfs0
U-Boot > run boot_nand
UBI: mtd1 is detached from ubi0
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: attached mtd1 to ubi0
UBI: MTD device name: "mtd=1"
UBI: MTD device size: 1020 MiB
UBI: number of good PEBs: 8160
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 8160
UBI: number of PEBs reserved for bad PEB handling: 81
UBI: max/mean erase counter: 4/1
UBIFS error (pid 0): ubifs_scan: corrupt empty space at LEB 1:2180
UBIFS error (pid 0): ubifs_scanned_corruption: corrupted data at LEB 1:2180
UBIFS error (pid 0): ubifs_scan: LEB 1 scanning failed
UBIFS error (pid 0): ubifs_recover_master_node: failed to recover master node
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi:rootfs0' errno=-22!

ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
- mount 'volume-name' volume
Bad Linux ARM zImage magic!
U-Boot >

Outcomes