From 8571375a10e51099dbdd208df678e00644e09523 Mon Sep 17 00:00:00 2001 From: Andrea Adami Date: Sun, 3 Aug 2008 22:37:23 +0000 Subject: nandlogical: initial release. closes 4470. * commit by Laibsch --- packages/nandlogical/.mtn2git_empty | 0 packages/nandlogical/files/.mtn2git_empty | 0 packages/nandlogical/files/nandlogical.c | 386 ++++++++++++++++++++++++++++++ packages/nandlogical/nandlogical_1.0.0.bb | 17 ++ 4 files changed, 403 insertions(+) create mode 100644 packages/nandlogical/.mtn2git_empty create mode 100644 packages/nandlogical/files/.mtn2git_empty create mode 100644 packages/nandlogical/files/nandlogical.c create mode 100644 packages/nandlogical/nandlogical_1.0.0.bb (limited to 'packages') diff --git a/packages/nandlogical/.mtn2git_empty b/packages/nandlogical/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/nandlogical/files/.mtn2git_empty b/packages/nandlogical/files/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/nandlogical/files/nandlogical.c b/packages/nandlogical/files/nandlogical.c new file mode 100644 index 0000000000..d88d1c212f --- /dev/null +++ b/packages/nandlogical/files/nandlogical.c @@ -0,0 +1,386 @@ +/* + NAND logical utility for Sharp Zaurus SL-C7x0/860/7500/Cxx00 + version 1.0 + Copyright 2006 Alexander Chukov + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +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 READ|WRITE \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; +} diff --git a/packages/nandlogical/nandlogical_1.0.0.bb b/packages/nandlogical/nandlogical_1.0.0.bb new file mode 100644 index 0000000000..8b6ce70bda --- /dev/null +++ b/packages/nandlogical/nandlogical_1.0.0.bb @@ -0,0 +1,17 @@ +DESCRIPTION = "Nandlogical for Sharp mtd1" +LICENSE = "GPL" +DEPENDS = "mtd-utils" +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}/ +} -- cgit v1.2.3 From cefb9bb3cb800983851a6b69180df6a93e8b14c2 Mon Sep 17 00:00:00 2001 From: Thomas Kunze Date: Sun, 3 Aug 2008 23:58:58 +0000 Subject: kexecboot: fix build of initramfs-kexecboot-image --- packages/kexecboot/initramfs-kexecboot_1.0.bb | 20 ++++++++++++++++++++ packages/kexecboot/initramfs_kexecboot_1.0.bb | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 packages/kexecboot/initramfs-kexecboot_1.0.bb delete mode 100644 packages/kexecboot/initramfs_kexecboot_1.0.bb (limited to 'packages') diff --git a/packages/kexecboot/initramfs-kexecboot_1.0.bb b/packages/kexecboot/initramfs-kexecboot_1.0.bb new file mode 100644 index 0000000000..e1337419b8 --- /dev/null +++ b/packages/kexecboot/initramfs-kexecboot_1.0.bb @@ -0,0 +1,20 @@ +DESCRIPTON = "A init script that mounts a device and kexecs a new kernel from it." +PR = "r6" +RDEPENDS = "kexecboot" +do_compile() { + cat > init.sh << EOF +#!/bin/sh +/bin/mount -t proc proc /proc +/usr/bin/kexecboot -a 270 -i /dev/event0 +EOF +} + +do_install() { + install -m 0755 ${S}/init.sh ${D}/init + install -d ${D}/proc + install -d ${D}/mnt +} + +PACKAGE_ARCH = "all" + +FILES_${PN} = "/init /proc /mnt" diff --git a/packages/kexecboot/initramfs_kexecboot_1.0.bb b/packages/kexecboot/initramfs_kexecboot_1.0.bb deleted file mode 100644 index e1337419b8..0000000000 --- a/packages/kexecboot/initramfs_kexecboot_1.0.bb +++ /dev/null @@ -1,20 +0,0 @@ -DESCRIPTON = "A init script that mounts a device and kexecs a new kernel from it." -PR = "r6" -RDEPENDS = "kexecboot" -do_compile() { - cat > init.sh << EOF -#!/bin/sh -/bin/mount -t proc proc /proc -/usr/bin/kexecboot -a 270 -i /dev/event0 -EOF -} - -do_install() { - install -m 0755 ${S}/init.sh ${D}/init - install -d ${D}/proc - install -d ${D}/mnt -} - -PACKAGE_ARCH = "all" - -FILES_${PN} = "/init /proc /mnt" -- cgit v1.2.3 From 18ee86b654168f9725c194793de4879076c14ea1 Mon Sep 17 00:00:00 2001 From: Rolf Leggewie Date: Mon, 4 Aug 2008 00:38:18 +0000 Subject: nandlogical: set COMPATIBLE_MACHINE to c7x0 for now until somebody compiles an authoritative list. --- packages/nandlogical/nandlogical_1.0.0.bb | 1 + 1 file changed, 1 insertion(+) (limited to 'packages') diff --git a/packages/nandlogical/nandlogical_1.0.0.bb b/packages/nandlogical/nandlogical_1.0.0.bb index 8b6ce70bda..7d8fc04b4e 100644 --- a/packages/nandlogical/nandlogical_1.0.0.bb +++ b/packages/nandlogical/nandlogical_1.0.0.bb @@ -1,6 +1,7 @@ DESCRIPTION = "Nandlogical for Sharp mtd1" LICENSE = "GPL" DEPENDS = "mtd-utils" +COMPATIBLE_MACHINE = "(c7x0)" PR = "r0" SRC_URI = "file://nandlogical.c" -- cgit v1.2.3 From cfcda84bd3bd18cf4b93ee17fb663771c236b136 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Mon, 4 Aug 2008 09:52:42 +0000 Subject: ffmpeg git: bump SRCREV for arm --- packages/ffmpeg/ffmpeg_git.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/ffmpeg/ffmpeg_git.bb b/packages/ffmpeg/ffmpeg_git.bb index d05e65d281..c93261283f 100644 --- a/packages/ffmpeg/ffmpeg_git.bb +++ b/packages/ffmpeg/ffmpeg_git.bb @@ -3,7 +3,7 @@ require ffmpeg.inc DEPENDS += "libgsm" PV = "0.4.9+${PR}+gitr${SRCREV}" -PR = "r20" +PR = "r21" DEFAULT_PREFERENCE = "-1" DEFAULT_PREFERENCE_armv5te = "1" @@ -14,7 +14,7 @@ FFBRANCH_arm = "arm-neon" FFBRANCH ?= "master" SRCREV = "3692b8de9fae73860be636606cb6344f26e28b1a" -SRCREV_arm = "af7bda5224b6cdfb0c1f03686d2a6b631a455668" +SRCREV_arm = "3c4b8ba71b922be6559fcfea3cb990ea3ded234d" SRC_URI = "git://git.mansr.com/ffmpeg.mru;protocol=git;branch=${FFBRANCH} \ " -- cgit v1.2.3 From 14dc5bee32c8b65df29dc847e437534609bb9267 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Mon, 4 Aug 2008 10:39:16 +0000 Subject: glibc: use ARM instruction set always - it is not buildable with Thumb - close #1708 --- packages/glibc/glibc.inc | 2 ++ packages/glibc/glibc_2.6.1.bb | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/glibc/glibc.inc b/packages/glibc/glibc.inc index 8f9b34b252..c2ee5317bf 100644 --- a/packages/glibc/glibc.inc +++ b/packages/glibc/glibc.inc @@ -17,4 +17,6 @@ LEAD_SONAME = "libc.so" GLIBC_EXTRA_OECONF ?= "" INHIBIT_DEFAULT_DEPS = "1" +ARM_INSTRUCTION_SET = "arm" + PACKAGES = "glibc catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-doc glibc-locale libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile" diff --git a/packages/glibc/glibc_2.6.1.bb b/packages/glibc/glibc_2.6.1.bb index 60eb071032..6faa3df9af 100644 --- a/packages/glibc/glibc_2.6.1.bb +++ b/packages/glibc/glibc_2.6.1.bb @@ -1,8 +1,6 @@ require glibc.inc PR = "r10" -ARM_INSTRUCTION_SET = "arm" - PACKAGES_DYNAMIC = "libc6*" RPROVIDES_${PN}-dev = "libc6-dev" -- cgit v1.2.3 From d371e2c69b107d2949d640df221405306e6a40f5 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Mon, 4 Aug 2008 10:49:33 +0000 Subject: gsoap-native: unbreak build - close #2373 --- packages/gsoap/gsoap-native/.mtn2git_empty | 0 .../gsoap/gsoap-native/use-just-built-binary.patch | 19 +++++++++++++++++++ packages/gsoap/gsoap-native_2.7.7.bb | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 packages/gsoap/gsoap-native/.mtn2git_empty create mode 100644 packages/gsoap/gsoap-native/use-just-built-binary.patch (limited to 'packages') diff --git a/packages/gsoap/gsoap-native/.mtn2git_empty b/packages/gsoap/gsoap-native/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/gsoap/gsoap-native/use-just-built-binary.patch b/packages/gsoap/gsoap-native/use-just-built-binary.patch new file mode 100644 index 0000000000..f7e4811f9e --- /dev/null +++ b/packages/gsoap/gsoap-native/use-just-built-binary.patch @@ -0,0 +1,19 @@ +--- + soapcpp2/wsdl/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- gsoap-2.7.orig/soapcpp2/wsdl/Makefile.am ++++ gsoap-2.7/soapcpp2/wsdl/Makefile.am +@@ -13,11 +13,11 @@ SOAP_CPP_SRC=wsdlC.cpp + SOAPHEADER=wsdl.h + SOAP_FLAGS=-SC -pwsdl + BUILT_SOURCES=$(SOAP_CPP_SRC) + + $(SOAP_CPP_SRC) : $(SOAPHEADER) +- $(SOAP) $(SOAP_FLAGS) $(SOAPHEADER) ++ ../src/soapcpp2 $(SOAP_FLAGS) $(SOAPHEADER) + + #LIBS= + + bin_PROGRAMS=wsdl2h + diff --git a/packages/gsoap/gsoap-native_2.7.7.bb b/packages/gsoap/gsoap-native_2.7.7.bb index b7553b404d..206208d329 100644 --- a/packages/gsoap/gsoap-native_2.7.7.bb +++ b/packages/gsoap/gsoap-native_2.7.7.bb @@ -1,6 +1,9 @@ require gsoap_${PV}.bb DEPENDS = "" +PR = "r1" + +SRC_URI += "file://use-just-built-binary.patch;patch=1" inherit native @@ -11,4 +14,3 @@ do_stage() { do_install() { : } - -- cgit v1.2.3