[oe-commits] org.oe.dev merge of '434c9b83795714321c5e83703daa92ea144962c8'
Laibsch commit
oe at amethyst.openembedded.net
Mon Sep 1 17:51:54 UTC 2008
merge of '434c9b83795714321c5e83703daa92ea144962c8'
and 'df379835be88c87afe28ebc4ac3ec609317fc047'
Author: Laibsch at openembedded.org
Branch: org.openembedded.dev
Revision: 1a2d9ed9cf69a784e60b3eb1b2b504e8e2c5d2c2
ViewMTN: http://monotone.openembedded.org/revision/info/1a2d9ed9cf69a784e60b3eb1b2b504e8e2c5d2c2
Files:
1
packages/kexecboot/initramfs_kexecboot_1.0.bb
packages/kexecboot/initramfs-kexecboot_1.0.bb
packages/strace/strace/mips-sigcontext.patch
classes/kernel.bbclass
packages/strace/strace_4.5.14.bb
site/mips-linux
site/mipsel-linux
packages/nandlogical
packages/nandlogical/files
packages/nandlogical/files/nandlogical.c
packages/nandlogical/nandlogical_1.0.0.bb
Diffs:
#
# mt diff -r434c9b83795714321c5e83703daa92ea144962c8 -r1a2d9ed9cf69a784e60b3eb1b2b504e8e2c5d2c2
#
#
#
# rename "packages/kexecboot/initramfs_kexecboot_1.0.bb"
# to "packages/kexecboot/initramfs-kexecboot_1.0.bb"
#
# add_file "packages/strace/strace/mips-sigcontext.patch"
# content [ccd084f7dff69f0181af30ba7ac01b23ddfc3678]
#
# patch "classes/kernel.bbclass"
# from [3ffe1672ca1e9239f5d1d1b3d0b8264888a6808b]
# to [aaee7c587861c7c66d492ee0c8e7540f99932496]
#
# patch "packages/strace/strace_4.5.14.bb"
# from [024b28b25f1ee50ef24eb3f59862d67bc1c27c9b]
# to [4fb203edb2b91681028f737a0759796914297980]
#
# patch "site/mips-linux"
# from [6e62c6b2a9dbd94fcd404675ace77e8f072cca30]
# to [e42e1ecf3d371ff63b016d8802bb5c0ef6f1a688]
#
# patch "site/mipsel-linux"
# from [6e62c6b2a9dbd94fcd404675ace77e8f072cca30]
# to [10c30659ccc13c29d2d29be395d5c9409800880a]
#
============================================================
--- packages/strace/strace/mips-sigcontext.patch ccd084f7dff69f0181af30ba7ac01b23ddfc3678
+++ packages/strace/strace/mips-sigcontext.patch ccd084f7dff69f0181af30ba7ac01b23ddfc3678
@@ -0,0 +1,46 @@
+diff -urN strace-4.5.14/signal.c strace-4.5.14-mips/signal.c
+--- strace-4.5.14/signal.c 2006-01-12 22:34:50.000000000 +0000
++++ strace-4.5.14-mips/signal.c 2007-05-03 06:59:09.000000000 +0000
+@@ -66,7 +66,7 @@
+
+
+ #ifdef LINUX
+-
++#include <linux/version.h>
+ #ifdef IA64
+ # include <asm/ptrace_offsets.h>
+ #endif /* !IA64 */
+@@ -1420,7 +1420,11 @@
+ if (umove(tcp, sp, &sc) < 0)
+ return 0;
+ tcp->u_arg[0] = 1;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+ tcp->u_arg[1] = sc.sc_sigset;
++#else
++ tcp->u_arg[1] = sc.sc_hi2;
++#endif
+ } else {
+ tcp->u_rval = tcp->u_error = 0;
+ if(tcp->u_arg[0] == 0)
+diff -urN strace-4.5.14/system.c strace-4.5.14-mips/system.c
+--- strace-4.5.14/system.c 2006-01-12 21:21:06.000000000 +0000
++++ strace-4.5.14-mips/system.c 2007-05-03 06:59:09.000000000 +0000
+@@ -78,6 +78,7 @@
+ #endif
+
+ #include <linux/sysctl.h>
++#include <linux/version.h>
+
+ static const struct xlat mount_flags[] = {
+ { MS_MGC_VAL, "MS_MGC_VAL" },
+@@ -1578,7 +1579,9 @@
+ { CTL_KERN, "CTL_KERN" },
+ { CTL_VM, "CTL_VM" },
+ { CTL_NET, "CTL_NET" },
+- { CTL_PROC, "CTL_PROC" },
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
++ { CTL_PROC, "CTL_PROC" },
++#endif
+ { CTL_FS, "CTL_FS" },
+ { CTL_DEBUG, "CTL_DEBUG" },
+ { CTL_DEV, "CTL_DEV" },
============================================================
--- classes/kernel.bbclass 3ffe1672ca1e9239f5d1d1b3d0b8264888a6808b
+++ classes/kernel.bbclass aaee7c587861c7c66d492ee0c8e7540f99932496
@@ -52,7 +52,7 @@ KERNEL_LD = "${LD}${KERNEL_LDSUFFIX} ${H
KERNEL_LD = "${LD}${KERNEL_LDSUFFIX} ${HOST_LD_KERNEL_ARCH}"
# Where built kernel lies in the kernel tree
-KERNEL_OUTPUT = "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}"
+KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}"
KERNEL_IMAGEDEST = "boot"
#
@@ -451,9 +451,9 @@ do_sizecheck() {
# with a fixed length or there is a limit in transferring the kernel to memory
do_sizecheck() {
if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" -a -z "${DONT_CHECK_KERNELSIZE}"]; then
- size=`ls -l arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | awk '{ print $5}'`
+ size=`ls -l ${KERNEL_OUTPUT} | awk '{ print $5}'`
if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
- rm arch/${ARCH}/boot/${KERNEL_IMAGETYPE}
+ rm ${KERNEL_OUTPUT}
die "This kernel (size=$size > ${KERNEL_IMAGE_MAXSIZE}) is too big for your device. Please reduce the size of the kernel by making more of it modular."
fi
fi
@@ -466,7 +466,7 @@ do_deploy() {
do_deploy() {
install -d ${DEPLOY_DIR_IMAGE}
- install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
+ install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin
if [ -d "${D}/lib" ]; then
============================================================
--- packages/strace/strace_4.5.14.bb 024b28b25f1ee50ef24eb3f59862d67bc1c27c9b
+++ packages/strace/strace_4.5.14.bb 4fb203edb2b91681028f737a0759796914297980
@@ -1,7 +1,7 @@ LICENSE = "GPL"
DESCRIPTION = "strace is a system call tracing tool."
SECTION = "console/utils"
LICENSE = "GPL"
-PR = "r6"
+PR = "r7"
SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
file://glibc-2.5.patch;patch=1 \
@@ -13,9 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/
file://strace-undef-syscall.patch;patch=1 \
file://strace-arm-no-cachectl.patch;patch=1 \
"
-
-
# The strace-4.5.14-avr32.patch conflicts with some other patches.
# These patches are primarly for the ARM and SuperH, so we'll just
# not use them when building for the AVR32.
@@ -27,6 +25,20 @@ SRC_URI_avr32 = \
file://strace-4.5.14-avr32-add-syscalls-up-to-sysvipc.patch;patch=1 \
"
+# Again, a different set of patches for MIPS. See http://bugs.openembedded.net/show_bug.cgi?id=2221
+MIPS = "\
+ ${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
+ file://glibc-2.5.patch;patch=1 \
+ file://arm-eabi.patch;patch=1 \
+ file://sh-arch-update.patch;patch=1 \
+ file://sh-syscall-update.patch;patch=1 \
+ file://strace-fix-arm-bad-syscall.patch;patch=1 \
+ file://strace-undef-syscall.patch;patch=1 \
+ file://strace-arm-no-cachectl.patch;patch=1 \
+ file://mips-sigcontext.patch;patch=1 \
+"
+SRC_URI_mips = "${MIPS}"
+SRC_URI_mipsel = "${MIPS}"
inherit autotools
============================================================
--- site/mips-linux 6e62c6b2a9dbd94fcd404675ace77e8f072cca30
+++ site/mips-linux e42e1ecf3d371ff63b016d8802bb5c0ef6f1a688
@@ -49,6 +49,13 @@ glib_cv_va_val_copy=${glib_cv_va_val_cop
glib_cv_va_copy=${glib_cv_va_copy=yes}
glib_cv_va_val_copy=${glib_cv_va_val_copy=yes}
+# glib-2.0
+glib_cv_stack_grows=${glib_cv_stack_grows=no}
+utils_cv_sys_open_max=${utils_cv_sys_open_max=1015}
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+glib_cv_use_pid_surrogate=${glib_cv_use_pid_surrogate=yes}
+ac_cv_func_posix_getgrgid_r=${ac_cv_func_posix_getgrgid_r=yes}
+
# libpcap
ac_cv_linux_vers=${ac_cv_linux_vers=2}
ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo=yes}
@@ -107,16 +114,16 @@ sudo_cv_uid_t_len=${sudo_cv_uid_t_len=10
# sudo
sudo_cv_uid_t_len=${sudo_cv_uid_t_len=10}
-#intercom
+# intercom
ac_cv_func_fnmatch_works=${ac_cv_func_fnmatch_works=yes}
-#lmbench
+# lmbench
ac_cv_uint=${ac_cv_unit=yes}
# D-BUS
ac_cv_func_posix_getpwnam_r=${ac_cv_func_posix_getpwnam_r=yes}
-#mono
+# mono
cv_mono_sizeof_sunpath=108
mono_cv_uscore=${mono_cv_uscore=no}
============================================================
--- site/mipsel-linux 6e62c6b2a9dbd94fcd404675ace77e8f072cca30
+++ site/mipsel-linux 10c30659ccc13c29d2d29be395d5c9409800880a
@@ -49,6 +49,13 @@ glib_cv_va_val_copy=${glib_cv_va_val_cop
glib_cv_va_copy=${glib_cv_va_copy=yes}
glib_cv_va_val_copy=${glib_cv_va_val_copy=yes}
+# glib-2.0
+glib_cv_stack_grows=${glib_cv_stack_grows=no}
+utils_cv_sys_open_max=${utils_cv_sys_open_max=1015}
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+glib_cv_use_pid_surrogate=${glib_cv_use_pid_surrogate=yes}
+ac_cv_func_posix_getgrgid_r=${ac_cv_func_posix_getgrgid_r=yes}
+
# libpcap
ac_cv_linux_vers=${ac_cv_linux_vers=2}
ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo=yes}
@@ -107,7 +114,7 @@ sudo_cv_uid_t_len=${sudo_cv_uid_t_len=10
# sudo
sudo_cv_uid_t_len=${sudo_cv_uid_t_len=10}
-#intercom
+# intercom
ac_cv_func_fnmatch_works=${ac_cv_func_fnmatch_works=yes}
#lmbench
@@ -116,7 +123,7 @@ ac_cv_func_posix_getpwnam_r=${ac_cv_func
# D-BUS
ac_cv_func_posix_getpwnam_r=${ac_cv_func_posix_getpwnam_r=yes}
-#mono
+# mono
cv_mono_sizeof_sunpath=108
mono_cv_uscore=${mono_cv_uscore=no}
#
# mt diff -rdf379835be88c87afe28ebc4ac3ec609317fc047 -r1a2d9ed9cf69a784e60b3eb1b2b504e8e2c5d2c2
#
#
#
# add_dir "packages/nandlogical"
#
# add_dir "packages/nandlogical/files"
#
# add_file "packages/nandlogical/files/nandlogical.c"
# content [3fd269d18fc80cb452eb8173dfcf8a67228ea72d]
#
# add_file "packages/nandlogical/nandlogical_1.0.0.bb"
# content [08c2eb3a4bb34c4e5c03d312718add26413df421]
#
============================================================
--- packages/nandlogical/files/nandlogical.c 3fd269d18fc80cb452eb8173dfcf8a67228ea72d
+++ packages/nandlogical/files/nandlogical.c 3fd269d18fc80cb452eb8173dfcf8a67228ea72d
@@ -0,0 +1,386 @@
+/*
+ NAND logical utility for Sharp Zaurus SL-C7x0/860/7500/Cxx00
+ version 1.0
+ Copyright 2006 Alexander Chukov <sash at pdaXrom.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ */
+
+#define _GNU_SOURCE
+#include <ctype.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <asm/types.h>
+#include <mtd/mtd-user.h>
+
+int fd;
+
+unsigned char *readbuf;
+unsigned char *oobbuf;
+unsigned long *log2phy;
+
+struct mtd_oob_buf oob = {0, 16, NULL};
+
+struct nand_oobinfo none_oobinfo = {
+ .useecc = MTD_NANDECC_OFF,
+};
+
+#define NAND_LOGICAL_SIZE (7 * 1024 * 1024)
+
+/////////////////////////////////////////////////////////////////////
+// oob structure
+/////////////////////////////////////////////////////////////////////
+
+#define NAND_NOOB_LOGADDR_00 8
+#define NAND_NOOB_LOGADDR_01 9
+#define NAND_NOOB_LOGADDR_10 10
+#define NAND_NOOB_LOGADDR_11 11
+#define NAND_NOOB_LOGADDR_20 12
+#define NAND_NOOB_LOGADDR_21 13
+
+static uint nand_get_logical_no(unsigned char *oob)
+{
+ unsigned short us,bit;
+ int par;
+ int good0, good1;
+
+ if(oob[NAND_NOOB_LOGADDR_00] == oob[NAND_NOOB_LOGADDR_10] &&
+ oob[NAND_NOOB_LOGADDR_01] == oob[NAND_NOOB_LOGADDR_11]){
+ good0 = NAND_NOOB_LOGADDR_00;
+ good1 = NAND_NOOB_LOGADDR_01;
+ }else
+ if(oob[NAND_NOOB_LOGADDR_10] == oob[NAND_NOOB_LOGADDR_20] &&
+ oob[NAND_NOOB_LOGADDR_11] == oob[NAND_NOOB_LOGADDR_21]){
+ good0 = NAND_NOOB_LOGADDR_10;
+ good1 = NAND_NOOB_LOGADDR_11;
+ }else
+ if(oob[NAND_NOOB_LOGADDR_20] == oob[NAND_NOOB_LOGADDR_00] &&
+ oob[NAND_NOOB_LOGADDR_21] == oob[NAND_NOOB_LOGADDR_01]){
+ good0 = NAND_NOOB_LOGADDR_20;
+ good1 = NAND_NOOB_LOGADDR_21;
+ }else{
+ return (uint)-1;
+ }
+
+ us = (((unsigned short)(oob[good0]) & 0x00ff) << 0) |
+ (((unsigned short)(oob[good1]) & 0x00ff) << 8);
+
+ par = 0;
+ for(bit = 0x0001; bit != 0; bit <<= 1){
+ if(us & bit){
+ par++;
+ }
+ }
+ if(par & 1){
+ return (uint)-2;
+ }
+
+ if(us == 0xffff){
+ return 0xffff;
+ }else{
+ return ((us & 0x07fe) >> 1);
+ }
+}
+
+static void nand_set_logical_no(uint log_no, unsigned char *oob)
+{
+ unsigned short us,bit;
+ int par;
+
+ us = (((log_no & 0x03ff) << 1) | 0x1000);
+
+ par = 0;
+ for(bit = 0x0001; bit != 0; bit <<= 1){
+ if(us & bit){
+ par++;
+ }
+ }
+ if(par & 1){
+ us |= 0x0001;
+ }
+
+ oob[NAND_NOOB_LOGADDR_00] = (unsigned char)((us & 0x00ff) >> 0);
+ oob[NAND_NOOB_LOGADDR_01] = (unsigned char)((us & 0xff00) >> 8);
+ oob[NAND_NOOB_LOGADDR_10] = oob[NAND_NOOB_LOGADDR_00];
+ oob[NAND_NOOB_LOGADDR_11] = oob[NAND_NOOB_LOGADDR_01];
+ oob[NAND_NOOB_LOGADDR_20] = oob[NAND_NOOB_LOGADDR_00];
+ oob[NAND_NOOB_LOGADDR_21] = oob[NAND_NOOB_LOGADDR_01];
+}
+
+void scan_logical(int blocks, int erasesize)
+{
+ int i;
+ unsigned long offset;
+ int ret = 1;
+ for (i = 0; i < blocks; i++)
+ log2phy[i] = (uint) -1;
+ offset = 0;
+ for (i = 0; i < blocks; i++) {
+ oob.start = offset;
+ ret = ioctl(fd, MEMREADOOB, &oob);
+
+ //ret = nand_read_raw(nand, oobuf, offset, nand->writesize, nand->oobsize);
+ if (!ret) {
+ int log_no = nand_get_logical_no(oobbuf);
+ if (((int)log_no >= 0) && (log_no < blocks)) {
+ log2phy[log_no] = offset;
+ //printf("NAND logical - %08X -> %04X\n", offset, log_no * erasesize);
+ } else {
+ //printf("NAND logical - %08X - skip (%x)\n", offset, log_no);
+ }
+ } else {
+ //printf("NAND logical - offset %x read OOB problem\n", offset);
+ }
+ offset += erasesize;
+ }
+}
+
+unsigned long add_logical(unsigned long ofs, int blocks, int erasesize, int bs)
+{
+ erase_info_t erase;
+ unsigned long offset = 0;
+ int i;
+ int ret;
+
+ erase.length = erasesize;
+
+ for (i = 0; i < blocks; i++) {
+ oob.start = offset;
+ ret = ioctl(fd, MEMREADOOB, &oob);
+
+ if (!ret) {
+ int log_no = nand_get_logical_no(oobbuf);
+
+//printf("-- %x\n", log_no);
+
+ if ((short)log_no == -1) {
+ int j = 0;
+ {
+ loff_t offs = offset;
+ erase.start = offset;
+ int ret = ioctl(fd, MEMGETBADBLOCK, &offs);
+ if (ret > 0) {
+ printf ("\nSkipping bad block at 0x%08x\n", erase.start);
+ goto nextblock;
+ } else if (ret < 0) {
+ perror("ioctl(MEMGETBADBLOCK)");
+ exit(1);
+ } else {
+ printf("%x - no bad block\n", offset);
+ }
+
+ if (ioctl(fd, MEMERASE, &erase) != 0) {
+ perror("ioctl(MEMERASE)");
+ goto nextblock;
+ }
+
+ //printf("%x - erased\n", offset);
+
+ }
+
+ //printf("NAND logical - found free block %x, mapped as %x\n", offset, ofs);
+
+ log2phy[ofs / erasesize] = offset;
+
+ return offset;
+ } else {
+ //fprintf(stderr, "found: %x\n", log_no);
+ }
+ } else {
+ perror ("ioctl(MEMREADOOB)");
+ }
+
+ nextblock:
+ offset += erasesize;
+ }
+
+ return (unsigned long)-1;
+}
+
+void usage(void)
+{
+ fprintf(stderr, "Usage:\nnandlogical <mtd char device> READ|WRITE <start> <length> <file>\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ mtd_info_t meminfo;
+ char *mtddev;
+ int blocks;
+ unsigned long start_addr;
+ unsigned long end_addr;
+ unsigned long length;
+ unsigned long ofs;
+ int bs;
+ int ofd;
+ int func_write = 0;
+ int oobinfochanged = 0;
+ struct nand_oobinfo old_oobinfo;
+
+ if (argc < 6)
+ usage();
+
+ if (strcmp(argv[2], "WRITE") == 0)
+ func_write = 1;
+ else if (strcmp(argv[2], "READ") != 0)
+ usage();
+
+ mtddev = argv[1];
+ start_addr = strtoul(argv[3], NULL, 0);
+ length = strtoul(argv[4], NULL, 0);
+
+ if (func_write) {
+ if ((ofd = open(argv[5], O_RDONLY)) == -1) {
+ perror("open input file");
+ exit(1);
+ }
+ /* Open MTD device */
+ if ((fd = open(mtddev, O_RDWR)) == -1) {
+ perror("open flash");
+ exit (1);
+ }
+ } else {
+ if ((ofd = open(argv[5], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) {
+ perror ("open outfile");
+ exit(1);
+ }
+ /* Open MTD device */
+ if ((fd = open(mtddev, O_RDONLY)) == -1) {
+ perror("open flash");
+ exit (1);
+ }
+ }
+
+ /* Fill in MTD device capability structure */
+ if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
+ perror("MEMGETINFO");
+ close(fd);
+ exit (1);
+ }
+
+ /* Make sure device page sizes are valid */
+ if (!(meminfo.oobsize == 64 && meminfo.writesize == 2048) &&
+ !(meminfo.oobsize == 16 && meminfo.writesize == 512) &&
+ !(meminfo.oobsize == 8 && meminfo.writesize == 256)) {
+ fprintf(stderr, "Unknown flash (not normal NAND)\n");
+ close(fd);
+ exit(1);
+ }
+
+ //printf("erasesize %x\nwritesize %x\noobsize %x\nsize %x\n", meminfo.erasesize, meminfo.writesize, meminfo.oobsize, meminfo.size);
+
+ blocks = NAND_LOGICAL_SIZE / meminfo.erasesize;
+ log2phy = (unsigned long *) malloc(blocks * sizeof(unsigned long));
+ readbuf = (char *)malloc(meminfo.erasesize);
+ oobbuf = (char *)malloc(meminfo.writesize);
+ oob.ptr = oobbuf;
+
+ scan_logical(blocks, meminfo.erasesize);
+
+ //printf("Start: %x\nEnd: %x\n", start_addr, length);
+
+ end_addr = start_addr + length;
+ bs = meminfo.writesize;
+
+ for (ofs = start_addr; ofs < end_addr ; ofs+=bs) {
+ int new_logical_added = 0;
+ int offset = log2phy[ofs / meminfo.erasesize];
+
+ if ((int)offset < 0 && func_write) {
+ //printf("add logical block...\n");
+ offset = add_logical(ofs, blocks, meminfo.erasesize, bs);
+ new_logical_added = 1;
+ }
+
+ if ((int)offset < 0) {
+ printf("NAND logical - offset %08X not found\n", ofs);
+ goto closeall;
+ }
+
+ offset += ofs % meminfo.erasesize;
+
+ //printf(":%x\n", offset);
+
+ if (func_write) {
+ int len;
+ memset(readbuf, 0xff, bs);
+ len = read(ofd, readbuf, bs);
+ if (len > 0) {
+#if 1
+ if (ofs % meminfo.erasesize == 0) {
+ int j;
+ erase_info_t erase;
+ erase.start = offset;
+ erase.length = meminfo.erasesize;
+ if (ioctl(fd, MEMERASE, &erase) != 0) {
+ printf("ioctl(MEMERASE) %x\n", offset);
+ //goto nextblock;
+ }
+ //printf("Erased\n");
+
+ for (j = 0; j < meminfo.erasesize; j+=bs) {
+ int log_no;
+ oob.start = offset + j;
+ oob.length = 16;
+
+ memset(oobbuf, 0xff, 16);
+ nand_set_logical_no(ofs / meminfo.erasesize, oobbuf);
+ if (ioctl(fd, MEMWRITEOOB, &oob) != 0) {
+ //perror ("ioctl(MEMWRITEOOB)");
+ printf("NAND logical add - MEMWRITEOOB error %x\n", offset + j);
+ exit(1);
+ }
+ memset(oobbuf, 0xff, 16);
+ if (ioctl(fd, MEMREADOOB, &oob) != 0) {
+ perror ("ioctl(MEMREADOOB)");
+ exit(1);
+ }
+ log_no = nand_get_logical_no(oobbuf);
+ //printf("%x:1 write %x, read %x\n", offset + j, ofs / meminfo.erasesize, log_no);
+ }
+
+ }
+#endif
+ if (pwrite(fd, readbuf, bs, offset) != bs) {
+ perror ("pwrite");
+ goto closeall;
+ }
+
+ } else
+ break;
+ } else {
+ if (pread(fd, readbuf, bs, offset) != bs) {
+ perror("pread");
+ goto closeall;
+ }
+ write(ofd, readbuf, ((end_addr - ofs) < bs)?(end_addr - ofs):bs);
+ }
+ }
+
+ closeall:
+
+ free(log2phy);
+ free(readbuf);
+ free(oobbuf);
+ close(fd);
+ close(ofd);
+
+ return 0;
+}
============================================================
--- packages/nandlogical/nandlogical_1.0.0.bb 08c2eb3a4bb34c4e5c03d312718add26413df421
+++ packages/nandlogical/nandlogical_1.0.0.bb 08c2eb3a4bb34c4e5c03d312718add26413df421
@@ -0,0 +1,18 @@
+DESCRIPTION = "Nandlogical for Sharp mtd1"
+LICENSE = "GPL"
+DEPENDS = "mtd-utils"
+COMPATIBLE_MACHINE = "(c7x0)"
+PR = "r0"
+
+SRC_URI = "file://nandlogical.c"
+
+S = "${WORKDIR}/${P}"
+
+do_compile () {
+ ${CC} -o nandlogical ${WORKDIR}/nandlogical.c -static
+}
+
+do_install () {
+ install -d ${D}${bindir}/
+ install -m 0755 ${WORKDIR}/${P}/nandlogical ${D}${bindir}/
+}
More information about the Openembedded-commits
mailing list