yaffs2img linux,关于新版yaffs2源码的mkyaffs2image生成OOB导致坏块标记不正确的问题...

static void shuffle_oob(char *spareData, struct yaffs_packed_tags2 *pt)

{

assert(sizeof(*pt) <= spareSize);

// NAND LAYOUT: For non-trivial OOB orderings, here would be a good place to shuffle.

memcpy(spareData, pt, sizeof(*pt));

}

static int write_chunk(u8 *data, u32 id, u32 chunk_id, u32 n_bytes)

{

struct yaffs_ext_tags t;

struct yaffs_packed_tags2 pt;

char spareData[spareSize];

if (write(outFile,data,chunkSize) != chunkSize)

fatal("write");

memset(&t, 0, sizeof(t));

t.chunk_id = chunk_id;

//    t.serial_number = 0;

t.serial_number = 1;    // **CHECK**

t.n_bytes = n_bytes;

t.obj_id = id;

t.seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;

// added NCB **CHECK**

t.chunk_used = 1;

if (convert_endian)

{

little_to_big_endian(&t);

}

nPages++;

memset(&pt, 0, sizeof(pt));

yaffs_pack_tags2(&pt,&t,1);

memset(spareData, 0xff, sizeof(spareData));

shuffle_oob(spareData, &pt);

if (write(outFile,spareData,sizeof(spareData)) != sizeof(spareData))

fatal("write");

return 0;

}

是直接先将yaffs_packed_tags2写入的,

struct yaffs_packed_tags2 {

struct yaffs_packed_tags2_tags_only t;

struct yaffs_ecc_other ecc;

};

struct yaffs_packed_tags2_tags_only {

unsigned seq_number;

unsigned obj_id;

unsigned chunk_id;

unsigned n_bytes;

};

struct yaffs_ecc_other {

unsigned char col_parity;

unsigned line_parity;

unsigned line_parity_prime;

};

总共4*7=28字节,直接放OOB最前面了。而且从2013年的版本都是这样的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值