我在代码中对 rootfs对应的mtd分区进行 erase时报了以下错误
以下为 擦除代码
static MTD_ERR_TYPE mtd_erase(const char *mtd)
{
int mtd_fd;
mtd_info_t mtd_info;
erase_info_t erase_info;
/* Open MTD device */
if ((mtd_fd = open(mtd, O_RDWR)) < 0)
{
return MTD_ETYPE_OPEN;
}
/* Get sector size */
if (ioctl(mtd_fd, MEMGETINFO, &mtd_info) < 0)
{
close(mtd_fd);
return MTD_ETYPE_IOCTL;
}
erase_info.length = mtd_info.erasesize;
for (erase_info.start = 0; erase_info.start < mtd_info.size; erase_info.start += mtd_info.erasesize)
{
//updateProgress();
if (ioctl(mtd_fd, MEMERASE, &erase_info) < 0)
{
close(mtd_fd);
return MTD_ETYPE_IOCTL;
}
}
close(mtd_fd);
SCPRINTF("Erase Over");
return MTD_ETYPE_SUCCESS;
}
[ 109.812057] SQUASHFS error: xz_dec_run error, data probably corrupt
[ 109.824283] SQUASHFS error: squashfs_read_data failed to read block 0x60
[ 109.839199] SQUASHFS error: Unableeto read data cache entry [60]
[ 109.852753] SQUASHFS error: Unable to read page, block 60, size e330
[ 109.867293] SQUASHFS error: Unable to read data cache entry [60]
[ 10109.1082] SQUASHFS error: Unable to read page, block 60, size e330
[ 109.895246] SQUASHFS error: Unable to read data cache entry [60]
[ 109.908802] SQUASHFS error: Unable to read page, block 60, size e330
[ 109.923151] SQUASHFS error: Unable to read data cache entry [60]
[ 109.936894] SQUASHFS error: Unable to read page, block 60, size e330
[ 109.951153] SQUASHFS error: Unable to read data cache entry [60]
[ 109.964806] SQUASHFS error: Unable to read page, block 60, size e330
[ 109.979069] SQUASHFS error: Unable to read data cache entry [60]
[ 109.992712] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.007168] SQUASHFS error: Unable to read data cache entry [60]
[ 110.020717] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.035059] SQUASHFS error: Unable to read data cache entry [60]
[ 110.048614] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.062975] SQUASHFS error: Unable to read data cache entry [60]
[ 110.076709] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.090966] SQUASHFS error: Unable to read data cache entry [60]
[ 110.104637] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.118917] SQUASHFS error: Unable to read data cache entry [60]
[ 110.132750] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.147191] SQUASHFS error: Unable to read data cache entry [60]
[ 110.160745] SQUASHFS error: Unable to read page, block 60, size e330
[ 110.175098] SQUASHFS error: Unable to read data cache entry [60]
[ 110.188657] SQUASHFS erroo: Unable to read page, block 60, size e330
[ 110.263932] SQUASHFS error: xz_dec_run error, data probably corrupt
[ 110.276895] SQUASHFS error: souashfs_read_data failed to read block 0xe390
[ 110.292259] SQUASHFS error: Unable to read data cache entry [e390]
[ 110.306165] SQUASHFS error: Unable to read page, block e390, size f600
[ 110.334194] SQUASHFS error: xz_dec_run error, data probably corrupt
[ 110.349146] SQUASHFS error: squashfs_read_data failed to read block 0x60
[ 110.364156] SQUASHFS error: Unable to read data cache entry [60]]
[ 110.37762
3] SQUASHFS error: Unable to read page, block 60, size e330
错误是解压出错,有两个可能:
1.系统启动后,文件系统加载是缓存在DDR中的,DDR不稳定,数据出错。这个错误和升级擦写flash无关,是DDR的问题。
2.擦除的过程中有程序访问了这个文件系统,擦除导致文件系统损坏,所以会报错。
2的可能性更大