Hi
I try finish my first patch. attach is the patch.
1. it make the mkyaffs2image compile, it's not working out of box :(
2. remove the ECC calculate
3. using the "yaffs_pack_tags2_tags_only" 16bits not for nand OOB.
after apply the patch. run:
ls test/
a b c d data e TODO
make mkyaffs2image
./mkyaffs2image test/ mm1.bin convert
then using jtag flash mm1. the command is:
cable milkymist
detect
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
pld load fjmem.bit
initbus fjmem opcode=000010
frequency 6000000
detectflash 0
endian big
flashmem 0xD20000 mm1.yaffs.flash5.bin noverify
reboot milkymist one
before flash the mm1. my /dev/flash5 have some screenshot. like
1.png 2.png and wallpaper.png
the *strange* thing is after flash the /dev/flash5 not change.d.
all those *.png file still there .
any feedback will be great.
On 03/30/2011 07:38 PM, Sebastien Bourdeauducq wrote:
> Hi,
>
> On Wed, 2011-03-30 at 13:32 +0800, Xiangfu Liu wrote:
>> I look into the "mkyaffsimage.c" line 253. is this correct?
>> we just need convert
>> "struct yaffs_tags " --> " struct yaffs_ext_tags" --> "struct
>> yaffs_packed_tags2_tags_only"
>> then write the "struct yaffs_packed_tags2_tags_only" to the end of data
>> chunk
>> then pad to 16byes.
>>
>> then the image should works in milkymist one nor flash with urjtag.
>
> Sounds good.
>
> If possible, try to truncate the image, i.e. remove the trailing
> FFFFFF... This could potentially save a significant amount of flashing
> time during production - the flash chips are shipped erased and filled
> with F's so we do not need to write the whole 24MB partition when there
> is less than 2MB worth of files to put on the FS.
>
> I think the removal of the trailing F's could be done as a
> post-processing step, maybe with a separate tool. YAFFS2 should write
> the files at the beginning of the flash partition already.
>
> S.
>
--
Best Regards
Xiangfu
-- Qi RSS feed, http://en.qi-hardware.com/feed/rss20.xml --
diff --git a/utils/Makefile b/utils/Makefile
index 49bf03b..6452d7c 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -16,7 +16,7 @@
#KERNELDIR = /usr/src/kernel-headers-2.4.18
-CFLAGS = -I/usr/include -I.. -O2 -Wall -DCONFIG_YAFFS_UTIL
+CFLAGS = -I/usr/include -I.. -I../direct -O2 -Wall -DCONFIG_YAFFS_UTIL
CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
@@ -25,7 +25,7 @@ MAKETOOLS =
CC=$(MAKETOOLS)gcc
-COMMONLINKS = yaffs_ecc.c
+#COMMONLINKS = yaffs_ecc.c
COMMONOBJS = $(COMMONLINKS:.c=.o)
MKYAFFSSOURCES = mkyaffsimage.c
diff --git a/utils/mkyaffs2image.c b/utils/mkyaffs2image.c
index fa2229b..e040233 100644
--- a/utils/mkyaffs2image.c
+++ b/utils/mkyaffs2image.c
@@ -31,7 +31,6 @@
#include <unistd.h>
#include <errno.h>
#include <assert.h>
-#include "yaffs_ecc.h"
#include "yaffs_guts.h"
#include "yaffs_tagsvalidity.h"
@@ -42,10 +41,9 @@ unsigned yaffs_trace_mask=0;
#define MAX_OBJECTS 10000
// Adjust these to match your NAND LAYOUT:
-#define chunkSize 2048
-#define spareSize 64
-#define pagesPerBlock 64
-
+#define chunkSize 512
+#define spareSize 16
+#define pagesPerBlock 656
typedef struct
@@ -145,7 +143,8 @@ static int find_obj_in_list(dev_t dev, ino_t ino)
*/
static void little_to_big_endian(struct yaffs_ext_tags *tagsPtr)
{
-#if 0 // FIXME NCB
+#if 1
+ // FIXME NCB
union yaffs_tags_union * tags = (union yaffs_tags_union* )tagsPtr; // Work in bytes.
union yaffs_tags_union temp;
@@ -172,7 +171,7 @@ static void little_to_big_endian(struct yaffs_ext_tags *tagsPtr)
#endif
}
-static void shuffle_oob(char *spareData, struct yaffs_packed_tags2 *pt)
+static void shuffle_oob(char *spareData, struct yaffs_packed_tags2_tags_only *pt)
{
assert(sizeof(*pt) <= spareSize);
// NAND LAYOUT: For non-trivial OOB orderings, here would be a good place to shuffle.
@@ -182,7 +181,7 @@ static void shuffle_oob(char *spareData, struct yaffs_packed_tags2 *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;
+ struct yaffs_packed_tags2_tags_only pt;
char spareData[spareSize];
if (write(outFile,data,chunkSize) != chunkSize)
@@ -209,7 +208,7 @@ static int write_chunk(u8 *data, u32 id, u32 chunk_id, u32 n_bytes)
nPages++;
memset(&pt, 0, sizeof(pt));
- yaffs_pack_tags2(&pt,&t,1);
+ yaffs_pack_tags2_tags_only(&pt,&t);
memset(spareData, 0xff, sizeof(spareData));
shuffle_oob(spareData, &pt);
@@ -268,11 +267,11 @@ static void object_header_little_to_big_endian(struct yaffs_obj_hdr* oh)
oh->win_mtime[1] = SWAP32(oh->win_mtime[1]);
#else
- {
- int n = sizeof(oh->room_to_grow)/sizeof(oh->room_to_grow[0]);
- for(i=0; i < n; i++)
- oh->room_to_grow[i] = SWAP32(oh->room_to_grow[i]);
- }
+ /* { */
+ /* int n = sizeof(oh->room_to_grow)/sizeof(oh->room_to_grow[0]); */
+ /* for(i=0; i < n; i++) */
+ /* oh->room_to_grow[i] = SWAP32(oh->room_to_grow[i]); */
+ /* } */
#endif
}
@@ -560,7 +559,7 @@ int main(int argc, char *argv[])
printf("Processing directory %s into image file %s\n",argv[1],argv[2]);
process_directory(YAFFS_OBJECTID_ROOT,argv[1]);
- pad_image();
+ //pad_image();
close(outFile);
diff --git a/yaffs_guts.h b/yaffs_guts.h
index 307eba2..51313f0 100644
--- a/yaffs_guts.h
+++ b/yaffs_guts.h
@@ -106,6 +106,10 @@
/* Special sequence number for bad block that failed to be marked bad */
#define YAFFS_SEQUENCE_BAD_BLOCK 0xFFFF0000
+struct list_head {
+ struct list_head *next, *prev;
+};
+
/* ChunkCache is used for short read/write operations.*/
struct yaffs_cache {
struct yaffs_obj *object;
diff --git a/yaffs_packedtags2.c b/yaffs_packedtags2.c
index 6c12aed..d945e47 100644
--- a/yaffs_packedtags2.c
+++ b/yaffs_packedtags2.c
@@ -99,11 +99,13 @@ void yaffs_pack_tags2(struct yaffs_packed_tags2 *pt,
{
yaffs_pack_tags2_tags_only(&pt->t, t);
+#if 0
if (tags_ecc)
yaffs_ecc_calc_other((unsigned char *)&pt->t,
sizeof(struct
yaffs_packed_tags2_tags_only),
&pt->ecc);
+#endif
}
void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t,
@@ -164,6 +166,7 @@ void yaffs_unpack_tags2(struct yaffs_ext_tags *t, struct yaffs_packed_tags2 *pt,
struct yaffs_ecc_other ecc;
int result;
+#if 0
yaffs_ecc_calc_other((unsigned char *)&pt->t,
sizeof(struct
yaffs_packed_tags2_tags_only),
@@ -173,6 +176,7 @@ void yaffs_unpack_tags2(struct yaffs_ext_tags *t, struct yaffs_packed_tags2 *pt,
sizeof(struct
yaffs_packed_tags2_tags_only),
&pt->ecc, &ecc);
+#endif
switch (result) {
case 0:
ecc_result = YAFFS_ECC_RESULT_NO_ERROR;
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com