Skip to content
Permalink
Browse files

yaffs2 sources fixes for best portability

Signed-off-by: Sergey Sergeev <adron@yapic.net>
  • Loading branch information
adron-s committed Jan 24, 2017
1 parent 3e12c63 commit 23072bb35b3aa52a10fa965c63ee387ca4785f10
Showing with 14 additions and 5 deletions.
  1. +3 −2 pack.sh
  2. +1 −1 tests/build_test.sh
  3. +8 −1 tests/test-nand-yaffs1.c
  4. +2 −1 yaffs2/yaffs_guts.h
@@ -2,7 +2,7 @@
#align. It's important for openwrt's combined image.
CI_BLKSZ=65536

KERNEL="/home/prog/openwrt/openwrt-all/bin/ar71xx/openwrt-ar71xx-mikrotik-vmlinux-lzma.elf"
KERNEL="./xm.elf"
#KERNEL="/home/prog/openwrt/trunk-rb941-2nd/bin/ar71xx/openwrt-ar71xx-mikrotik-vmlinux-lzma.elf"

RESNAME=$(basename $KERNEL | sed -e 's/\..\+//')
@@ -16,5 +16,6 @@ RESNAME=$(basename $KERNEL | sed -e 's/\..\+//')
#./kernel2minor -k $KERNEL -r ./$RESNAME.nand-tik-yaffs2-2048b-ecc.bin -s 2048 -p NND02048 -c

#for NAND-512(old rb4xx)
./kernel2minor -k $KERNEL -r ./$RESNAME.nand-tik-yaffs1-512b-ecc.bin -s 512 -i $CI_BLKSZ -p NND00512 -c
#./kernel2minor -k $KERNEL -r ./$RESNAME.nand-tik-yaffs1-512b-ecc.bin -s 512 -i $CI_BLKSZ -p NND00512 -c
./kernel2minor -k $KERNEL -r ./$RESNAME.nand-tik-yaffs1-512b-ecc.bin -s 512 -e -c
#./kernel2minor -k $KERNEL -r ./$RESNAME.nand-tik-yaffs1-512b-ecc.bin -s 512 -p NND00512 -c
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

#определим путь до директории с kernel2minor/tests
workdir=$(dirname $(ls -l ./${0} | sed -e 's/^.\+-> //'))
@@ -116,7 +116,11 @@ int main(void){
}
//fd = open("/home/prog/openwrt/work/rb941-2nd-mtd-dump/mtdblock2.bin", O_RDONLY);
// fd = open("./kernel_nand.bin", O_RDONLY);
fd = open("./qqq-nand1.bin", O_RDONLY);
//fd = open("./qqq-nand1.bin", O_RDONLY);
// fd = open("/tmp/rrr/x2.bin", O_RDONLY);
// fd = open("/tmp/rrr/kernel-ok", O_RDONLY);
// fd = open("/tmp/rrr/old-work", O_RDONLY);
fd = open("/home/prog/openwrt/ziggi2/xm.nand-tik-yaffs1-512b-ecc.bin", O_RDONLY);
if(fd < 0){
printf("Can't open file!\n");
exit(-1);
@@ -127,6 +131,7 @@ int main(void){
chunk += size;
}
close(fd);
fd = creat("./unpacke-data.bin", O_WRONLY);
//рассчет будет меньше если чанки не полностью заполняют все блоки! то есть если последний блок обрезан!
printf("%u\n", total_size);
total_chunks = total_size / sectorsize * chunks_per_block;
@@ -155,6 +160,7 @@ int main(void){
yaffs_unpack_tags1(&t, pt);
//считаем ecc для данных
data_ecc_result = check_ecc_data(chunk, total_bytes_per_chunk);
write(fd, chunk, t.n_bytes); //write unpacked-data.bin
//printf("chunk_id = %d\n", pt->chunk_id);
printf("%u, %u: obj_id = %u, chunk_id = %u, n_bytes = %u, serial_num = %d, ecc = 0x%x(%s), ecc_data = %s, is_deleted = %u, chunk_used = %u\n",
chunkInNAND, addr, t.obj_id, t.chunk_id, t.n_bytes, t.serial_number,
@@ -166,6 +172,7 @@ int main(void){
//goto end; //!!!
}
end:
close(fd);
free(data);
return 0;
}
@@ -17,8 +17,9 @@
#define __YAFFS_GUTS_H__

#include "yportenv.h"
#include <stdint.h>

typedef __loff_t loff_t;
typedef int64_t loff_t;

#define YAFFS_OK 1
#define YAFFS_FAIL 0

0 comments on commit 23072bb

Please sign in to comment.
You can’t perform that action at this time.