深入探索Linux内存技术设备与嵌入式开发
1. 内存技术设备相关操作与调试
在处理BIOS闪存时,会有一系列的操作来确保数据的准确性和设备的正常运行。以下是一段代码示例,用于从BIOS闪存中读取块并与镜像文件进行比较,之后锁定解锁的扇区:
/* Verify by reading blocks from the BIOS flash and comparing
with the image file */
/* ... */
bios_done:
/* Lock back the unlocked sectors */
while (lsect < usect) {
printf("Relocking Sector[%d]\r", lsect+1);
fwh_erase_info.start = lsect*SECTOR_SIZE;
fwh_erase_info.length = SECTOR_SIZE;
ret = ioctl(fwh_fd, MEMLOCK, &fwh_erase_info);
if (ret != 0) printf("Relock failed on sector %d!\n", lsect);
lsect++;
}
close(image_fd);
close(fwh_fd);
当遇到闪存相关的问题时,可以在进行内核配置时启用 CONFIG_MTD_DEBUG (路径为 Device Drivers → Memory Technology Devi
超级会员免费看
订阅专栏 解锁全文
3410

被折叠的 条评论
为什么被折叠?



