diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-01 19:09:11 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-01 19:09:57 +0100 |
commit | d62ee7eaf2ba025c3f64b2d4e10dc7cec4637612 (patch) | |
tree | f36fe3008f36ff75cbdd31b630f8f13f1f205ebb /meta/recipes-devtools | |
parent | caab7fc509bf27706ff3248689f6afd04225cfda (diff) | |
download | openembedded-core-d62ee7eaf2ba025c3f64b2d4e10dc7cec4637612.tar.gz openembedded-core-d62ee7eaf2ba025c3f64b2d4e10dc7cec4637612.tar.bz2 openembedded-core-d62ee7eaf2ba025c3f64b2d4e10dc7cec4637612.zip |
packages: Separate out most of the remaining packages into recipes
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools')
36 files changed, 2241 insertions, 331 deletions
diff --git a/meta/recipes-devtools/exmap-console/exmap-console.inc b/meta/recipes-devtools/exmap-console/exmap-console.inc new file mode 100644 index 0000000000..efbd79fce1 --- /dev/null +++ b/meta/recipes-devtools/exmap-console/exmap-console.inc @@ -0,0 +1,59 @@ +DESCRIPTION = "Console based version of exmap, a memory usage analysis tool" +HOMEPAGE = "http://projects.o-hand.com/exmap-console" +SECTION = "devel" +LICENSE = "GPL" +DEPENDS = "virtual/kernel readline glib-2.0" + +SRC_URI = "http://projects.o-hand.com/sources/exmap-console/exmap-console-${PV}.tgz" + +TEMPPACKAGE_ARCH := "${PACKAGE_ARCH}" + +inherit module-base +inherit autotools + +PACKAGE_ARCH = "${TEMPPACKAGE_ARCH}" + +PACKAGES =+ "exmap-server kernel-module-exmap" + +FILES_exmap-console = "${bindir}/exmap ${bindir}/exmapd" +RDEPENDS_exmap-console += "kernel-module-exmap" + +FILES_exmap-server = "${bindir}/exmapserver" +RDEPENDS_exmap-server += "kernel-module-exmap" + +FILES_kernel-module-exmap = "${base_libdir}" +PACKAGE_ARCH_kernel-module-exmap = "${MACHINE_ARCH}" +RDEPENDS_kernel-module-exmap += "update-modules kernel-image-${KERNEL_VERSION}" + +S = "${WORKDIR}/exmap-console-${PV}" + +export MODULE_PATH="${D}${base_libdir}/modules/${KERNEL_VERSION}" + +do_compile() { + cd ${S}/src + make + + cd ${S}/kernel + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \ + KERNEL_SRC=${STAGING_KERNEL_DIR} \ + KERNEL_VERSION=${KERNEL_VERSION} \ + CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ + ${MAKE_TARGETS} +} + +do_install() { + oe_runmake 'DESTDIR=${D}' 'DEPMOD=/bin/true' install +} + +pkg_postinst_append_kernel-module-exmap () { + if [ -n "$D" ]; then + exit 1 + fi + depmod -a + update-modules || true +} + +pkg_postrm_append_kernel-module-exmap () { + update-modules || true +} diff --git a/meta/recipes-devtools/exmap-console/exmap-console_0.4.1.bb b/meta/recipes-devtools/exmap-console/exmap-console_0.4.1.bb new file mode 100644 index 0000000000..c76c5c3b4c --- /dev/null +++ b/meta/recipes-devtools/exmap-console/exmap-console_0.4.1.bb @@ -0,0 +1,3 @@ +require exmap-console.inc + +PR = "r8" diff --git a/meta/recipes-devtools/exmap-console/exmap-console_svn.bb b/meta/recipes-devtools/exmap-console/exmap-console_svn.bb new file mode 100644 index 0000000000..ce222854e2 --- /dev/null +++ b/meta/recipes-devtools/exmap-console/exmap-console_svn.bb @@ -0,0 +1,8 @@ +require exmap-console.inc + +PV = "0.4+svnr${SRCREV}" +PR = "r5" + +SRC_URI = "svn://svn.o-hand.com/repos/misc/trunk;module=exmap-console;proto=http" + +S = "${WORKDIR}/exmap-console" diff --git a/meta/recipes-devtools/gmp/gmp-4.2.1/disable-stdc.patch b/meta/recipes-devtools/gmp/gmp-4.2.1/disable-stdc.patch deleted file mode 100644 index 83c9eae36a..0000000000 --- a/meta/recipes-devtools/gmp/gmp-4.2.1/disable-stdc.patch +++ /dev/null @@ -1,31 +0,0 @@ -# "extern inline" in traditional gcc means that the function should be -# inlined wherever it's seen, while in C99, "extern inline" means that i -# the function should only be inlined where the inline definition is -# seen while in other places it's not inlined: -# http://gcc.gnu.org/ml/gcc/2006-11/msg00006.html -# -# gmp checks "--std=gnu99" to use C99 convention however it internally -# defines some "extern inline" functions in gmp.h, which is included -# by mainly .c files and finally lead a flood of redefinition function -# errors when linking objects together. -# -# So disable C99/ANSI detection to stick to tranditional gcc behavior -# -# by Kevin Tian <kevin.tian@intel.com>, 2010-08-13 -# -# (this patch is licensed under GPLv2+) - -diff --git a/configure.in b/configure.in -index 450cc92..aab0b59 100644 ---- a/configure.in -+++ b/configure.in -@@ -1869,9 +1869,7 @@ AC_SUBST(DEFN_LONG_LONG_LIMB) - - # The C compiler and preprocessor, put into ANSI mode if possible. - AC_PROG_CC --AC_PROG_CC_STDC - AC_PROG_CPP --GMP_H_ANSI - - - # The C compiler on the build system, and associated tests. diff --git a/meta/recipes-devtools/gmp/gmp.inc b/meta/recipes-devtools/gmp/gmp.inc deleted file mode 100644 index 6b56f7e7c8..0000000000 --- a/meta/recipes-devtools/gmp/gmp.inc +++ /dev/null @@ -1,16 +0,0 @@ -SECTION = "devel" -DESCRIPTION = "GNU multiprecision arithmetic library" -HOMEPAGE = "http://www.swox.com/gmp/" -LICENSE = "GPLv3 LGPLv3" - -SRC_URI = "ftp://ftp.gnu.org/gnu/gmp/gmp-${PV}.tar.bz2 \ - file://configure.patch \ - file://amd64.patch " - -inherit autotools - -ARM_INSTRUCTION_SET = "arm" - -acpaths = "" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/gmp/gmp/amd64.patch b/meta/recipes-devtools/gmp/gmp/amd64.patch deleted file mode 100644 index 67be9dd350..0000000000 --- a/meta/recipes-devtools/gmp/gmp/amd64.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- gmp-4.1.4/longlong.h.orig 2004-04-22 00:34:28.000000000 +0200 -+++ gmp-4.1.4/longlong.h 2005-07-18 01:13:06.000000000 +0200 -@@ -738,8 +738,10 @@ - count is only an int. */ - #define count_trailing_zeros(count, x) \ - do { \ -+ UDItype __cbtmp; \ - ASSERT ((x) != 0); \ -- __asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x))); \ -+ __asm__ ("bsfq %1,%0" : "=r" (__cbtmp) : "rm" ((UDItype)(x))); \ -+ (count) = __cbtmp; \ - } while (0) - #endif /* x86_64 */ - diff --git a/meta/recipes-devtools/gmp/gmp/configure.patch b/meta/recipes-devtools/gmp/gmp/configure.patch deleted file mode 100644 index ed0c02d86c..0000000000 --- a/meta/recipes-devtools/gmp/gmp/configure.patch +++ /dev/null @@ -1,195 +0,0 @@ - acinclude.m4 | 26 ++++++++++++++------------ - configure.in | 24 +++++++++--------------- - 2 files changed, 23 insertions(+), 27 deletions(-) - -Index: gmp-5.0.1/acinclude.m4 -=================================================================== ---- gmp-5.0.1.orig/acinclude.m4 -+++ gmp-5.0.1/acinclude.m4 -@@ -30,20 +30,20 @@ dnl a_out.exe - OpenVMS DEC C called - dnl conftest.exe - various DOS compilers - - --define(IA64_PATTERN, -+define([IA64_PATTERN], - [[ia64*-*-* | itanium-*-* | itanium2-*-*]]) - - dnl Need to be careful not to match m6811, m6812, m68hc11 and m68hc12, all - dnl of which config.sub accepts. (Though none of which are likely to work - dnl with GMP.) - dnl --define(M68K_PATTERN, -+define([M68K_PATTERN], - [[m68k-*-* | m68[0-9][0-9][0-9]-*-*]]) - --define(POWERPC64_PATTERN, -+define([POWERPC64_PATTERN], - [[powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-* | powerpc970-*-* | power[3-9]-*-*]]) - --define(X86_PATTERN, -+define([X86_PATTERN], - [[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]]) - - define(X86_64_PATTERN, -@@ -64,7 +64,7 @@ dnl x86 -> x86 - dnl x86/k6 -> k6 - dnl x86/k6/mmx -> k6_mmx - --define(GMP_FAT_SUFFIX, -+define([GMP_FAT_SUFFIX], - [[$1=`echo $2 | sed -e '/\//s:^[^/]*/::' -e 's:[\\/]:_:g'`]]) - - -@@ -73,7 +73,7 @@ dnl ---------------------------------- - dnl Emit code to remove any occurrence of ITEM from $LISTVAR. ITEM can be a - dnl shell expression like $foo if desired. - --define(GMP_REMOVE_FROM_LIST, -+define([GMP_REMOVE_FROM_LIST], - [remove_from_list_tmp= - for remove_from_list_i in $[][$1]; do - if test $remove_from_list_i = [$2]; then :; -@@ -89,12 +89,12 @@ dnl GMP_STRIP_PATH(subdir) - dnl ---------------------- - dnl Strip entries */subdir from $path and $fat_path. - --define(GMP_STRIP_PATH, -+define([GMP_STRIP_PATH], - [GMP_STRIP_PATH_VAR(path, [$1]) - GMP_STRIP_PATH_VAR(fat_path, [$1]) - ]) - --define(GMP_STRIP_PATH_VAR, -+define([GMP_STRIP_PATH_VAR], - [tmp_path= - for i in $[][$1]; do - case $i in -@@ -115,7 +115,7 @@ dnl - dnl Dummy value for GMP_LIMB_BITS is enough - dnl for all current configure-time uses of gmp.h. - --define(GMP_INCLUDE_GMP_H, -+define([GMP_INCLUDE_GMP_H], - [[#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ - #define GMP_NAIL_BITS $GMP_NAIL_BITS - #define GMP_LIMB_BITS 123 -@@ -130,7 +130,7 @@ dnl Expand at autoconf time to the valu - dnl FILE. The regexps here aren't very rugged, but are enough for gmp. - dnl /dev/null as a parameter prevents a hang if $2 is accidentally omitted. - --define(GMP_HEADER_GETVAL, -+define([GMP_HEADER_GETVAL], - [patsubst(patsubst( - esyscmd([grep "^#define $1 " $2 /dev/null 2>/dev/null]), - [^.*$1[ ]+],[]), -@@ -144,7 +144,7 @@ dnl The gmp version number, extracted f - dnl autoconf time. Two digits like 3.0 if patchlevel <= 0, or three digits - dnl like 3.0.1 if patchlevel > 0. - --define(GMP_VERSION, -+define([GMP_VERSION], - [GMP_HEADER_GETVAL(__GNU_MP_VERSION,gmp-h.in)[]dnl - .GMP_HEADER_GETVAL(__GNU_MP_VERSION_MINOR,gmp-h.in)[]dnl - .GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp-h.in)]) -@@ -1506,7 +1506,9 @@ esac - echo ["define(<CONFIG_TOP_SRCDIR>,<\`$tmp'>)"] >>$gmp_tmpconfigm4 - - # All CPUs use asm-defs.m4 --echo ["include][(CONFIG_TOP_SRCDIR\`/mpn/asm-defs.m4')"] >>$gmp_tmpconfigm4i -+echo -n ["include("] >>$gmp_tmpconfigm4i -+echo -n ["CONFIG_TOP_SRCDIR\`/mpn/asm-defs.m4'"] >>$gmp_tmpconfigm4i -+echo [")"] >>$gmp_tmpconfigm4i - ]) - - -Index: gmp-5.0.1/configure.in -=================================================================== ---- gmp-5.0.1.orig/configure.in -+++ gmp-5.0.1/configure.in -@@ -29,12 +29,6 @@ AC_REVISION($Revision$) - AC_PREREQ(2.59) - AC_INIT(GNU MP, GMP_VERSION, gmp-bugs@gmplib.org, gmp) - AC_CONFIG_SRCDIR(gmp-impl.h) --m4_pattern_forbid([^[ \t]*GMP_]) --m4_pattern_allow(GMP_LDFLAGS) --m4_pattern_allow(GMP_LIMB_BITS) --m4_pattern_allow(GMP_MPARAM_H_SUGGEST) --m4_pattern_allow(GMP_NAIL_BITS) --m4_pattern_allow(GMP_NUMB_BITS) - - # If --target is not used then $target_alias is empty, but if say - # "./configure athlon-pc-freebsd3.5" is used, then all three of -@@ -303,7 +297,7 @@ AH_VERBATIM([HAVE_HOST_CPU_1], - # After GMP specific searches and tests, the standard autoconf AC_PROG_CC is - # called. User selections of CC etc are respected. - # --# Care is taken not to use macros like AC_TRY_COMPILE during the GMP -+# Care is taken not to use macros like AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) during the GMP - # pre-testing, since they of course depend on AC_PROG_CC, and also some of - # them cache their results, which is not wanted. - # -@@ -395,7 +389,7 @@ abilist="standard" - # FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring - # c89 over cc here. But note that on HP-UX c89 provides a castrated - # environment, and would want to be excluded somehow. Maybe --# AC_PROG_CC_STDC already does enough to stick cc into ANSI mode and -+# already does enough to stick cc into ANSI mode and - # we don't need to worry. - # - cclist="gcc cc" -@@ -1580,7 +1574,7 @@ esac - CFLAGS_or_unset=${CFLAGS-'(unset)'} - CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'} - --cat >&AC_FD_CC <<EOF -+cat >&AS_MESSAGE_LOG_FD() <<EOF - User: - ABI=$ABI - CC=$CC -@@ -1987,7 +1981,6 @@ AC_SUBST(DEFN_LONG_LONG_LIMB) - - # The C compiler and preprocessor, put into ANSI mode if possible. - AC_PROG_CC --AC_PROG_CC_STDC - AC_PROG_CPP - GMP_H_ANSI - -@@ -2010,11 +2003,11 @@ AC_SUBST(CCAS) - - # The C++ compiler, if desired. - want_cxx=no -+AC_PROG_CXX - if test $enable_cxx != no; then - test_CXXFLAGS=${CXXFLAGS+set} -- AC_PROG_CXX - -- echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AC_FD_CC -+ echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AS_MESSAGE_LOG_FD() - cxxflags_ac_prog_cxx=$CXXFLAGS - cxxflags_list=ac_prog_cxx - -@@ -2120,7 +2113,7 @@ case $host in - esac - - --cat >&AC_FD_CC <<EOF -+cat >&AS_MESSAGE_LOG_FD() <<EOF - Decided: - ABI=$ABI - CC=$CC -@@ -3376,7 +3369,7 @@ GMP_FINISH - # FIXME: Upcoming version of autoconf/automake may not like broken lines. - # Right now automake isn't accepting the new AC_CONFIG_FILES scheme. - --AC_OUTPUT(Makefile \ -+AC_CONFIG_FILES([Makefile \ - mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile \ - mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile \ - tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile \ -@@ -3385,4 +3378,5 @@ AC_OUTPUT(Makefile \ - tests/cxx/Makefile \ - doc/Makefile tune/Makefile \ - demos/Makefile demos/calc/Makefile demos/expr/Makefile \ -- gmp.h:gmp-h.in mp.h:mp-h.in) -+ gmp.h:gmp-h.in mp.h:mp-h.in]) -+AC_OUTPUT diff --git a/meta/recipes-devtools/gmp/gmp/sh4-asmfix.patch b/meta/recipes-devtools/gmp/gmp/sh4-asmfix.patch deleted file mode 100644 index 1a01f61533..0000000000 --- a/meta/recipes-devtools/gmp/gmp/sh4-asmfix.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- gmp-4.1.4/mpn/sh/add_n.s 2005/11/17 08:44:00 1.1 -+++ gmp-4.1.4/mpn/sh/add_n.s 2005/11/17 08:18:57 -@@ -29,8 +29,8 @@ - - .text - .align 2 -- .global ___gmpn_add_n --___gmpn_add_n: -+ .global __gmpn_add_n -+__gmpn_add_n: - mov #0,r3 ! clear cy save reg - - Loop: mov.l @r5+,r1 ---- gmp-4.1.4/mpn/sh/sub_n.s 2005/11/17 08:44:04 1.1 -+++ gmp-4.1.4/mpn/sh/sub_n.s 2005/11/17 08:18:59 -@@ -29,8 +29,8 @@ - - .text - .align 2 -- .global ___gmpn_sub_n --___gmpn_sub_n: -+ .global __gmpn_sub_n -+__gmpn_sub_n: - mov #0,r3 ! clear cy save reg - - Loop: mov.l @r5+,r1 diff --git a/meta/recipes-devtools/gmp/gmp/use-includedir.patch b/meta/recipes-devtools/gmp/gmp/use-includedir.patch deleted file mode 100644 index ee3891f807..0000000000 --- a/meta/recipes-devtools/gmp/gmp/use-includedir.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: gmp-4.2.4/Makefile.am -=================================================================== ---- gmp-4.2.4.orig/Makefile.am 2008-09-10 19:31:27.000000000 +0000 -+++ gmp-4.2.4/Makefile.am 2009-07-06 20:19:19.000000000 +0000 -@@ -106,7 +106,7 @@ - # but anyone knowledgable enough to be playing with exec_prefix will be able - # to address that. - # --includeexecdir = $(exec_prefix)/include -+includeexecdir = $(includedir) - include_HEADERS = $(GMPXX_HEADERS_OPTION) - nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION) - lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION) diff --git a/meta/recipes-devtools/gmp/gmp_4.2.1.bb b/meta/recipes-devtools/gmp/gmp_4.2.1.bb deleted file mode 100644 index d70dcf2665..0000000000 --- a/meta/recipes-devtools/gmp/gmp_4.2.1.bb +++ /dev/null @@ -1,14 +0,0 @@ -DESCRIPTION = "GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers" -HOMEPAGE = "http://gmplib.org/" -BUGTRACKER = "http://gmplib.org/mailman/listinfo/gmp-bugs" -# demo is licensed under GPLv2+, which however we don't package at all -LICENSE = "LGPLv2.1+" -LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a \ - file://COPYING.LIB;md5=fbc093901857fcd118f065f900982c24 \ - file://gmp-h.in;startline=6;endline=21;md5=5e25ffd16996faba8c1cd27b04b16099" -PR = "r0" - -SRC_URI = "ftp://ftp.gnu.org/gnu/gmp/${BP}.tar.bz2 \ - file://disable-stdc.patch" - -inherit autotools diff --git a/meta/recipes-devtools/gmp/gmp_5.0.1.bb b/meta/recipes-devtools/gmp/gmp_5.0.1.bb deleted file mode 100644 index dd908bd7ca..0000000000 --- a/meta/recipes-devtools/gmp/gmp_5.0.1.bb +++ /dev/null @@ -1,7 +0,0 @@ -require gmp.inc - -PR = "r0" - -SRC_URI_append += "file://sh4-asmfix.patch \ - file://use-includedir.patch " - diff --git a/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch b/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch new file mode 100644 index 0000000000..9b0081307a --- /dev/null +++ b/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch @@ -0,0 +1,89 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_segfault_virtprov.dpatch by Petter Reinholdtsen + +Avoid segfault when an enabled service provide a virtual system +facility. + +@DPATCH@ +--- insserv/insserv.c ++++ insserv/insserv.c 2008-02-01 11:43:45.634618329 +0100 +@@ -166,7 +166,7 @@ typedef struct pwd_struct { + + static list_t pwd = { &(pwd), &(pwd) }, * topd = &(pwd); + +-static void pushd(const char *const __restrict path); ++static void pushd(const char *const __restrict path) __attribute__((nonnull(1))); + static void pushd(const char *const path) + { + pwd_t * dir; +@@ -305,13 +305,13 @@ out: + return getserv(ptr); + } + +-static serv_t * findserv(const char *const __restrict serv) __attribute__((nonnull(1))); ++static serv_t * findserv(const char *const __restrict serv); + static serv_t * findserv(const char *const serv) + { + list_t * ptr; + serv_t * ret = (serv_t*)0; + +- if (!serv) ++ if (serv == (const char*)0) + goto out; + + list_for_each(ptr, serv_start) { +@@ -334,6 +334,9 @@ static void rememberreq(serv_t *serv, ui + list_t * ptr; + uint old = bit; + ++ if (!tmp) ++ error("%s", strerror(errno)); ++ + while ((token = strsep(&tmp, delimeter))) { + boolean found = false; + req_t * this; +@@ -399,6 +402,9 @@ static void reversereq(const serv_t * se + char * rev = strdupa(list); + uint old = bit; + ++ if (!rev) ++ error("%s", strerror(errno)); ++ + while ((dep = strsep(&rev, delimeter)) && *dep) { + serv_t * tmp; + list_t * ptr; +@@ -437,7 +443,7 @@ static void reversereq(const serv_t * se + /* + * Check required services for name + */ +-static boolean chkrequired(const char *const __restrict name) __attribute__((nonnull(1))); ++static boolean chkrequired(const char *const __restrict name); + static boolean chkrequired(const char *const name) + { + serv_t * serv = findserv(name); +--- insserv/listing.h ++++ insserv/listing.h 2008-02-01 11:40:45.347748072 +0100 +@@ -97,11 +97,11 @@ extern int makeprov(const char *__restri + extern void setorder(const char *__restrict script, const int order, boolean recursive) __attribute__((nonnull(1))); + extern int getorder(const char *__restrict script) __attribute__((nonnull(1))); + extern boolean notincluded(const char *__restrict script, const int runlevel) __attribute__((nonnull(1))); +-extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(1,2))); +-extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1,2))); ++extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(2))); ++extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1))); + extern const char * getscript(const char *__restrict prov) __attribute__((nonnull(1))); + extern const char * getprovides(const char *__restrict script) __attribute__((nonnull(1))); +-extern boolean listscripts(const char **__restrict script, const int lvl) __attribute__((nonnull(1))); ++extern boolean listscripts(const char **__restrict script, const int lvl); + extern int maxorder; + extern boolean is_loop_detected(void); + +@@ -116,7 +116,7 @@ extern int map_has_runlevels(void); + extern int map_runlevel_to_lvl (const int runlevel); + extern int map_key_to_lvl(const char key); + +-static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline,nonnull(1))); ++static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline)); + static inline char * xstrdup(const char * s) + { + char * r; diff --git a/meta/recipes-devtools/insserv/files/42_loopnochangemsg.dpatch b/meta/recipes-devtools/insserv/files/42_loopnochangemsg.dpatch new file mode 100644 index 0000000000..4a15f58312 --- /dev/null +++ b/meta/recipes-devtools/insserv/files/42_loopnochangemsg.dpatch @@ -0,0 +1,20 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_loopnochangemsg.dpatch by Petter Reinholdtsen + +Make it more obvious that introducing a loop will not change the +existing boot sequence. Thanks to Frans Pop for the rationale for +this change. + +@DPATCH@ + +--- insserv-1.11.0.orig/insserv.c ++++ insserv-1.11.0/insserv.c +@@ -2647,7 +2647,7 @@ + follow_all(); + + if (is_loop_detected() && !ignore) +- error("exiting now!\n"); ++ error("exiting without changing boot order!\n"); + + /* + * Re-order some well known scripts to get diff --git a/meta/recipes-devtools/insserv/files/crosscompile_fix.patch b/meta/recipes-devtools/insserv/files/crosscompile_fix.patch new file mode 100644 index 0000000000..14d8db468f --- /dev/null +++ b/meta/recipes-devtools/insserv/files/crosscompile_fix.patch @@ -0,0 +1,22 @@ +Index: insserv-1.11.0/Makefile +=================================================================== +--- insserv-1.11.0.orig/Makefile 2008-08-25 16:00:00.000000000 +0100 ++++ insserv-1.11.0/Makefile 2008-08-25 16:00:25.000000000 +0100 +@@ -18,16 +18,7 @@ + # + # Architecture + # +-ifdef RPM_OPT_FLAGS +- COPTS = -g $(RPM_OPT_FLAGS) +-else +- ARCH = $(shell uname -i) +-ifeq ($(ARCH),i386) +- COPTS = -O2 -mcpu=i586 -mtune=i686 +-else +- COPTS = -O2 +-endif +-endif ++COPTS = -O2 + COPTS += -g + + MY_CFLAGS = $(CFLAGS) -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ diff --git a/meta/recipes-devtools/insserv/files/insserv.conf b/meta/recipes-devtools/insserv/files/insserv.conf new file mode 100644 index 0000000000..4858f85b69 --- /dev/null +++ b/meta/recipes-devtools/insserv/files/insserv.conf @@ -0,0 +1,41 @@ +# +# All local filesystems are mounted (done during boot phase) +# +$local_fs mountall + +# +# Low level networking (ethernet card) +# +$network networking +pcmcia +hotplug + +# +# Named is operational +# +$named +named +dnsmasq +lwresd $network + +# +# All remote filesystems are mounted (note in some cases /usr may +# be remote. Most applications that care will probably require +# both $local_fs and $remote_fs) +# +$remote_fs $local_fs +mountnfs + +# +# System logger is operational +# +$syslog sysklogd + +# +# SunRPC portmapper available +# +$portmap portmap + +# +# The system time has been set correctly +# +$time hwclock + +# +# Services which need to be interactive +# +<interactive> hostname udev diff --git a/meta/recipes-devtools/insserv/files/make.patch b/meta/recipes-devtools/insserv/files/make.patch new file mode 100644 index 0000000000..bb3b51a8ca --- /dev/null +++ b/meta/recipes-devtools/insserv/files/make.patch @@ -0,0 +1,58 @@ +=== modified file 'Makefile' +--- old/Makefile 2008-06-24 14:49:47 +0000 ++++ new/Makefile 2008-06-24 15:56:15 +0000 +@@ -7,10 +7,10 @@ + INITDIR = /etc/init.d + INSCONF = /etc/insserv.conf + #DESTDIR = /tmp/root +-#DEBUG = -DDEBUG=1 -Wpacked ++DEBUG = -DDEBUG=1 -Wpacked + #LOOPS = -DIGNORE_LOOPS=1 + DEBUG = +-ISSUSE = -DSUSE ++#ISSUSE = -DSUSE + DESTDIR = + VERSION = 1.11.0 + DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]') +@@ -28,7 +28,9 @@ + COPTS = -O2 + endif + endif +- CFLAGS = -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ ++COPTS += -g ++ ++ MY_CFLAGS = $(CFLAGS) -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ + $(ISSUSE) -DINITDIR=\"$(INITDIR)\" -DINSCONF=\"$(INSCONF)\" -pipe + CLOOP = -falign-loops=0 + CC = gcc +@@ -58,13 +60,13 @@ + all: $(TODO) + + listing.o: listing.c listing.h .system +- $(CC) $(CFLAGS) $(CLOOP) -c $< ++ $(CC) $(MY_CFLAGS) $(CLOOP) -c $< + + insserv.o: insserv.c listing.h .system +- $(CC) $(CFLAGS) $(CLOOP) -c $< ++ $(CC) $(MY_CFLAGS) $(CLOOP) -c $< + + insserv: insserv.o listing.o +- $(CC) $(CFLAGS) -Wl,-O,3,--relax -o $@ $^ ++ $(CC) $(MY_CFLAGS) -Wl,-O,3,--relax -o $@ $^ + + ifeq ($(ISSUSE),-DSUSE) + insserv.8: insserv.8.in .system +@@ -86,10 +88,10 @@ + -include .depend.listing .depend.insserv + + .depend.listing: +- @$(CC) $(CFLAGS) -M listing.c >$@ 2>/dev/null ++ @$(CC) $(MY_CFLAGS) -M listing.c >$@ 2>/dev/null + + .depend.insserv: +- @$(CC) $(CFLAGS) -M insserv.c >$@ 2>/dev/null ++ @$(CC) $(MY_CFLAGS) -M insserv.c >$@ 2>/dev/null + + install: $(TODO) + $(MKDIR) $(SBINDIR) + diff --git a/meta/recipes-devtools/insserv/insserv_1.11.0.bb b/meta/recipes-devtools/insserv/insserv_1.11.0.bb new file mode 100644 index 0000000000..a45ccda48f --- /dev/null +++ b/meta/recipes-devtools/insserv/insserv_1.11.0.bb @@ -0,0 +1,17 @@ +LICENSE = "GPL" +SECTION = "base" +PR = "r1" + +SRC_URI = "ftp://ftp.suse.com/pub/projects/init/${BPN}-${PV}.tar.gz \ + file://40_segfault_virtprov.dpatch;patch=1 \ + file://42_loopnochangemsg.dpatch;patch=1 \ + file://make.patch;patch=1 \ + file://crosscompile_fix.patch;patch=1 \ + file://insserv.conf" + +do_install () { + oe_runmake 'DESTDIR=${D}' install + install -m0644 ${WORKDIR}/insserv.conf ${D}${sysconfdir}/insserv.conf +} + +BBCLASSEXTEND = "native" diff --git a/meta/recipes-devtools/intltool/intltool-0.40.6/intltool-nowarn-0.40.0.patch b/meta/recipes-devtools/intltool/intltool-0.40.6/intltool-nowarn-0.40.0.patch new file mode 100644 index 0000000000..61ecba266e --- /dev/null +++ b/meta/recipes-devtools/intltool/intltool-0.40.6/intltool-nowarn-0.40.0.patch @@ -0,0 +1,50 @@ +Index: intltool-0.40.0/intltool-extract.in +=================================================================== +--- intltool-0.40.0.orig/intltool-extract.in 2008-12-17 11:50:19.000000000 +0000 ++++ intltool-0.40.0/intltool-extract.in 2008-12-17 11:50:31.000000000 +0000 +@@ -1,4 +1,4 @@ +-#!@INTLTOOL_PERL@ -w ++#!@INTLTOOL_PERL@ + # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + + # +Index: intltool-0.40.0/intltool-merge.in +=================================================================== +--- intltool-0.40.0.orig/intltool-merge.in 2008-12-17 11:50:19.000000000 +0000 ++++ intltool-0.40.0/intltool-merge.in 2008-12-17 11:50:38.000000000 +0000 +@@ -1,4 +1,4 @@ +-#!@INTLTOOL_PERL@ -w ++#!@INTLTOOL_PERL@ + # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + + # +Index: intltool-0.40.0/intltool-prepare.in +=================================================================== +--- intltool-0.40.0.orig/intltool-prepare.in 2008-12-17 11:50:19.000000000 +0000 ++++ intltool-0.40.0/intltool-prepare.in 2008-12-17 11:50:42.000000000 +0000 +@@ -1,4 +1,4 @@ +-#!@INTLTOOL_PERL@ -w ++#!@INTLTOOL_PERL@ + # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + + # Intltool .desktop, .directory Prepare Tool +Index: intltool-0.40.0/intltool-unicodify.in +=================================================================== +--- intltool-0.40.0.orig/intltool-unicodify.in 2008-12-17 11:50:19.000000000 +0000 ++++ intltool-0.40.0/intltool-unicodify.in 2008-12-17 11:50:46.000000000 +0000 +@@ -1,4 +1,4 @@ +-#!@INTLTOOL_PERL@ -w ++#!@INTLTOOL_PERL@ + + # + # The i18n Unicode Encoding Utility +Index: intltool-0.40.0/intltool-update.in +=================================================================== +--- intltool-0.40.0.orig/intltool-update.in 2008-12-17 11:50:19.000000000 +0000 ++++ intltool-0.40.0/intltool-update.in 2008-12-17 11:50:49.000000000 +0000 +@@ -1,4 +1,4 @@ +-#!@INTLTOOL_PERL@ -w ++#!@INTLTOOL_PERL@ + # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + + # diff --git a/meta/recipes-devtools/intltool/intltool.inc b/meta/recipes-devtools/intltool/intltool.inc new file mode 100644 index 0000000000..f9bdf93b7b --- /dev/null +++ b/meta/recipes-devtools/intltool/intltool.inc @@ -0,0 +1,17 @@ +DESCRIPTION = "Utility scripts for internationalizing XML" +PRIORITY = "optional" +SECTION = "devel" +LICENSE = "GPL" + +URLV="${@'.'.join(bb.data.getVar('PV',d,1).split('.')[0:2])}" +SRC_URI = "${GNOME_MIRROR}/intltool/${URLV}/intltool-${PV}.tar.bz2" +S = "${WORKDIR}/intltool-${PV}" + +DEPENDS = "libxml-parser-perl-native" +#RDEPENDS = "libxml-parser-perl" +RRECOMMENDS = "perl-modules" + +inherit autotools pkgconfig + +export PERL_virtclass-native = "/usr/bin/env perl" +BBCLASSEXTEND = "native" diff --git a/meta/recipes-devtools/intltool/intltool_0.40.6.bb b/meta/recipes-devtools/intltool/intltool_0.40.6.bb new file mode 100644 index 0000000000..1f23a41f89 --- /dev/null +++ b/meta/recipes-devtools/intltool/intltool_0.40.6.bb @@ -0,0 +1,5 @@ +require intltool.inc + +PR = "r0" + +SRC_URI_append = " file://intltool-nowarn-0.40.0.patch" diff --git a/meta/recipes-devtools/mpfr/mpfr.inc b/meta/recipes-devtools/mpfr/mpfr.inc deleted file mode 100644 index dbb859fe3e..0000000000 --- a/meta/recipes-devtools/mpfr/mpfr.inc +++ /dev/null @@ -1,6 +0,0 @@ -DESCRIPTION = "A C library for multiple-precision floating-point computations with exact rounding" -HOMEPAGE = "http://www.mpfr.org/" -LICENSE = "LGPLv3+" -SECTION = "devel" - -inherit autotools diff --git a/meta/recipes-devtools/mpfr/mpfr_3.0.0.bb b/meta/recipes-devtools/mpfr/mpfr_3.0.0.bb deleted file mode 100644 index 188a5d95cd..0000000000 --- a/meta/recipes-devtools/mpfr/mpfr_3.0.0.bb +++ /dev/null @@ -1,9 +0,0 @@ -require mpfr.inc - -DEPENDS = "gmp" -PR = "r0" - -SRC_URI = "http://www.mpfr.org/mpfr-${PV}/mpfr-${PV}.tar.bz2" -S = "${WORKDIR}/mpfr-${PV}" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/nasm/nasm_2.07.bb b/meta/recipes-devtools/nasm/nasm_2.07.bb new file mode 100644 index 0000000000..4e482a04d6 --- /dev/null +++ b/meta/recipes-devtools/nasm/nasm_2.07.bb @@ -0,0 +1,24 @@ +DESCRIPTION = "General-purpose x86 assembler" +SECTION = "devel" +LICENSE = "simplifiedBSD" +LIC_CHKSUM_FILES = "file://LICENSE;md5=d89d124974e487e5d64da6f1cd8acfbb" +COMPATIBLE_HOST = '(x86_64|i.86.*)-(linux|freebsd.*)' + +PR = "r0" + +SRC_URI = "${SOURCEFORGE_MIRROR}/nasm/nasm-${PV}.tar.bz2 " + +inherit autotools + +do_configure_prepend () { + mv aclocal.m4 acinclude.m4 +} + +do_install() { + install -d ${D}${bindir} + install -d ${D}${mandir}/man1 + + oe_runmake 'INSTALLROOT=${D}' install +} + +BBCLASSEXTEND = "native" diff --git a/meta/recipes-devtools/rsync/rsync-2.6.9/rsyncd.conf b/meta/recipes-devtools/rsync/rsync-2.6.9/rsyncd.conf new file mode 100644 index 0000000000..845f5b33f5 --- /dev/null +++ b/meta/recipes-devtools/rsync/rsync-2.6.9/rsyncd.conf @@ -0,0 +1,15 @@ +# /etc/rsyncd.conf + +# Minimal configuration file for rsync daemon +# See rsync(1) and rsyncd.conf(5) man pages for help + +# This file is required by rsync --daemon +pid file = /var/run/rsyncd.pid +use chroot = yes +read only = yes + +# Simple example for enabling your own local rsync server +#[everything] +# path = / +# comment = Everything except /etc exposed +# exclude = /etc diff --git a/meta/recipes-devtools/strace/strace_4.5.20.bb b/meta/recipes-devtools/strace/strace_4.5.20.bb new file mode 100644 index 0000000000..cc2ae1a964 --- /dev/null +++ b/meta/recipes-devtools/strace/strace_4.5.20.bb @@ -0,0 +1,11 @@ +DESCRIPTION = "strace is a system call tracing tool." +HOMEPAGE = "http://sourceforge.net/projects/strace/" +SECTION = "console/utils" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4535377ede62550fdeaf39f595fd550a" +PR = "r0" + +SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2" +inherit autotools + +export INCLUDES = "-I. -I./linux" diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent/fix_tcf-agent.init.patch b/meta/recipes-devtools/tcf-agent/tcf-agent/fix_tcf-agent.init.patch new file mode 100644 index 0000000000..fa9e458714 --- /dev/null +++ b/meta/recipes-devtools/tcf-agent/tcf-agent/fix_tcf-agent.init.patch @@ -0,0 +1,92 @@ +--- a/Makefile ++++ b/Makefile +@@ -32,7 +32,7 @@ + install -d -m 755 $(INSTALLROOT)$(SBIN) + install -d -m 755 $(INSTALLROOT)$(INIT) + install -c $(BINDIR)/agent -m 755 $(INSTALLROOT)$(SBIN)/tcf-agent +- install -c $(TCF_AGENT_DIR)/main/tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent ++ install -c tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent + + clean: + rm -rf $(BINDIR) +--- /dev/null ++++ b/tcf-agent.init +@@ -0,0 +1,78 @@ ++#!/bin/sh ++### BEGIN INIT INFO ++# Provides: tcf-agent ++# Default-Start: 3 5 ++# Default-Stop: 0 1 2 6 ++# Short-Description: Target Communication Framework agent ++### END INIT INFO ++ ++DAEMON_PATH=/usr/sbin/tcf-agent ++DAEMON_NAME=`basename $DAEMON_PATH` ++ ++. /etc/init.d/functions ++ ++test -x $DAEMON_PATH || exit 0 ++ ++PATH=/sbin:/usr/sbin:/bin:/usr/bin ++export PATH ++ ++RETVAL=0 ++ ++case "$1" in ++ start) ++ echo -n "Starting $DAEMON_NAME: " ++ $DAEMON_PATH -d -L- -l0 ++ RETVAL=$? ++ if [ $RETVAL -eq 0 ] ; then ++ echo "OK" ++ touch /var/lock/subsys/$DAEMON_NAME ++ else ++ echo "FAIL" ++ fi ++ ;; ++ ++ stop) ++ echo -n "Stopping $DAEMON_NAME: " ++ count=0 ++ while [ -n "`/bin/pidof $DAEMON_PATH`" -a $count -lt 10 ] ; do ++ killproc $DAEMON_PATH >& /dev/null ++ sleep 1 ++ RETVAL=$? ++ if [ $RETVAL != 0 -o -n "`/bin/pidof $DAEMON_PATH`" ] ; then ++ sleep 3 ++ fi ++ count=`expr $count + 1` ++ done ++ rm -f /var/lock/subsys/$DAEMON_NAME ++ if [ -n "`/bin/pidof $DAEMON_PATH`" ] ; then ++ echo "FAIL" ++ else ++ echo "OK" ++ fi ++ ;; ++ ++ restart) ++ $0 stop ++ sleep 1 ++ $0 start ++ ;; ++ ++ status) ++ if [ -n "`/bin/pidof $DAEMON_PATH`" ] ; then ++ echo "$DAEMON_NAME is running" ++ else ++ echo "$DAEMON_NAME is not running" ++ fi ++ ;; ++ ++ condrestart) ++ [ -f /var/lock/subsys/$DAEMON_NAME ] && $0 restart ++ ;; ++ ++ *) ++ echo "usage: $0 { start | stop | restart | condrestart | status }" ++ ;; ++esac ++ ++exit $RETVAL ++ diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent/terminals_agent.patch b/meta/recipes-devtools/tcf-agent/tcf-agent/terminals_agent.patch new file mode 100644 index 0000000000..b88b5e70cd --- /dev/null +++ b/meta/recipes-devtools/tcf-agent/tcf-agent/terminals_agent.patch @@ -0,0 +1,1025 @@ +Index: org.eclipse.tm.tcf.terminals.agent/terminals.c +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0) +@@ -0,0 +1,846 @@ ++/******************************************************************************* ++ * Copyright (c) 2008 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ *******************************************************************************/ ++ ++/* ++ * Sample TCF service implementation. ++ */ ++ ++#include <config.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include <string.h> ++#include <errno.h> ++#include <fcntl.h> ++#include <signal.h> ++#include <assert.h> ++#include <termios.h> ++#ifndef TIOCGWINSZ ++#include <sys/ioctl.h> ++#endif ++#include <framework/myalloc.h> ++#include <framework/protocol.h> ++#include <framework/trace.h> ++#include <framework/context.h> ++#include <framework/json.h> ++#include <framework/asyncreq.h> ++#include <framework/exceptions.h> ++#include <framework/waitpid.h> ++#include <framework/signames.h> ++#include <services/streamsservice.h> ++#include <terminals.h> ++ ++#define TERMINALS_DEBUG 1 ++ ++#define TERMINALS_NO_LOGIN 0 ++ ++static const char * TERMINALS = "Terminals"; ++ ++#if defined(WIN32) ++# include <tlhelp32.h> ++# ifdef _MSC_VER ++# pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union (in winternl.h) */ ++# include <winternl.h> ++# else ++# include <ntdef.h> ++# endif ++# ifndef STATUS_INFO_LENGTH_MISMATCH ++# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) ++# endif ++# ifndef SystemHandleInformation ++# define SystemHandleInformation 16 ++# endif ++# error("unsupported WIN32!") ++#elif defined(_WRS_KERNEL) ++# include <symLib.h> ++# include <sysSymTbl.h> ++# include <ioLib.h> ++# include <ptyDrv.h> ++# include <taskHookLib.h> ++# error("unsupported WRS!") ++#else ++# include <sys/stat.h> ++# include <unistd.h> ++# include <dirent.h> ++# if TERMINALS_NO_LOGIN ++# define TERM_LAUNCH_EXEC "/bin/bash" ++# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, NULL} ++# else ++# define TERM_LAUNCH_EXEC "/bin/login" ++# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, "-p", NULL} ++# endif ++#endif ++ ++#define PIPE_SIZE 0x1000 ++#define TERM_PROP_DEF_SIZE 256 ++ ++typedef struct Terminal ++{ ++ LINK link; ++ int pid; /*pid of the login process of the terminal*/ ++ TCFBroadcastGroup * bcg; ++ int inp; ++ int out; ++ int err; ++ struct TerminalInput * inp_struct; ++ struct TerminalOutput * out_struct; ++ struct TerminalOutput * err_struct; ++ char inp_id[256]; ++ char out_id[256]; ++ char err_id[256]; ++ ++ char pty_type[TERM_PROP_DEF_SIZE]; ++ char encoding[TERM_PROP_DEF_SIZE]; ++ unsigned long width; ++ unsigned long height; ++ long exit_code; ++ ++ Channel *channel; ++} Terminal; ++ ++typedef struct TerminalOutput ++{ ++ Terminal * prs; ++ AsyncReqInfo req; ++ int req_posted; ++ char buf[PIPE_SIZE]; ++ size_t buf_pos; ++ int eos; ++ VirtualStream * vstream; ++} TerminalOutput; ++ ++typedef struct TerminalInput ++{ ++ Terminal * prs; ++ AsyncReqInfo req; ++ int req_posted; ++ char buf[PIPE_SIZE]; ++ size_t buf_pos; ++ size_t buf_len; ++ int eos; ++ VirtualStream * vstream; ++} TerminalInput; ++ ++#define link2term(A) ((Terminal *)((char *)(A) - offsetof(Terminal, link))) ++ ++static LINK terms_list; ++#if defined(_WRS_KERNEL) ++static SEM_ID prs_list_lock = NULL; ++#endif ++ ++static Terminal * find_terminal(int pid) ++{ ++ LINK * qhp = &terms_list; ++ LINK * qp = qhp->next; ++ ++ while (qp != qhp) { ++ Terminal * prs = link2term(qp); ++ if (prs->pid == pid) ++ return prs; ++ qp = qp->next; ++ } ++ return NULL; ++} ++ ++static char * tid2id(int tid) ++{ ++ static char s[64]; ++ char * p = s + sizeof(s); ++ unsigned long n = (long) tid; ++ *(--p) = 0; ++ do { ++ *(--p) = (char) (n % 10 + '0'); ++ n = n / 10; ++ } while (n != 0); ++ ++ *(--p) = 'T'; ++ return p; ++} ++ ++static int id2tid(const char * id) ++{ ++ int tid = 0; ++ if (id == NULL) ++ return 0; ++ if (id[0] != 'T') ++ return 0; ++ if (id[1] == 0) ++ return 0; ++ tid = (unsigned) strtol(id + 1, (char **) &id, 10); ++ if (id[0] != 0) ++ return 0; ++ return tid; ++} ++ ++static void write_context(OutputStream * out, int tid) ++{ ++ Terminal * prs = find_terminal(tid); ++ ++ write_stream(out, '{'); ++ ++ if (prs != NULL) { ++ if (*prs->pty_type) { ++ json_write_string(out, "PtyType"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->pty_type); ++ write_stream(out, ','); ++ } ++ ++ if (*prs->encoding) { ++ json_write_string(out, "Encoding"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->encoding); ++ write_stream(out, ','); ++ } ++ ++ json_write_string(out, "Width"); ++ write_stream(out, ':'); ++ json_write_ulong(out, prs->width); ++ write_stream(out, ','); ++ ++ json_write_string(out, "Height"); ++ write_stream(out, ':'); ++ json_write_ulong(out, prs->height); ++ write_stream(out, ','); ++ ++ if (*prs->inp_id) { ++ json_write_string(out, "StdInID"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->inp_id); ++ write_stream(out, ','); ++ } ++ if (*prs->out_id) { ++ json_write_string(out, "StdOutID"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->out_id); ++ write_stream(out, ','); ++ } ++ if (*prs->err_id) { ++ json_write_string(out, "StdErrID"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->err_id); ++ write_stream(out, ','); ++ } ++ } ++ ++ json_write_string(out, "ID"); ++ write_stream(out, ':'); ++ json_write_string(out, tid2id(tid)); ++ ++ write_stream(out, '}'); ++} ++ ++static void send_event_terminal_exited(OutputStream * out, Terminal * prs) ++{ ++ write_stringz(out, "E"); ++ write_stringz(out, TERMINALS); ++ write_stringz(out, "exited"); ++ ++ json_write_string(out, tid2id(prs->pid)); ++ write_stream(out, 0); ++ ++ json_write_ulong(out, prs->exit_code); ++ write_stream(out, 0); ++ ++ write_stream(out, MARKER_EOM); ++} ++ ++static void send_event_terminal_win_size_changed(OutputStream * out, ++ Terminal * prs) ++{ ++ write_stringz(out, "E"); ++ write_stringz(out, TERMINALS); ++ write_stringz(out, "winSizeChanged"); ++ ++ json_write_string(out, tid2id(prs->pid)); ++ write_stream(out, 0); ++ ++ json_write_long(out, prs->width); ++ write_stream(out, 0); ++ ++ json_write_long(out, prs->height); ++ write_stream(out, 0); ++ ++ write_stream(out, MARKER_EOM); ++} ++ ++static int kill_term(Terminal *term) ++{ ++ int err = 0; ++ ++#if defined(WIN32) ++ HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, term->pid); ++ if (h == NULL) ++ { ++ err = set_win32_errno(GetLastError()); ++ } ++ else ++ { ++ if (!TerminateProcess(h, 1)) err = set_win32_errno(GetLastError()); ++ if (!CloseHandle(h) && !err) err = set_win32_errno(GetLastError()); ++ } ++#else ++ if (kill(term->pid, SIGTERM) < 0) ++ err = errno; ++#endif ++ return err; ++} ++ ++static void command_exit(char * token, Channel * c) ++{ ++ int err = 0; ++ char id[256]; ++ unsigned tid; ++ Terminal *term = NULL; ++ ++ json_read_string(&c->inp, id, sizeof(id)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ tid = id2tid(id); ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ ++ if (tid == 0) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ term = find_terminal(tid); ++ if (term == NULL) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ err = kill_term(term); ++ } ++ } ++ ++ write_errno(&c->out, err); ++ write_stream(&c->out, MARKER_EOM); ++} ++ ++static void terminal_exited(Terminal * prs) ++{ ++ Trap trap; ++ ++ if (set_trap(&trap)) { ++ send_event_terminal_exited(&prs->bcg->out, prs); ++ clear_trap(&trap); ++ } else { ++ trace(LOG_ALWAYS, "Exception sending terminal exited event: %d %s", ++ trap.error, errno_to_str(trap.error)); ++ } ++ ++#if defined(_WRS_KERNEL) ++ semTake(prs_list_lock, WAIT_FOREVER); ++#endif ++ list_remove(&prs->link); ++ close(prs->inp); ++ close(prs->out); ++ if (prs->out != prs->err) ++ close(prs->err); ++ if (prs->inp_struct) { ++ TerminalInput * inp = prs->inp_struct; ++ if (!inp->req_posted) { ++ virtual_stream_delete(inp->vstream); ++ loc_free(inp); ++ } else { ++ inp->prs = NULL; ++ } ++ } ++ if (prs->out_struct) ++ prs->out_struct->prs = NULL; ++ if (prs->err_struct) ++ prs->err_struct->prs = NULL; ++ loc_free(prs); ++#if defined(_WRS_KERNEL) ++ semGive(prs_list_lock); ++#endif ++} ++ ++static void terminal_input_streams_callback(VirtualStream * stream, ++ int event_code, void * args) ++{ ++ TerminalInput * inp = (TerminalInput *) args; ++ ++ assert(inp->vstream == stream); ++ if (!inp->req_posted) { ++ if (inp->buf_pos >= inp->buf_len && !inp->eos) { ++ inp->buf_pos = inp->buf_len = 0; ++ virtual_stream_get_data(stream, inp->buf, sizeof(inp->buf), ++ &inp->buf_len, &inp->eos); ++ } ++ if (inp->buf_pos < inp->buf_len) { ++ inp->req.u.fio.bufp = inp->buf + inp->buf_pos; ++ inp->req.u.fio.bufsz = inp->buf_len - inp->buf_pos; ++ inp->req_posted = 1; ++ async_req_post(&inp->req); ++ } ++ } ++} ++ ++static void write_terminal_input_done(void * x) ++{ ++ AsyncReqInfo * req = (AsyncReqInfo *) x; ++ TerminalInput * inp = (TerminalInput *) req->client_data; ++ ++ inp->req_posted = 0; ++ if (inp->prs == NULL) { ++ /* Process has exited */ ++ virtual_stream_delete(inp->vstream); ++ loc_free(inp); ++ } else { ++ int wr = inp->req.u.fio.rval; ++ ++ if (wr < 0) { ++ int err = inp->req.error; ++ trace(LOG_ALWAYS, "Can't write terminal input stream: %d %s", err, ++ errno_to_str(err)); ++ inp->buf_pos = inp->buf_len = 0; ++ } else { ++ inp->buf_pos += wr; ++ } ++ ++ terminal_input_streams_callback(inp->vstream, 0, inp); ++ } ++} ++ ++static void write_terminal_input(Terminal * prs) ++{ ++ TerminalInput * inp = prs->inp_struct = (TerminalInput *) loc_alloc_zero( ++ sizeof(TerminalInput)); ++ inp->prs = prs; ++ inp->req.client_data = inp; ++ inp->req.done = write_terminal_input_done; ++ inp->req.type = AsyncReqWrite; ++ inp->req.u.fio.fd = prs->inp; ++ virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE, ++ VS_ENABLE_REMOTE_WRITE, terminal_input_streams_callback, inp, ++ &inp->vstream); ++ virtual_stream_get_id(inp->vstream, prs->inp_id, sizeof(prs->inp_id)); ++} ++ ++static void terminal_output_streams_callback(VirtualStream * stream, ++ int event_code, void * args) ++{ ++ TerminalOutput * out = (TerminalOutput *) args; ++ ++ assert(out->vstream == stream); ++ if (!out->req_posted) { ++ int buf_len = out->req.u.fio.rval; ++ int err = 0; ++ int eos = 0; ++ ++ if (buf_len < 0) { ++ buf_len = 0; ++ err = out->req.error; ++ } ++ if (buf_len == 0) ++ eos = 1; ++ if (out->prs == NULL) { ++ eos = 1; ++ err = 0; ++ } ++ ++ assert(buf_len <= (int)sizeof(out->buf)); ++ assert(out->buf_pos <= (size_t)buf_len); ++ assert(out->req.u.fio.bufp == out->buf); ++#ifdef __linux__ ++ if (err == EIO) ++ err = 0; ++#endif ++ if (err) ++ trace(LOG_ALWAYS, "Can't read terminal output stream: %d %s", err, ++ errno_to_str(err)); ++ ++ if (out->buf_pos < (size_t) buf_len || out->eos != eos) { ++ size_t done = 0; ++ virtual_stream_add_data(stream, out->buf + out->buf_pos, buf_len ++ - out->buf_pos, &done, eos); ++ out->buf_pos += done; ++ if (eos) ++ out->eos = 1; ++ } ++ ++ if (out->buf_pos >= (size_t) buf_len) { ++ if (!eos) { ++ out->req_posted = 1; ++ async_req_post(&out->req); ++ } else if (virtual_stream_is_empty(stream)) { ++ if (out->prs != NULL) { ++ if (out == out->prs->out_struct) ++ out->prs->out_struct = NULL; ++ if (out == out->prs->err_struct) ++ out->prs->err_struct = NULL; ++ } ++ virtual_stream_delete(stream); ++ loc_free(out); ++ } ++ } ++ } // end if(!out->req_posted) ++} ++ ++static void read_terminal_output_done(void * x) ++{ ++ AsyncReqInfo * req = (AsyncReqInfo *) x; ++ TerminalOutput * out = (TerminalOutput *) req->client_data; ++ ++ out->buf_pos = 0; ++ out->req_posted = 0; ++ terminal_output_streams_callback(out->vstream, 0, out); ++} ++ ++static TerminalOutput * read_terminal_output(Terminal * prs, int fd, char * id, ++ size_t id_size) ++{ ++ TerminalOutput * out = (TerminalOutput *) loc_alloc_zero( ++ sizeof(TerminalOutput)); ++ out->prs = prs; ++ out->req.client_data = out; ++ out->req.done = read_terminal_output_done; ++ out->req.type = AsyncReqRead; ++ out->req.u.fio.bufp = out->buf; ++ out->req.u.fio.bufsz = sizeof(out->buf); ++ out->req.u.fio.fd = fd; ++ virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE, ++ VS_ENABLE_REMOTE_READ, terminal_output_streams_callback, out, ++ &out->vstream); ++ virtual_stream_get_id(out->vstream, id, id_size); ++ out->req_posted = 1; ++ async_req_post(&out->req); ++ return out; ++} ++ ++static char **envp_add(char **old_envp, int old_envp_len, char *env) ++{ ++ char **new_envp = NULL; ++ int i; ++ int env_size; ++ int old_envp_size; ++ ++ assert(old_envp || (old_envp==NULL && old_envp_len==0)); ++ assert(env); ++ assert(*env); ++ ++ for (i = 0, old_envp_size = 0; i < old_envp_len; i++) { ++ old_envp_size += sizeof(char *); //size of env pointer ++ old_envp_size += strlen(old_envp[i]) + 1; //size of env string, including trailing '\0' ++ } ++ assert((old_envp && old_envp[i]==NULL) || (old_envp==NULL)); ++ old_envp_size += sizeof(char *);//last null pointer ++ ++ env_size = strlen(env); //new env string size ++ ++ new_envp = loc_alloc(old_envp_size + sizeof(char *) + env_size + 1); ++ if (new_envp != NULL) { ++ new_envp[0] = (char *) new_envp + old_envp_size + sizeof(char *); //setting new env ptr ++ strcpy(new_envp[0], env); //copy new env string ++ if (old_envp) { ++ memcpy(&new_envp[1], old_envp, old_envp_size); //copy old envp ++ } else { ++ new_envp[1] = NULL; ++ } ++ } ++ return new_envp; ++} ++ ++static int start_terminal(Channel * c, char *pty_type, char *encoding, ++ char ** envp, int envp_len, char * exe, char ** args, int *pid, ++ Terminal ** prs) ++{ ++ int err = 0; ++ int fd_tty_master = -1; ++ char * tty_slave_name = NULL; ++ struct winsize size; ++ char **newenvp = envp; ++ ++ memset(&size, 0, sizeof(struct winsize)); ++ fd_tty_master = posix_openpt(O_RDWR | O_NOCTTY); ++ if (fd_tty_master < 0 || grantpt(fd_tty_master) < 0 || unlockpt( ++ fd_tty_master) < 0) ++ err = errno; ++ if (!err) { ++ tty_slave_name = ptsname(fd_tty_master); ++ if (tty_slave_name == NULL) ++ err = EINVAL; ++ } ++ ++ if (ioctl(fd_tty_master, TIOCGWINSZ, (char *) &size) < 0) ++ err = errno; ++ ++ if (!err && fd_tty_master < 3) { ++ int fd0 = fd_tty_master; ++ if ((fd_tty_master = dup(fd_tty_master)) < 0 || close(fd0)) ++ err = errno; ++ } ++ ++ if (!err) { ++ *pid = fork(); ++ if (*pid < 0) ++ err = errno; ++ if (*pid == 0) { ++ int fd = -1; ++ int fd_tty_slave = -1; ++ ++ if (*pty_type) { ++ char env_term[TERM_PROP_DEF_SIZE]; ++ snprintf(env_term, sizeof(env_term), "TERM=%s", pty_type); ++ newenvp = envp_add(envp, envp_len, env_term); ++ if (newenvp == NULL) { ++ err = ENOMEM; ++ } else if (envp) { ++ loc_free(envp); ++ envp = NULL; ++ } ++ } ++ ++ setsid(); ++ ++ if (!err && (fd = sysconf(_SC_OPEN_MAX)) < 0) ++ err = errno; ++ if (!err && (fd_tty_slave = open(tty_slave_name, O_RDWR)) < 0) ++ err = errno; ++#if defined(TIOCSCTTY) ++ if (!err && (ioctl(fd_tty_slave, TIOCSCTTY, (char *) 0)) < 0) ++ err = errno; ++#endif ++ if (!err && dup2(fd_tty_slave, 0) < 0) ++ err = errno; ++ if (!err && dup2(fd_tty_slave, 1) < 0) ++ err = errno; ++ if (!err && dup2(fd_tty_slave, 2) < 0) ++ err = errno; ++ while (!err && fd > 3) ++ close(--fd); ++ if (!err) { ++ execve(exe, args, newenvp); ++ err = errno; ++ } ++ if (newenvp) ++ loc_free(newenvp); ++ err = 1; ++ if (err < 1) ++ err = EINVAL; ++ else if (err > 0xff) ++ err = EINVAL; ++ exit(err); ++ } ++ } ++ ++ if (!err) { ++ *prs = (Terminal *) loc_alloc_zero(sizeof(Terminal)); ++ (*prs)->inp = fd_tty_master; ++ (*prs)->out = fd_tty_master; ++ (*prs)->err = fd_tty_master; ++ (*prs)->pid = *pid; ++ (*prs)->bcg = c->bcg; ++ (*prs)->channel = c; ++ if (*pty_type) ++ snprintf((*prs)->pty_type, sizeof((*prs)->pty_type), "%s", pty_type); ++ if (*encoding) ++ snprintf((*prs)->encoding, sizeof((*prs)->encoding), "%s", encoding); ++ (*prs)->width = size.ws_row; ++ (*prs)->height = size.ws_col; ++ list_add_first(&(*prs)->link, &terms_list); ++ } ++ ++ if (!err) ++ return 0; ++ errno = err; ++ return -1; ++} ++ ++static void command_get_context(char * token, Channel * c) ++{ ++ int err = 0; ++ char id[256]; ++ int tid; ++ Terminal *term; ++ ++ json_read_string(&c->inp, id, sizeof(id)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ tid = id2tid(id); ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ ++ if (tid == 0) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ term = find_terminal(tid); ++ if (term == NULL) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ write_context(&c->out, tid); ++ write_stream(&c->out, 0); ++ } ++ } ++ ++ write_errno(&c->out, err); ++ write_stream(&c->out, MARKER_EOM); ++} ++ ++static void command_launch(char * token, Channel * c) ++{ ++ int pid = 0; ++ int err = 0; ++ char encoding[TERM_PROP_DEF_SIZE]; ++ char pty_type[TERM_PROP_DEF_SIZE]; ++ char *args[] = TERM_LAUNCH_ARGS; ++ ++ char ** envp = NULL; ++ int envp_len = 0; ++ ++ Terminal * prs = NULL; ++ Trap trap; ++ ++ if (set_trap(&trap)) { ++ json_read_string(&c->inp, pty_type, sizeof(pty_type)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ json_read_string(&c->inp, encoding, sizeof(encoding)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ envp = json_read_alloc_string_array(&c->inp, &envp_len); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ if (err == 0 && start_terminal(c, pty_type, encoding, envp, envp_len, ++ TERM_LAUNCH_EXEC, args, &pid, &prs) < 0) ++ err = errno; ++ if (prs != NULL) { ++ write_terminal_input(prs); ++ prs->out_struct = read_terminal_output(prs, prs->out, prs->out_id, ++ sizeof(prs->out_id)); ++ if (prs->out != prs->err) ++ prs->err_struct = read_terminal_output(prs, prs->err, ++ prs->err_id, sizeof(prs->err_id)); ++ } ++ if (!err) { ++ add_waitpid_process(pid); ++ } ++ //write result back ++ { ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ write_errno(&c->out, err); ++ if (err || pid == 0) { ++ write_stringz(&c->out, "null"); ++ } else { ++ write_context(&c->out, pid); ++ write_stream(&c->out, 0); ++ } ++ write_stream(&c->out, MARKER_EOM); ++ } ++ clear_trap(&trap); ++ } ++ ++ loc_free(envp); ++ ++ if (trap.error) ++ exception(trap.error); ++} ++ ++static void command_set_win_size(char * token, Channel * c) ++{ ++ int err = 0; ++ struct winsize size; ++ char id[256]; ++ unsigned tid; ++ Terminal *term = NULL; ++ ++ json_read_string(&c->inp, id, sizeof(id)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ size.ws_col=json_read_ulong(&c->inp); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ size.ws_row=json_read_ulong(&c->inp); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ tid = id2tid(id); ++ ++ if(tid==0 || (term=find_terminal(tid))==NULL) { ++ err=ERR_INV_CONTEXT; ++ }else if (term->width != size.ws_col || term->height != size.ws_row) { ++ if(ioctl(term->inp,TIOCSWINSZ,&size)<0) { ++ err=errno; ++ } ++ if(!err) { ++ term->width=size.ws_col; ++ term->height=size.ws_row; ++ send_event_terminal_win_size_changed(&term->channel->out,term); ++ } ++ } ++ ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ write_errno(&c->out, err); ++ write_stream(&c->out, MARKER_EOM); ++ ++} ++ ++static void waitpid_listener(int pid, int exited, int exit_code, int signal, ++ int event_code, int syscall, void * args) ++{ ++ if (exited) { ++ Terminal * prs = find_terminal(pid); ++ if (prs) { ++ if (signal != 0) ++ prs->exit_code = -signal; ++ else ++ prs->exit_code = exit_code; ++ terminal_exited(prs); ++ } ++ } ++} ++ ++static void channel_close_listener(Channel * c) ++{ ++ LINK * l = NULL; ++ ++ for (l = terms_list.next; l != &terms_list;) { ++ Terminal * term = link2term(l); ++ l = l->next; ++ if (term->channel == c) { ++ trace(LOG_ALWAYS, "Terminal is left launched: T%d", term->pid); ++ kill_term(term); ++ } ++ } ++} ++ ++void ini_terminals_service(Protocol * proto) ++{ ++#if defined(_WRS_KERNEL) ++ prs_list_lock = semMCreate(SEM_Q_PRIORITY); ++ if (prs_list_lock == NULL) check_error(errno); ++ if (taskCreateHookAdd((FUNCPTR)task_create_hook) != OK) check_error(errno); ++ if (taskDeleteHookAdd((FUNCPTR)task_delete_hook) != OK) check_error(errno); ++#endif ++ list_init(&terms_list); ++ ++ add_waitpid_listener(waitpid_listener, NULL); ++ add_channel_close_listener(channel_close_listener); ++ ++ add_command_handler(proto, TERMINALS, "getContext", command_get_context); ++ add_command_handler(proto, TERMINALS, "launch", command_launch); ++ add_command_handler(proto, TERMINALS, "exit", command_exit); ++ add_command_handler(proto, TERMINALS, "setWinSize", command_set_win_size); ++} +Index: org.eclipse.tm.tcf.terminals.agent/main/services-ext.h +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0) +@@ -0,0 +1,25 @@ ++/******************************************************************************* ++ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ *******************************************************************************/ ++ ++/* ++ * Services initialization code extension point. ++ * If the agent is built with additional user-defined services, ++ * a customized version of services-ext.h file can be added to compiler headers search paths. ++ */ ++ ++#include "terminals.h" ++ ++static void ini_ext_services(Protocol * proto, TCFBroadcastGroup * bcg) { ++ ini_terminals_service(proto); ++} +Index: org.eclipse.tm.tcf.terminals.agent/terminals.h +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0) +@@ -0,0 +1,27 @@ ++/******************************************************************************* ++ * Copyright (c) 2008 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ *******************************************************************************/ ++ ++/* ++ * Sample TCF service header file. ++ */ ++ ++#ifndef TERMINALS_H_ ++#define TERMINALS_H_ ++ ++#include <config.h> ++#include <framework/protocol.h> ++ ++extern void ini_terminals_service(Protocol * proto); ++ ++#endif /*TERMINALS_H_*/ +Index: org.eclipse.tm.tcf.terminals.agent/config.h +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/config.h (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/config.h (revision 0) +@@ -0,0 +1,63 @@ ++/******************************************************************************* ++ * Copyright (c) 2008 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ *******************************************************************************/ ++ ++/* ++ * This file contains "define" statements that control agent configuration. ++ * SERVICE_* definitions control which service implementations are included into the agent. ++ * ++ * This is example agent configuration. It includes only few standard services, ++ * and one example service: Day Time. ++ */ ++ ++#ifndef D_config ++#define D_config ++ ++#include <framework/mdep.h> ++ ++#if defined(WIN32) || defined(__CYGWIN__) ++# define TARGET_UNIX 0 ++#elif defined(_WRS_KERNEL) ++# define TARGET_UNIX 0 ++#else ++# define TARGET_UNIX 1 ++#endif ++ ++#define SERVICE_Locator 1 ++#define SERVICE_Processes 1 ++#define SERVICE_Streams 1 ++#define SERVICE_FileSystem 1 ++#define SERVICE_SysMonitor TARGET_UNIX ++ ++#define ENABLE_ZeroCopy 1 ++ ++#if !defined(ENABLE_Splice) ++# if ENABLE_ZeroCopy ++# include <fcntl.h> ++# if defined(SPLICE_F_MOVE) ++# define ENABLE_Splice 1 ++# else ++# define ENABLE_Splice 0 ++# endif ++# else ++# define ENABLE_Splice 0 ++# endif ++#endif ++ ++#define ENABLE_SSL 0 ++ ++#define ENABLE_Trace 1 ++#define ENABLE_Discovery 1 ++ ++ ++#endif /* D_config */ +Index: org.eclipse.tm.tcf.terminals.agent/Makefile +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0) +@@ -0,0 +1,39 @@ ++TCF_AGENT_DIR=../agent ++ ++include $(TCF_AGENT_DIR)/Makefile.inc ++ ++override CFLAGS += $(foreach dir,$(INCDIRS),-I$(dir)) $(OPTS) ++ ++HFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.h)) $(HFILES) ++CFILES := $(sort $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)) $(CFILES)) ++ ++#no using SSL ++LIBS = -lpthread -lrt ++ ++EXECS = $(BINDIR)/agent$(EXTEXE) ++ ++all: $(EXECS) ++ ++$(BINDIR)/libtcf$(EXTLIB) : $(OFILES) ++ $(AR) rcs $@ $^ ++ ++$(BINDIR)/agent$(EXTEXE): $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) ++ $(CC) $(CFLAGS) -o $@ $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) $(LIBS) ++ ++$(BINDIR)/%$(EXTOBJ): %.c $(HFILES) Makefile ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -c -o $@ $< ++ ++$(BINDIR)/%$(EXTOBJ): $(TCF_AGENT_DIR)/%.c $(HFILES) Makefile ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -c -o $@ $< ++ ++install: all ++ install -d -m 755 $(INSTALLROOT)$(SBIN) ++ install -d -m 755 $(INSTALLROOT)$(INIT) ++ install -c $(BINDIR)/agent -m 755 $(INSTALLROOT)$(SBIN)/tcf-agent ++ install -c $(TCF_AGENT_DIR)/main/tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent ++ ++clean: ++ rm -rf $(BINDIR) ++ diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_svn.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_svn.bb new file mode 100644 index 0000000000..b4c70ec8b8 --- /dev/null +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_svn.bb @@ -0,0 +1,36 @@ +DESCRIPTION = "Target Communication Framework" +HOMEPAGE = "http://dsdp.eclipse.org/dsdp/tm/" +BUGTRACKER = "https://bugs.eclipse.org/bugs/" + +LICENSE = "EPLv1.0 | EDLv1.0" +LIC_FILES_CHKSUM = "file://../epl-v10.html;md5=7aa4215a330a0a4f6a1cbf8da1a0879f \ + file://../agent/edl-v10.html;md5=522a390a83dc186513f0500543ad3679" + +PV = "0.3.0+svnr${SRCREV}" +PR = "r0" + +SRC_URI = "svn://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/;module=tags/0.3.0/;proto=http \ + file://terminals_agent.patch \ + file://fix_tcf-agent.init.patch" + +S = "${WORKDIR}/tags/0.3.0/tcf-agent" + +inherit update-rc.d + +INITSCRIPT_NAME = "tcf-agent" +INITSCRIPT_PARAMS = "start 999 3 5 . stop 20 0 1 2 6 ." + +# mangling needed for make +MAKE_ARCH = `echo ${TARGET_ARCH} | sed s,i.86,i686,` +MAKE_OS = `echo ${TARGET_OS} | sed s,linux,GNU/Linux,` + +EXTRA_OEMAKE = "MACHINE=${MAKE_ARCH} OPSYS=${MAKE_OS} 'CC=${CC}' 'AR=${AR}'" + +do_compile() { + oe_runmake +} + +do_install() { + oe_runmake install INSTALLROOT=${D} +} + diff --git a/meta/recipes-devtools/ubootchart/files/sysvinit.patch b/meta/recipes-devtools/ubootchart/files/sysvinit.patch new file mode 100644 index 0000000000..de9fb0b17d --- /dev/null +++ b/meta/recipes-devtools/ubootchart/files/sysvinit.patch @@ -0,0 +1,12 @@ +Index: ubootchart.conf +=================================================================== +--- ubootchart.conf (revision 9) ++++ ubootchart.conf (working copy) +@@ -1,6 +1,6 @@ + + # If you want to chain on and run somthing other than /sbin/init... +-export init_prog=/sbin/init ++export init_prog=/sbin/init.sysvinit + + # On startup ubootchart will mount a tmpfs filesystem at this + # location and chdir here. This is only used for the logging of diff --git a/meta/recipes-devtools/ubootchart/files/ubootchart-stop b/meta/recipes-devtools/ubootchart/files/ubootchart-stop new file mode 100644 index 0000000000..3444069c9a --- /dev/null +++ b/meta/recipes-devtools/ubootchart/files/ubootchart-stop @@ -0,0 +1,3 @@ +#! /bin/sh + +kill -USR1 $(pidof ubootchartd_bin) diff --git a/meta/recipes-devtools/ubootchart/files/ubootchart.desktop b/meta/recipes-devtools/ubootchart/files/ubootchart.desktop new file mode 100644 index 0000000000..5552b3bc6f --- /dev/null +++ b/meta/recipes-devtools/ubootchart/files/ubootchart.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Encoding=UTF-8 +Exec=/sbin/ubootchart-stop +Name=Stop Bootchart +Type=Application +Categories=Programming; diff --git a/meta/recipes-devtools/ubootchart/ubootchart_svn.bb b/meta/recipes-devtools/ubootchart/ubootchart_svn.bb new file mode 100644 index 0000000000..cd292b6943 --- /dev/null +++ b/meta/recipes-devtools/ubootchart/ubootchart_svn.bb @@ -0,0 +1,37 @@ +DESCRIPTION = "A boot profiling tool" +HOMEPAGE = "http://code.google.com/p/ubootchart/" +LICENSE = "GPLv3" +PV = "0.0+r${SRCREV}" +PR = "r4" + +#RRECOMMENDS = "acct" + +SRC_URI = "svn://ubootchart.googlecode.com/svn/;proto=http;module=trunk \ + file://sysvinit.patch;patch=1;pnum=0 \ + file://ubootchart-stop \ + file://ubootchart.desktop" + +S = "${WORKDIR}/trunk" + +inherit update-alternatives + +ALTERNATIVE_NAME = "init" +ALTERNATIVE_LINK = "${base_sbindir}/init" +ALTERNATIVE_PATH = "${base_sbindir}/ubootchartd" +ALTERNATIVE_PRIORITY = "70" + +do_compile() { + ${CC} ${CFLAGS} ${LDFLAGS} ${LIBS} ${INCLUDES} ${S}/ubootchartd_bin.c -o ubootchartd_bin +} + +do_install() { + install -m 0755 -d ${D}/sbin ${D}/etc/ubootchart ${D}/usr/share/applications + install -m 0755 ${S}/ubootchartd_bin ${D}/sbin + install -m 0755 ${S}/ubootchartd ${D}/sbin + install -m 0644 ${S}/ubootchart.conf ${D}/etc/ubootchart + install -m 0755 ${S}/start.sh ${D}/etc/ubootchart + install -m 0755 ${S}/finish.sh ${D}/etc/ubootchart + + install -m 0755 ${WORKDIR}/ubootchart-stop ${D}/sbin + install -m 0644 ${WORKDIR}/ubootchart.desktop ${D}/usr/share/applications +} diff --git a/meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch b/meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch new file mode 100644 index 0000000000..521f1ba9a0 --- /dev/null +++ b/meta/recipes-devtools/yaffs2/files/mkyaffs2image.patch @@ -0,0 +1,345 @@ + * + * mkyaffs2image hacks by NCB + * + * Changes by Sergey Kubushin flagged KSI + * + */ + +/* KSI: + * All this nightmare should be rewritten from ground up. Why save return + * values if nobody checks them? The read/write function returns only one + * error, -1. Positive return value does NOT mean read/write operation has + * been completed successfully. If somebody opens files, he MUST close them + * when they are not longer needed. Only those brave enough can write 64 + * bytes from a yaffs_PackedTags2 structure. The list is too long, there is + * enough bugs here to write a couple of thick books on how NOT to write + * programs... + * + * And BTW, what was one supposed to do with that file that this horror + * occasionally managed to generate? + */ +diff -urN yaffs2.orig/utils/mkyaffs2image.c yaffs2/utils/mkyaffs2image.c +--- yaffs2.orig/utils/mkyaffs2image.c 2005-12-12 16:34:58.000000000 -0800 ++++ yaffs2/utils/mkyaffs2image.c 2006-02-10 16:56:13.000000000 -0800 +@@ -31,10 +47,10 @@ + #include <dirent.h> + #include <string.h> + #include <unistd.h> ++#include <mtd/mtd-user.h> + #include "yaffs_ecc.h" + #include "yaffs_guts.h" + +-#include "yaffs_tagsvalidity.h" + #include "yaffs_packedtags2.h" + + unsigned yaffs_traceMask=0; +@@ -43,9 +59,45 @@ + + #define chunkSize 2048 + #define spareSize 64 ++#define PT2_BYTES 25 + + const char * mkyaffsimage_c_version = "$Id: mkyaffs2image.c,v 1.4 2007-02-14 01:09:06 wookey Exp $"; + ++static int layout_no; ++ ++static struct nand_oobinfo oob_layout[] = { ++ /* KSI: ++ * Dummy "raw" layout - no ECC, all the bytes are free. Does NOT ++ * really work, only used for compatibility with CVS YAFFS2 that ++ * never ever worked with any stock MTD. ++ */ ++ { ++ .useecc = MTD_NANDECC_AUTOPLACE, ++ .eccbytes = 0, ++ .eccpos = {}, ++ .oobfree = { {0, 64} } ++ }, ++ /* KSI: ++ * Regular MTD AUTOPLACED ECC for large page NAND devices, the ++ * only one existing in stock MTD so far. It corresponds to layout# 1 ++ * in command line arguments. Any other layouts could be added to ++ * the list when they made their way in kernel's MTD. The structure ++ * is simply copied from kernel's drivers/mtd/nand/nand_base.c as-is. ++ */ ++ { ++ .useecc = MTD_NANDECC_AUTOPLACE, ++ .eccbytes = 24, ++ .eccpos = { ++ 40, 41, 42, 43, 44, 45, 46, 47, ++ 48, 49, 50, 51, 52, 53, 54, 55, ++ 56, 57, 58, 59, 60, 61, 62, 63}, ++ .oobfree = { {2, 38} } ++ }, ++ /* End-of-list marker */ ++ { ++ .useecc = -1, ++ } ++}; + + typedef struct + { +@@ -59,7 +111,7 @@ + static int n_obj = 0; + static int obj_id = YAFFS_NOBJECT_BUCKETS + 1; + +-static int nObjects, nDirectories, nPages; ++static int nObjects = 0, nDirectories = 0, nPages = 0; + + static int outFile; + +@@ -123,6 +175,11 @@ + return -1; + } + ++/* KSI: ++ * No big endian for now. This is left for a later time. The existing code ++ * is FUBAR. ++ */ ++#if 0 + /* This little function converts a little endian tag to a big endian tag. + * NOTE: The tag is not usable after this other than calculating the CRC + * with. +@@ -155,11 +212,56 @@ + tags->asBytes[7] = temp.asBytes[7]; + #endif + } ++#endif ++ ++void nandmtd2_pt2buf(unsigned char *buf, yaffs_PackedTags2 *pt) ++{ ++ int i, j = 0, k, n; ++ unsigned char pt2_byte_buf[PT2_BYTES]; ++ ++ *((unsigned int *) &pt2_byte_buf[0]) = pt->t.sequenceNumber; ++ *((unsigned int *) &pt2_byte_buf[4]) = pt->t.objectId; ++ *((unsigned int *) &pt2_byte_buf[8]) = pt->t.chunkId; ++ *((unsigned int *) &pt2_byte_buf[12]) = pt->t.byteCount; ++ pt2_byte_buf[16] = pt->ecc.colParity; ++ pt2_byte_buf[17] = pt->ecc.lineParity & 0xff; ++ pt2_byte_buf[18] = (pt->ecc.lineParity >> 8) & 0xff; ++ pt2_byte_buf[19] = (pt->ecc.lineParity >> 16) & 0xff; ++ pt2_byte_buf[20] = (pt->ecc.lineParity >> 24) & 0xff; ++ pt2_byte_buf[21] = pt->ecc.lineParityPrime & 0xff; ++ pt2_byte_buf[22] = (pt->ecc.lineParityPrime >> 8) & 0xff; ++ pt2_byte_buf[23] = (pt->ecc.lineParityPrime >> 16) & 0xff; ++ pt2_byte_buf[24] = (pt->ecc.lineParityPrime >> 24) & 0xff; ++ ++ k = oob_layout[layout_no].oobfree[j][0]; ++ n = oob_layout[layout_no].oobfree[j][1]; ++ ++ if (n == 0) { ++ fprintf(stderr, "No OOB space for tags"); ++ exit(-1); ++ } ++ ++ for (i = 0; i < PT2_BYTES; i++) { ++ if (n == 0) { ++ j++; ++ k = oob_layout[layout_no].oobfree[j][0]; ++ n = oob_layout[layout_no].oobfree[j][1]; ++ if (n == 0) { ++ fprintf(stderr, "No OOB space for tags"); ++ exit(-1); ++ } ++ } ++ buf[k++] = pt2_byte_buf[i]; ++ n--; ++ } ++} + + static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes) + { + yaffs_ExtendedTags t; + yaffs_PackedTags2 pt; ++ unsigned char spare_buf[spareSize]; ++ + + error = write(outFile,data,chunkSize); + if(error < 0) return error; +@@ -177,18 +279,27 @@ + // added NCB **CHECK** + t.chunkUsed = 1; + ++/* KSI: Broken anyway -- e.g. &t is pointer to a wrong type... */ ++#if 0 + if (convert_endian) + { + little_to_big_endian(&t); + } ++#endif + + nPages++; + + yaffs_PackTags2(&pt,&t); +- +-// return write(outFile,&pt,sizeof(yaffs_PackedTags2)); +- return write(outFile,&pt,spareSize); +- ++ ++ memset(spare_buf, 0xff, sizeof(spare_buf)); ++ ++ if (layout_no == 0) { ++ memcpy(spare_buf, &pt, sizeof(yaffs_PackedTags2)); ++ } else { ++ nandmtd2_pt2buf(spare_buf, &pt); ++ } ++ ++ return write(outFile,spare_buf,spareSize); + } + + #define SWAP32(x) ((((x) & 0x000000FF) << 24) | \ +@@ -199,6 +310,8 @@ + #define SWAP16(x) ((((x) & 0x00FF) << 8) | \ + (((x) & 0xFF00) >> 8)) + ++/* KSI: Removed for now. TBD later when the proper util (from scratch) is written */ ++#if 0 + // This one is easier, since the types are more standard. No funky shifts here. + static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh) + { +@@ -256,6 +369,7 @@ + oh->roomToGrow[11] = SWAP32(oh->roomToGrow[11]); + #endif + } ++#endif + + static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias) + { +@@ -300,10 +414,13 @@ + strncpy(oh->alias,alias,YAFFS_MAX_ALIAS_LENGTH); + } + ++/* KSI: FUBAR. Left for a leter time. */ ++#if 0 + if (convert_endian) + { + object_header_little_to_big_endian(oh); + } ++#endif + + return write_chunk(bytes,objId,0,0xffff); + +@@ -319,7 +436,7 @@ + nDirectories++; + + dir = opendir(path); +- ++ + if(dir) + { + while((entry = readdir(dir)) != NULL) +@@ -403,12 +520,12 @@ + error = nBytes; + + printf("%d data chunks written\n",chunk); ++ close(h); + } + else + { + perror("Error opening file"); + } +- close(h); + + } + +@@ -448,58 +565,82 @@ + } + } + } ++ /* KSI: ++ * Who is supposed to close those open directories in this ++ * recursive function, lord Byron? Stock "ulimit -n" is 1024 ++ * and e.g. stock Fedora /etc directory has more that 1024 ++ * directories... ++ */ ++ closedir(dir); + } + + return 0; + + } + ++void usage(void) ++{ ++ printf("usage: mkyaffs2image layout# dir image_file [convert]\n"); ++ printf(" layout# NAND OOB layout # (0 - raw, 1 - nand_oob_64)\n"); ++ printf(" dir the directory tree to be converted\n"); ++ printf(" image_file the output file to hold the image\n"); ++ printf(" 'convert' make a big-endian img on a little-endian machine. BROKEN !\n"); ++ exit(1); ++} + + int main(int argc, char *argv[]) + { + struct stat stats; ++ int i; + + printf("mkyaffs2image: image building tool for YAFFS2 built "__DATE__"\n"); + +- if(argc < 3) ++ if ((argc < 4) || (sscanf(argv[1], "%u", &layout_no) != 1)) + { +- printf("usage: mkyaffs2image dir image_file [convert]\n"); +- printf(" dir the directory tree to be converted\n"); +- printf(" image_file the output file to hold the image\n"); +- printf(" 'convert' produce a big-endian image from a little-endian machine\n"); +- exit(1); ++ usage(); + } + +- if ((argc == 4) && (!strncmp(argv[3], "convert", strlen("convert")))) +- { +- convert_endian = 1; +- } ++ i = 0; ++ ++ while (oob_layout[i].useecc != -1) ++ i++; ++ ++ if (layout_no >= i) ++ usage(); ++ ++ if ((argc == 5) && (!strncmp(argv[4], "convert", strlen("convert")))) ++ { ++ /* KSI: Broken as of now. TBD. Fail. */ ++ usage(); ++ convert_endian = 1; ++ } + +- if(stat(argv[1],&stats) < 0) ++ if(stat(argv[2],&stats) < 0) + { +- printf("Could not stat %s\n",argv[1]); ++ printf("Could not stat %s\n",argv[2]); + exit(1); + } + + if(!S_ISDIR(stats.st_mode)) + { +- printf(" %s is not a directory\n",argv[1]); ++ printf(" %s is not a directory\n",argv[2]); + exit(1); + } + +- outFile = open(argv[2],O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE); ++ outFile = open(argv[3],O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE); + + + if(outFile < 0) + { +- printf("Could not open output file %s\n",argv[2]); ++ printf("Could not open output file %s\n",argv[3]); + exit(1); + } + +- printf("Processing directory %s into image file %s\n",argv[1],argv[2]); ++ printf("Processing directory %s into image file %s\n",argv[2],argv[3]); + error = write_object_header(1, YAFFS_OBJECT_TYPE_DIRECTORY, &stats, 1,"", -1, NULL); ++ + if(error) +- error = process_directory(YAFFS_OBJECTID_ROOT,argv[1]); ++ error = process_directory(YAFFS_OBJECTID_ROOT,argv[2]); + + close(outFile); + diff --git a/meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch b/meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch new file mode 100644 index 0000000000..c894528ca1 --- /dev/null +++ b/meta/recipes-devtools/yaffs2/files/yaffs2-unioob.patch @@ -0,0 +1,216 @@ +diff -urN yaffs2.orig/yaffs_mtdif2.c yaffs2/yaffs_mtdif2.c +--- yaffs2.orig/yaffs_mtdif2.c 2005-12-07 14:00:38.000000000 -0800 ++++ yaffs2/yaffs_mtdif2.c 2006-02-10 17:13:58.000000000 -0800 +@@ -29,6 +29,130 @@ + + #include "yaffs_packedtags2.h" + ++#define PT2_BYTES 25 ++ ++void nandmtd2_pt2buf(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw) ++{ ++ struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); ++ int i, j = 0, k, n; ++ __u8 pt2_byte_buf[PT2_BYTES]; ++ ++ /* Pack buffer with 0xff */ ++ for (i = 0; i < mtd->oobsize; i++) ++ dev->spareBuffer[i] = 0xff; ++ ++ if (!is_raw) { ++ *((unsigned int *) &dev->spareBuffer[0]) = pt->t.sequenceNumber; ++ *((unsigned int *) &dev->spareBuffer[4]) = pt->t.objectId; ++ *((unsigned int *) &dev->spareBuffer[8]) = pt->t.chunkId; ++ *((unsigned int *) &dev->spareBuffer[12]) = pt->t.byteCount; ++ dev->spareBuffer[16] = pt->ecc.colParity; ++ dev->spareBuffer[17] = pt->ecc.lineParity & 0xff; ++ dev->spareBuffer[18] = (pt->ecc.lineParity >> 8) & 0xff; ++ dev->spareBuffer[19] = (pt->ecc.lineParity >> 16) & 0xff; ++ dev->spareBuffer[20] = (pt->ecc.lineParity >> 24) & 0xff; ++ dev->spareBuffer[21] = pt->ecc.lineParityPrime & 0xff; ++ dev->spareBuffer[22] = (pt->ecc.lineParityPrime >> 8) & 0xff; ++ dev->spareBuffer[23] = (pt->ecc.lineParityPrime >> 16) & 0xff; ++ dev->spareBuffer[24] = (pt->ecc.lineParityPrime >> 24) & 0xff; ++ } else { ++ *((unsigned int *) &pt2_byte_buf[0]) = pt->t.sequenceNumber; ++ *((unsigned int *) &pt2_byte_buf[4]) = pt->t.objectId; ++ *((unsigned int *) &pt2_byte_buf[8]) = pt->t.chunkId; ++ *((unsigned int *) &pt2_byte_buf[12]) = pt->t.byteCount; ++ pt2_byte_buf[16] = pt->ecc.colParity; ++ pt2_byte_buf[17] = pt->ecc.lineParity & 0xff; ++ pt2_byte_buf[18] = (pt->ecc.lineParity >> 8) & 0xff; ++ pt2_byte_buf[19] = (pt->ecc.lineParity >> 16) & 0xff; ++ pt2_byte_buf[20] = (pt->ecc.lineParity >> 24) & 0xff; ++ pt2_byte_buf[21] = pt->ecc.lineParityPrime & 0xff; ++ pt2_byte_buf[22] = (pt->ecc.lineParityPrime >> 8) & 0xff; ++ pt2_byte_buf[23] = (pt->ecc.lineParityPrime >> 16) & 0xff; ++ pt2_byte_buf[24] = (pt->ecc.lineParityPrime >> 24) & 0xff; ++ ++ k = mtd->oobinfo.oobfree[j][0]; ++ n = mtd->oobinfo.oobfree[j][1]; ++ ++ if (n == 0) { ++ T(YAFFS_TRACE_ERROR, (TSTR("No OOB space for tags" TENDSTR))); ++ YBUG(); ++ } ++ ++ for (i = 0; i < PT2_BYTES; i++) { ++ if (n == 0) { ++ j++; ++ k = mtd->oobinfo.oobfree[j][0]; ++ n = mtd->oobinfo.oobfree[j][1]; ++ if (n == 0) { ++ T(YAFFS_TRACE_ERROR, (TSTR("No OOB space for tags" TENDSTR))); ++ YBUG(); ++ } ++ } ++ dev->spareBuffer[k++] = pt2_byte_buf[i]; ++ n--; ++ } ++ } ++} ++ ++void nandmtd2_buf2pt(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw) ++{ ++ struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); ++ int i, j = 0, k, n; ++ __u8 pt2_byte_buf[PT2_BYTES]; ++ ++ ++ if (!is_raw) { ++ pt->t.sequenceNumber = *((unsigned int *) &dev->spareBuffer[0]); ++ pt->t.objectId = *((unsigned int *) &dev->spareBuffer[4]); ++ pt->t.chunkId = *((unsigned int *) &dev->spareBuffer[8]); ++ pt->t.byteCount = *((unsigned int *) &dev->spareBuffer[12]); ++ pt->ecc.colParity = dev->spareBuffer[16]; ++ pt->ecc.lineParity = (dev->spareBuffer[17] & 0x000000ff) | ++ ((dev->spareBuffer[18] << 8) & 0x0000ff00) | ++ ((dev->spareBuffer[19] << 16) & 0x00ff0000) | ++ ((dev->spareBuffer[20] << 24) & 0xff000000); ++ pt->ecc.lineParityPrime = (dev->spareBuffer[21] & 0x000000ff) | ++ ((dev->spareBuffer[22] << 8) & 0x0000ff00) | ++ ((dev->spareBuffer[23] << 16) & 0x00ff0000) | ++ ((dev->spareBuffer[24] << 24) & 0xff000000); ++ } else { ++ k = mtd->oobinfo.oobfree[j][0]; ++ n = mtd->oobinfo.oobfree[j][1]; ++ ++ if (n == 0) { ++ T(YAFFS_TRACE_ERROR, (TSTR("No space in OOB for tags" TENDSTR))); ++ YBUG(); ++ } ++ ++ for (i = 0; i < PT2_BYTES; i++) { ++ if (n == 0) { ++ j++; ++ k = mtd->oobinfo.oobfree[j][0]; ++ n = mtd->oobinfo.oobfree[j][1]; ++ if (n == 0) { ++ T(YAFFS_TRACE_ERROR, (TSTR("No space in OOB for tags" TENDSTR))); ++ YBUG(); ++ } ++ } ++ pt2_byte_buf[i] = dev->spareBuffer[k++]; ++ n--; ++ } ++ pt->t.sequenceNumber = *((unsigned int *) &pt2_byte_buf[0]); ++ pt->t.objectId = *((unsigned int *) &pt2_byte_buf[4]); ++ pt->t.chunkId = *((unsigned int *) &pt2_byte_buf[8]); ++ pt->t.byteCount = *((unsigned int *) &pt2_byte_buf[12]); ++ pt->ecc.colParity = pt2_byte_buf[16]; ++ pt->ecc.lineParity = (pt2_byte_buf[17] & 0x000000ff) | ++ ((pt2_byte_buf[18] << 8) & 0x0000ff00) | ++ ((pt2_byte_buf[19] << 16) & 0x00ff0000) | ++ ((pt2_byte_buf[20] << 24) & 0xff000000); ++ pt->ecc.lineParityPrime = (pt2_byte_buf[21] & 0x000000ff) | ++ ((pt2_byte_buf[22] << 8) & 0x0000ff00) | ++ ((pt2_byte_buf[23] << 16) & 0x00ff0000) | ++ ((pt2_byte_buf[24] << 24) & 0xff000000); ++ } ++} ++ + int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND, + const __u8 * data, + const yaffs_ExtendedTags * tags) +@@ -51,24 +175,22 @@ + } + + if (data && tags) { +- if (dev->useNANDECC) +- retval = +- mtd->write_ecc(mtd, addr, dev->nBytesPerChunk, +- &dummy, data, (__u8 *) & pt, NULL); +- else ++ nandmtd2_pt2buf(dev, &pt, 0); + retval = + mtd->write_ecc(mtd, addr, dev->nBytesPerChunk, +- &dummy, data, (__u8 *) & pt, NULL); ++ &dummy, data, dev->spareBuffer, ++ NULL); + } else { + if (data) + retval = + mtd->write(mtd, addr, dev->nBytesPerChunk, &dummy, + data); +- if (tags) ++ if (tags) { ++ nandmtd2_pt2buf(dev, &pt, 1); + retval = + mtd->write_oob(mtd, addr, mtd->oobsize, &dummy, +- (__u8 *) & pt); +- ++ dev->spareBuffer); ++ } + } + + if (retval == 0) +@@ -94,30 +216,24 @@ + TENDSTR), chunkInNAND, data, tags)); + + if (data && tags) { +- if (dev->useNANDECC) { + retval = + mtd->read_ecc(mtd, addr, dev->nBytesPerChunk, + &dummy, data, dev->spareBuffer, + NULL); +- } else { +- retval = +- mtd->read_ecc(mtd, addr, dev->nBytesPerChunk, +- &dummy, data, dev->spareBuffer, +- NULL); +- } ++ nandmtd2_buf2pt(dev, &pt, 0); + } else { + if (data) + retval = + mtd->read(mtd, addr, dev->nBytesPerChunk, &dummy, + data); +- if (tags) ++ if (tags) { + retval = + mtd->read_oob(mtd, addr, mtd->oobsize, &dummy, + dev->spareBuffer); ++ nandmtd2_buf2pt(dev, &pt, 1); ++ } + } + +- memcpy(&pt, dev->spareBuffer, sizeof(pt)); +- + if (tags) + yaffs_UnpackTags2(tags, &pt); + +@@ -178,10 +294,11 @@ + *sequenceNumber = 0; + *state = YAFFS_BLOCK_STATE_EMPTY; + } ++ ++ T(YAFFS_TRACE_MTD, ++ (TSTR("block is OK seq %d state %d" TENDSTR), *sequenceNumber, ++ *state)); + } +- T(YAFFS_TRACE_MTD, +- (TSTR("block is bad seq %d state %d" TENDSTR), *sequenceNumber, +- *state)); + + if (retval == 0) + return YAFFS_OK; diff --git a/meta/recipes-devtools/yaffs2/yaffs2-utils.inc b/meta/recipes-devtools/yaffs2/yaffs2-utils.inc new file mode 100644 index 0000000000..b25cc3b590 --- /dev/null +++ b/meta/recipes-devtools/yaffs2/yaffs2-utils.inc @@ -0,0 +1,27 @@ +DESCRIPTION = "Tools for managing 'yaffs2' file systems." +SECTION = "base" +HOMEPAGE = "http://www.yaffs.net" +LICENSE = "GPLv2" +PV = "0.0.0+cvs${SRCDATE}" +PR = "r0" +DEPENDS = "mtd-utils" + +SRC_URI = "cvs://anonymous@cvs.aleph1.co.uk/home/aleph1/cvs;module=yaffs2 \ + file://mkyaffs2image.patch;patch=1" +S = "${WORKDIR}/yaffs2" + +CFLAGS += "-I.. -DCONFIG_YAFFS_UTIL" +CFLAGS_append_virtclass-native = " -I.. -DCONFIG_YAFFS_UTIL" + +do_compile() { + cd utils && oe_runmake +} + +do_install() { + install -d ${D}${sbindir}/ + for i in mkyaffsimage mkyaffs2image; do + install -m 0755 utils/$i ${D}${sbindir}/ + done +} + +BBCLASSEXTEND = "native" diff --git a/meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb b/meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb new file mode 100644 index 0000000000..6171fe55bd --- /dev/null +++ b/meta/recipes-devtools/yaffs2/yaffs2-utils_cvs.bb @@ -0,0 +1,3 @@ +require yaffs2-utils.inc +PR = "r1" + |