From df2d4ddb8c872f1d0d0856b474e2524d51b7e31f Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Fri, 16 Oct 2009 11:15:16 +0900 Subject: [PATCH] s5pc110: ipl: support 4096 byte ipl Signed-off-by: Minkyu Kang --- onenand_ipl/board/samsung/universal/checksum.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/onenand_ipl/board/samsung/universal/checksum.c b/onenand_ipl/board/samsung/universal/checksum.c index 1eb593c..7844f3e 100644 --- a/onenand_ipl/board/samsung/universal/checksum.c +++ b/onenand_ipl/board/samsung/universal/checksum.c @@ -13,6 +13,7 @@ #define SZ_14K 0x3800 #endif +#define PAGE_SIZE 0x800 /* * For 2KiB page OneNAND * +------+------+------+------+ @@ -57,6 +58,29 @@ int main(int argc, char *argv[]) size = CHECKSUM_8K; for (i = 0; i < size; i++) { + /* if reserved area, skip the checksum */ + if (stat.st_size > SZ_8K) { + if (i % PAGE_SIZE == 0) { + int res; + char tbuf[PAGE_SIZE]; + + res = i / PAGE_SIZE; + if (res % 2) { + i += PAGE_SIZE; + + /* + * if 1st page's reverved area, + * copy the data to 2nd page + */ + if (res == 1) { + ret = read(fd, &tbuf, PAGE_SIZE); + ret = write(fd, tbuf, PAGE_SIZE); + } + lseek(fd, i, SEEK_SET); + } + } + } + ret = read(fd, &buf, 1); if (ret < 0) { -- 2.7.4