20 个解决方案
#1
把他标记为坏块,就不会对他操作了
#2
升级NK的时候,只格式化,NK对应的大小就行了,不要格式化整个区
#3
EBOOT 下创建分区 可以使用BP_OpenPartition函数
你是不是 升级NK的时候 把整个flash的数据擦掉,然后再分区呢?
你是不是 升级NK的时候 把整个flash的数据擦掉,然后再分区呢?
#4
怎么操作呀?我看代码是格式化整个剩余的(除了坏块和保留空间外)空间。代码如下:
if(BP_LowLevelFormat(0, g_FlashInfo.dwNumBlocks, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
在eboot目录下的nand.cpp文件里的WriteFlashNK()函数里。而且他MBR扇区是系统自动分配在前面0-5块后面(也就是RESERVED_BOOT_BLOCK后面)第6块的第一个扇区里。好像没办法给他改变。且nk.bin也是存在第6块开始的后面空间里的。
#5
是的。系统默认的。
#6
// read MBR sector ADD BY ZMF
if(dwCurBlock=GetValidMBR(toc) !=0){
if ( FMD_ReadSector(dwCurBlock*g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
// if (SaveMBRSector(toc)==TRUE){
OALMSG(1, (TEXT("ZMF:WriteFlashNK: read MBR sector: 0x%x\r\n"),dwCurBlock*g_FlashInfo.wSectorsPerBlock));
goto READPART;
}else OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to read MBR sector\r\n")));
}
if(BP_LowLevelFormat(0, g_FlashInfo.dwNumBlocks, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
dwCurBlock=0;
// write MBR sector ADD BY ZMF
#ifdef SDMMC_BOOT
#else
// Open a BINFS partition
READPART:
g_hPartBINFS = BP_OpenPartition
(
NEXT_FREE_LOC,
SECTOR_TO_BLOCK_SIZE(FILE_TO_SECTOR_SIZE(dwBINFSPartLength)) * _SECTORS_PER_BLOCK,
PART_BINFS,
TRUE,
PART_OPEN_ALWAYS
);
#endif
if(g_hPartBINFS == INVALID_HANDLE_VALUE)
{
RETAILMSG(1, (TEXT("<ERROR> WriteFlashNK : BINFS partition open was failed.\r\n")));
return FALSE;
}
else
{
// Partition open success
PPARTENTRY ppartBINFS = BP_GetPartitionInfo(g_hPartBINFS);
if(ppartBINFS != NULL)
{
OALMSG(OAL_DEBUG, (TEXT("----- BINFS Partition -----\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_BootInd : 0x%X\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstHead : 0x%X\r\n"), ppartBINFS->Part_FirstHead));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstSector : 0x%X\r\n"), ppartBINFS->Part_FirstSector));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstTrack : 0x%X\r\n"), ppartBINFS->Part_FirstTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_FileSystem : 0x%X\r\n"), ppartBINFS->Part_FileSystem));
OALMSG(OAL_DEBUG, (TEXT("Part_LastHead : 0x%X\r\n"), ppartBINFS->Part_LastHead));
OALMSG(OAL_DEBUG, (TEXT("Part_LastSector : 0x%X\r\n"), ppartBINFS->Part_LastSector));
OALMSG(OAL_DEBUG, (TEXT("Part_LastTrack : 0x%X\r\n"), ppartBINFS->Part_LastTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_StartSector : 0x%X\r\n"), ppartBINFS->Part_StartSector));
OALMSG(OAL_DEBUG, (TEXT("Part_TotalSectors : 0x%X\r\n"), ppartBINFS->Part_TotalSectors));
OALMSG(OAL_DEBUG, (TEXT("---------------------------\r\n"), ppartBINFS->Part_BootInd));
}
else
{
OALMSG(TRUE, (TEXT("Failed to get a BINFS partition information\r\n")));
return FALSE;
}
if(dwCurBlock !=0 ){
if(FMD_SetBlockStatus(dwCurBlock, BLOCK_STATUS_RESERVED))
OALMSG(1, (TEXT("ZMF:SET BLOCK RESERVED: 0x%x\r\n"),dwCurBlock));
if(EraseBlocks(SECTOR_TO_BLOCK(ppartBINFS->Part_StartSector),
((ppartBINFS->Part_TotalSectors%64==0) ? ppartBINFS->Part_TotalSectors/64 : ppartBINFS->Part_TotalSectors/64+1),
FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
if(EraseBlocks(dwCurBlock, 1, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
// WriteMBR();
if ( !FMD_WriteSector(dwCurBlock * g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to save MBR sector\r\n")));
}else
OALMSG(1, (TEXT("ZMF:WriteFlashNK: write MBR sector\r\n")));
}
我现在把代码改成如上过程,先检测有无可用的MBR,若有就不格式化整个flash,只擦除binfs分区。而binfs分区是紧挨着MBR扇区后面的扇区。我擦除binfs分区后把原来读出来保存的MBR扇区重新写回去。这样可以吗?(上面这个文件是eboot目录下的nand.cpp文件里的WriteFlashNK()函数里的一部分)。
if(dwCurBlock=GetValidMBR(toc) !=0){
if ( FMD_ReadSector(dwCurBlock*g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
// if (SaveMBRSector(toc)==TRUE){
OALMSG(1, (TEXT("ZMF:WriteFlashNK: read MBR sector: 0x%x\r\n"),dwCurBlock*g_FlashInfo.wSectorsPerBlock));
goto READPART;
}else OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to read MBR sector\r\n")));
}
if(BP_LowLevelFormat(0, g_FlashInfo.dwNumBlocks, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
dwCurBlock=0;
// write MBR sector ADD BY ZMF
#ifdef SDMMC_BOOT
#else
// Open a BINFS partition
READPART:
g_hPartBINFS = BP_OpenPartition
(
NEXT_FREE_LOC,
SECTOR_TO_BLOCK_SIZE(FILE_TO_SECTOR_SIZE(dwBINFSPartLength)) * _SECTORS_PER_BLOCK,
PART_BINFS,
TRUE,
PART_OPEN_ALWAYS
);
#endif
if(g_hPartBINFS == INVALID_HANDLE_VALUE)
{
RETAILMSG(1, (TEXT("<ERROR> WriteFlashNK : BINFS partition open was failed.\r\n")));
return FALSE;
}
else
{
// Partition open success
PPARTENTRY ppartBINFS = BP_GetPartitionInfo(g_hPartBINFS);
if(ppartBINFS != NULL)
{
OALMSG(OAL_DEBUG, (TEXT("----- BINFS Partition -----\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_BootInd : 0x%X\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstHead : 0x%X\r\n"), ppartBINFS->Part_FirstHead));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstSector : 0x%X\r\n"), ppartBINFS->Part_FirstSector));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstTrack : 0x%X\r\n"), ppartBINFS->Part_FirstTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_FileSystem : 0x%X\r\n"), ppartBINFS->Part_FileSystem));
OALMSG(OAL_DEBUG, (TEXT("Part_LastHead : 0x%X\r\n"), ppartBINFS->Part_LastHead));
OALMSG(OAL_DEBUG, (TEXT("Part_LastSector : 0x%X\r\n"), ppartBINFS->Part_LastSector));
OALMSG(OAL_DEBUG, (TEXT("Part_LastTrack : 0x%X\r\n"), ppartBINFS->Part_LastTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_StartSector : 0x%X\r\n"), ppartBINFS->Part_StartSector));
OALMSG(OAL_DEBUG, (TEXT("Part_TotalSectors : 0x%X\r\n"), ppartBINFS->Part_TotalSectors));
OALMSG(OAL_DEBUG, (TEXT("---------------------------\r\n"), ppartBINFS->Part_BootInd));
}
else
{
OALMSG(TRUE, (TEXT("Failed to get a BINFS partition information\r\n")));
return FALSE;
}
if(dwCurBlock !=0 ){
if(FMD_SetBlockStatus(dwCurBlock, BLOCK_STATUS_RESERVED))
OALMSG(1, (TEXT("ZMF:SET BLOCK RESERVED: 0x%x\r\n"),dwCurBlock));
if(EraseBlocks(SECTOR_TO_BLOCK(ppartBINFS->Part_StartSector),
((ppartBINFS->Part_TotalSectors%64==0) ? ppartBINFS->Part_TotalSectors/64 : ppartBINFS->Part_TotalSectors/64+1),
FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
if(EraseBlocks(dwCurBlock, 1, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
// WriteMBR();
if ( !FMD_WriteSector(dwCurBlock * g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to save MBR sector\r\n")));
}else
OALMSG(1, (TEXT("ZMF:WriteFlashNK: write MBR sector\r\n")));
}
我现在把代码改成如上过程,先检测有无可用的MBR,若有就不格式化整个flash,只擦除binfs分区。而binfs分区是紧挨着MBR扇区后面的扇区。我擦除binfs分区后把原来读出来保存的MBR扇区重新写回去。这样可以吗?(上面这个文件是eboot目录下的nand.cpp文件里的WriteFlashNK()函数里的一部分)。
#7
怎么没有高手呀?顶一下
#8
分区一般是在eboot里面进行的,比如现新建一分区,分区应标记为reserved,NK存放在flash上的位置根据情况做相应的变动,以保证该分区与NK所在的分区没有冲突,这样更新NK的时候就不会影响到该分区了。
#9
嗯,思路是这样的。具体改代码起来没这么容易。
#10
不要低格。
在NK更新之后,在分区里边动动手脚~
在NK更新之后,在分区里边动动手脚~
#11
这个做法简单适用。
#12
烧写的时候不要擦除整个nand ,在nand 驱动标记 fat 为坏块即可。
不过这样也会产生问题。就是fat以后真的有坏块怎么办?嘿嘿。
不过这样也会产生问题。就是fat以后真的有坏块怎么办?嘿嘿。
#13
楼主真是明白我,发个邮件到我的邮箱。
#14
最近在赶项目节点,忙的都没有时间回家开电脑,看了大家的回复,思路是对,楼主参考调试一下,我这边博文希望对楼主有帮助
http://blog.csdn.net/loongembedded/article/details/6129967
http://blog.csdn.net/loongembedded/article/details/6129967
#15
这好久的东西都顶上来了,LZ早就解决了吧,只是没结贴而已,看来要版主帮忙了
#16
终于解决问题了,感谢以下朋友:loongEmbedded,gooogleman,wswwxk,aaa_tnt
#17
解决了就好,麻烦分享一下,让其他朋友也可以学习。
#18
楼上,这个问题怎么解决的,能说说不???
#19
太经典了.......
#20
总是这样,解决了,也不给个总结
#21
#1
把他标记为坏块,就不会对他操作了
#2
升级NK的时候,只格式化,NK对应的大小就行了,不要格式化整个区
#3
EBOOT 下创建分区 可以使用BP_OpenPartition函数
你是不是 升级NK的时候 把整个flash的数据擦掉,然后再分区呢?
你是不是 升级NK的时候 把整个flash的数据擦掉,然后再分区呢?
#4
怎么操作呀?我看代码是格式化整个剩余的(除了坏块和保留空间外)空间。代码如下:
if(BP_LowLevelFormat(0, g_FlashInfo.dwNumBlocks, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
在eboot目录下的nand.cpp文件里的WriteFlashNK()函数里。而且他MBR扇区是系统自动分配在前面0-5块后面(也就是RESERVED_BOOT_BLOCK后面)第6块的第一个扇区里。好像没办法给他改变。且nk.bin也是存在第6块开始的后面空间里的。
#5
是的。系统默认的。
#6
// read MBR sector ADD BY ZMF
if(dwCurBlock=GetValidMBR(toc) !=0){
if ( FMD_ReadSector(dwCurBlock*g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
// if (SaveMBRSector(toc)==TRUE){
OALMSG(1, (TEXT("ZMF:WriteFlashNK: read MBR sector: 0x%x\r\n"),dwCurBlock*g_FlashInfo.wSectorsPerBlock));
goto READPART;
}else OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to read MBR sector\r\n")));
}
if(BP_LowLevelFormat(0, g_FlashInfo.dwNumBlocks, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
dwCurBlock=0;
// write MBR sector ADD BY ZMF
#ifdef SDMMC_BOOT
#else
// Open a BINFS partition
READPART:
g_hPartBINFS = BP_OpenPartition
(
NEXT_FREE_LOC,
SECTOR_TO_BLOCK_SIZE(FILE_TO_SECTOR_SIZE(dwBINFSPartLength)) * _SECTORS_PER_BLOCK,
PART_BINFS,
TRUE,
PART_OPEN_ALWAYS
);
#endif
if(g_hPartBINFS == INVALID_HANDLE_VALUE)
{
RETAILMSG(1, (TEXT("<ERROR> WriteFlashNK : BINFS partition open was failed.\r\n")));
return FALSE;
}
else
{
// Partition open success
PPARTENTRY ppartBINFS = BP_GetPartitionInfo(g_hPartBINFS);
if(ppartBINFS != NULL)
{
OALMSG(OAL_DEBUG, (TEXT("----- BINFS Partition -----\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_BootInd : 0x%X\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstHead : 0x%X\r\n"), ppartBINFS->Part_FirstHead));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstSector : 0x%X\r\n"), ppartBINFS->Part_FirstSector));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstTrack : 0x%X\r\n"), ppartBINFS->Part_FirstTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_FileSystem : 0x%X\r\n"), ppartBINFS->Part_FileSystem));
OALMSG(OAL_DEBUG, (TEXT("Part_LastHead : 0x%X\r\n"), ppartBINFS->Part_LastHead));
OALMSG(OAL_DEBUG, (TEXT("Part_LastSector : 0x%X\r\n"), ppartBINFS->Part_LastSector));
OALMSG(OAL_DEBUG, (TEXT("Part_LastTrack : 0x%X\r\n"), ppartBINFS->Part_LastTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_StartSector : 0x%X\r\n"), ppartBINFS->Part_StartSector));
OALMSG(OAL_DEBUG, (TEXT("Part_TotalSectors : 0x%X\r\n"), ppartBINFS->Part_TotalSectors));
OALMSG(OAL_DEBUG, (TEXT("---------------------------\r\n"), ppartBINFS->Part_BootInd));
}
else
{
OALMSG(TRUE, (TEXT("Failed to get a BINFS partition information\r\n")));
return FALSE;
}
if(dwCurBlock !=0 ){
if(FMD_SetBlockStatus(dwCurBlock, BLOCK_STATUS_RESERVED))
OALMSG(1, (TEXT("ZMF:SET BLOCK RESERVED: 0x%x\r\n"),dwCurBlock));
if(EraseBlocks(SECTOR_TO_BLOCK(ppartBINFS->Part_StartSector),
((ppartBINFS->Part_TotalSectors%64==0) ? ppartBINFS->Part_TotalSectors/64 : ppartBINFS->Part_TotalSectors/64+1),
FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
if(EraseBlocks(dwCurBlock, 1, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
// WriteMBR();
if ( !FMD_WriteSector(dwCurBlock * g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to save MBR sector\r\n")));
}else
OALMSG(1, (TEXT("ZMF:WriteFlashNK: write MBR sector\r\n")));
}
我现在把代码改成如上过程,先检测有无可用的MBR,若有就不格式化整个flash,只擦除binfs分区。而binfs分区是紧挨着MBR扇区后面的扇区。我擦除binfs分区后把原来读出来保存的MBR扇区重新写回去。这样可以吗?(上面这个文件是eboot目录下的nand.cpp文件里的WriteFlashNK()函数里的一部分)。
if(dwCurBlock=GetValidMBR(toc) !=0){
if ( FMD_ReadSector(dwCurBlock*g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
// if (SaveMBRSector(toc)==TRUE){
OALMSG(1, (TEXT("ZMF:WriteFlashNK: read MBR sector: 0x%x\r\n"),dwCurBlock*g_FlashInfo.wSectorsPerBlock));
goto READPART;
}else OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to read MBR sector\r\n")));
}
if(BP_LowLevelFormat(0, g_FlashInfo.dwNumBlocks, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
dwCurBlock=0;
// write MBR sector ADD BY ZMF
#ifdef SDMMC_BOOT
#else
// Open a BINFS partition
READPART:
g_hPartBINFS = BP_OpenPartition
(
NEXT_FREE_LOC,
SECTOR_TO_BLOCK_SIZE(FILE_TO_SECTOR_SIZE(dwBINFSPartLength)) * _SECTORS_PER_BLOCK,
PART_BINFS,
TRUE,
PART_OPEN_ALWAYS
);
#endif
if(g_hPartBINFS == INVALID_HANDLE_VALUE)
{
RETAILMSG(1, (TEXT("<ERROR> WriteFlashNK : BINFS partition open was failed.\r\n")));
return FALSE;
}
else
{
// Partition open success
PPARTENTRY ppartBINFS = BP_GetPartitionInfo(g_hPartBINFS);
if(ppartBINFS != NULL)
{
OALMSG(OAL_DEBUG, (TEXT("----- BINFS Partition -----\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_BootInd : 0x%X\r\n"), ppartBINFS->Part_BootInd));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstHead : 0x%X\r\n"), ppartBINFS->Part_FirstHead));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstSector : 0x%X\r\n"), ppartBINFS->Part_FirstSector));
OALMSG(OAL_DEBUG, (TEXT("Part_FirstTrack : 0x%X\r\n"), ppartBINFS->Part_FirstTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_FileSystem : 0x%X\r\n"), ppartBINFS->Part_FileSystem));
OALMSG(OAL_DEBUG, (TEXT("Part_LastHead : 0x%X\r\n"), ppartBINFS->Part_LastHead));
OALMSG(OAL_DEBUG, (TEXT("Part_LastSector : 0x%X\r\n"), ppartBINFS->Part_LastSector));
OALMSG(OAL_DEBUG, (TEXT("Part_LastTrack : 0x%X\r\n"), ppartBINFS->Part_LastTrack));
OALMSG(OAL_DEBUG, (TEXT("Part_StartSector : 0x%X\r\n"), ppartBINFS->Part_StartSector));
OALMSG(OAL_DEBUG, (TEXT("Part_TotalSectors : 0x%X\r\n"), ppartBINFS->Part_TotalSectors));
OALMSG(OAL_DEBUG, (TEXT("---------------------------\r\n"), ppartBINFS->Part_BootInd));
}
else
{
OALMSG(TRUE, (TEXT("Failed to get a BINFS partition information\r\n")));
return FALSE;
}
if(dwCurBlock !=0 ){
if(FMD_SetBlockStatus(dwCurBlock, BLOCK_STATUS_RESERVED))
OALMSG(1, (TEXT("ZMF:SET BLOCK RESERVED: 0x%x\r\n"),dwCurBlock));
if(EraseBlocks(SECTOR_TO_BLOCK(ppartBINFS->Part_StartSector),
((ppartBINFS->Part_TotalSectors%64==0) ? ppartBINFS->Part_TotalSectors/64 : ppartBINFS->Part_TotalSectors/64+1),
FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
if(EraseBlocks(dwCurBlock, 1, FORMAT_SKIP_RESERVED | FORMAT_SKIP_BLOCK_CHECK) != TRUE)
{
OALMSG(OAL_ERROR, (TEXT("ERROR: Low-level boot media format failed.\r\n")));
return FALSE;
}
// WriteMBR();
if ( !FMD_WriteSector(dwCurBlock * g_FlashInfo.wSectorsPerBlock, (PUCHAR)&toc, &si, 1) ) {
OALMSG(OAL_ERROR, (TEXT("ZMF:WriteFlashNK: ERROR: Unable to save MBR sector\r\n")));
}else
OALMSG(1, (TEXT("ZMF:WriteFlashNK: write MBR sector\r\n")));
}
我现在把代码改成如上过程,先检测有无可用的MBR,若有就不格式化整个flash,只擦除binfs分区。而binfs分区是紧挨着MBR扇区后面的扇区。我擦除binfs分区后把原来读出来保存的MBR扇区重新写回去。这样可以吗?(上面这个文件是eboot目录下的nand.cpp文件里的WriteFlashNK()函数里的一部分)。
#7
怎么没有高手呀?顶一下
#8
分区一般是在eboot里面进行的,比如现新建一分区,分区应标记为reserved,NK存放在flash上的位置根据情况做相应的变动,以保证该分区与NK所在的分区没有冲突,这样更新NK的时候就不会影响到该分区了。
#9
嗯,思路是这样的。具体改代码起来没这么容易。
#10
不要低格。
在NK更新之后,在分区里边动动手脚~
在NK更新之后,在分区里边动动手脚~
#11
这个做法简单适用。
#12
烧写的时候不要擦除整个nand ,在nand 驱动标记 fat 为坏块即可。
不过这样也会产生问题。就是fat以后真的有坏块怎么办?嘿嘿。
不过这样也会产生问题。就是fat以后真的有坏块怎么办?嘿嘿。
#13
楼主真是明白我,发个邮件到我的邮箱。
#14
最近在赶项目节点,忙的都没有时间回家开电脑,看了大家的回复,思路是对,楼主参考调试一下,我这边博文希望对楼主有帮助
http://blog.csdn.net/loongembedded/article/details/6129967
http://blog.csdn.net/loongembedded/article/details/6129967
#15
这好久的东西都顶上来了,LZ早就解决了吧,只是没结贴而已,看来要版主帮忙了
#16
终于解决问题了,感谢以下朋友:loongEmbedded,gooogleman,wswwxk,aaa_tnt
#17
解决了就好,麻烦分享一下,让其他朋友也可以学习。
#18
楼上,这个问题怎么解决的,能说说不???
#19
太经典了.......
#20
总是这样,解决了,也不给个总结