SRC_URI="ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.13.2.tar.gz"
 S = ${WORKDIR}/binutils-${PV}
 
-OLDOS := ${OS}
-OLDARCH := ${ARCH}
 CROSS_DIR := ${CROSS_DIR}
-inherit noncross autotools
-
-do_configure() {
-       ./configure --prefix=${CROSS_DIR} --target=${OLDARCH}-${OLDOS}
-}
+prefix=${CROSS_DIR}
+exec_prefix=${prefix}
+inherit cross autotools
 
 EXTRA_OEMAKE =
-do_compile() {
-       oe_runmake
-}
-
-do_install() {
-       oe_runmake install
-}
 
 SRC_URI = http://ftp.kernel.org/pub/linux/devel/binutils/binutils-${PV}.tar.gz
 S = ${WORKDIR}/binutils-${PV}
 
-OLDOS := ${OS}
-OLDARCH := ${ARCH}
 CROSS_DIR := ${CROSS_DIR}
-inherit noncross autotools
-
-do_configure() {
-       ./configure --prefix=${CROSS_DIR} --target=${OLDARCH}-${OLDOS}
-}
+prefix=${CROSS_DIR}
+exec_prefix=${prefix}
+inherit cross autotools
 
 EXTRA_OEMAKE =
-do_compile() {
-       oe_runmake
-}
-
-do_install() {
-       oe_runmake install
-}
 
 SRC_URI="${GNU_MIRROR}/binutils/binutils-${PV}.tar.gz"
 S = ${WORKDIR}/binutils-${PV}
 
-OLDOS := ${OS}
-OLDARCH := ${ARCH}
 CROSS_DIR := ${CROSS_DIR}
-inherit noncross autotools
-
-do_configure() {
-       ./configure --prefix=${CROSS_DIR} --target=${OLDARCH}-${OLDOS}
-}
+prefix=${CROSS_DIR}
+exec_prefix=${prefix}
+inherit cross autotools
 
 EXTRA_OEMAKE =
-do_compile() {
-       oe_runmake
-}
-
-do_install() {
-       oe_runmake install
-}
 
 SRC_URI = ${GNU_MIRROR}/gcc/gcc-${PV}.tar.gz
 S = ${WORKDIR}/gcc-${PV}
 
-OLDOS := ${OS}
-OLDARCH := ${ARCH}
 CROSS_DIR := ${CROSS_DIR}
-inherit noncross autotools
+prefix=${CROSS_DIR}
+exec_prefix=${prefix}
+inherit cross autotools
 
-EXTRA_OECONF = --with-gxx-include-dir=${CROSS_DIR}/include/c++ \
-               --enable-shared \
-               --enable-threads
+EXTRA_OEMAKE =
+EXTRA_OECONF = --oldincludedir=${prefix}/include --enable-shared \
+              --with-gxx-include-dir=${CROSS_DIR}/include/c++ \
+              --enable-shared \
+              --enable-threads
 tmake_file = gcc/config/${OLDARCH}/t-linux
 
-do_configure() {
-       ./configure --target=${OLDARCH}-${OLDOS} --prefix=${CROSS_DIR} \
-                   --with-gnu-ld --oldincludedir=${CROSS_DIR}/include \
-                   --enable-shared ${EXTRA_OECONF}     
+do_configure_append() {
        touch ${tmake_file}
        mv ${tmake_file} > ${tmake_file}.tmp
        cat ${tmake_file}.tmp | sed -e's/-Dinhibit_libc -D__gthr_posix_h//g' > ${tmake_file}
        rm -f ${tmake_file}.tmp
 }
-
-EXTRA_OEMAKE =
-do_compile() {
-       oe_runmake
-}
 
+include cross-gcc-${PV}.oe
+PN:=${PN}-initial
+
+EXTRA_OECONF = --oldincludedir=${prefix}/include --enable-shared \
+              --enable-languages=c \
+              --disable-shared \
+              --disable-threads
+
+do_configure_append () {
+       if (grep -q TARGET_LIBGCC2_CFLAGS ${tmake_file}); then
+               perl -pi -e 's/^(TARGET_LIBGCC2_CFLAGS.*)/$$1 -Dinhibit_libc -D__gthr_posix_h/' ${tmake_file}
+       else
+               echo 'TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -D__gthr_posix_h' >> ${tmake_file}
+       fi
+       echo 'T_CFLAGS = -Dinhibit_libc -D__gthr_posix_h' >> ${tmake_file}
+}
 
 SRC_URI := ${DEBIAN_MIRROR}/main/f/fakeroot/${PN}_${PV}.tar.gz
-S := ${WORKDIR}/${P}
+S = ${WORKDIR}/${P}
 
 inherit autotools
 
-inherit noncross
+inherit native
 include fakeroot-${PV}.oe
-S := ${S}
-PN=fakeroot-buildarch
+PN_append=-buildarch
+S = ${WORKDIR}/fakeroot-${PV}
 
+inherit native
+include ipkg-${PV}.oe
 
+inherit native
+include ipkg-${PV}.oe
 
 LICENSE="GPL"
 #DEPENDS=virtual/libc
 
-SRC_URI="cvs://anoncvs:anoncvs@192.58.209.91/cvs;module=ipkg-utils"
-S="${WORKDIR}/${PN}"
+SRC_URI:="cvs://anoncvs:anoncvs@192.58.209.91/cvs;module=ipkg-utils"
+S:="${WORKDIR}/${PN}"
 
 inherit autotools
 
 
+inherit native
+include mtd.oe
+PN=mtd-buildarch
+
+do_stage () {
+       for binary in ftl_format erase eraseall nanddump doc_loadbios \
+               mkfs.jffs ftl_check mkfs.jffs2 lock unlock einfo mtd_debug \
+               fcp nandwrite jffs2dump; do
+               install -m 0755 $binary ${STAGING_BINDIR}/
+       done
+}