Per Oliver's request,

This is for those that need to get something working immediately on Mips64 with T2, Hopefully I will be able to get a final version merged in time for 8.1, if my schedule allows.

The patch will not work against the current trunk, I am sharing it as an example of what needs to be done to get a Mips64 build working, It is not intended to be merged into the T2 code-base in it's current form. This is to be used as an example for anyone who wants to move the Mips64 port forward, and submit actual patches against the current svn code-base. I will be re-submitting pieces of thiis patch for inclusion, one by one, as the pieces are tested & known to be sane & solid. If you can't wait for me to do this, then by all means jump in and help, it's been very lonely here in Mips land, and we need to catch up to the rest of the T2 architectures.

The Mips64 Patches are against T2 Revision 36064  (was trunk, now 8.0)
Need to fetch T2 at revision 36064 (before the move to GCC 4.5) for this to 
work.

These should give a working user space on Mips64 for either n64 or n32 abi's but muiltilib is not yet working. The kernel will have to be built later as an overlay, My kernel was highly specific to the Octeon processor, so I was not able to do any fixes on the basic Mips64 T2 kernel, what is in the kernel config now will need a lot of work before it is usable.

When doing the configuration when selecting the processor type, you will also have to chose the library abi type, choose one of the first 2 options, the others will not work.

pure64 (T2 user space built with --mabi=64) This one may also be broken in this patch, but is fixable n32over64 (T2 user space built with --mabi-n32 : 32 bit user space to run on top of a 64 bit kernel) This one has has the most testing.

The Generic Minimal target was used for building, some things that would not build on Mips64 were removed from the target, because they were not needed for my project. they will have to be re-enabled, and debugged if you need those packages. the ones most likely to be missed are udev & perl, and a vanilla 2.6 kernel. check the generic-minimal pkgsel files to see what else had to be removed. There were also some package additions that were not in normally in generic-minimal that have been added at the end of the pkgsel file.

One big patch-file attached.

Jan

On 9/2/2010 4:10 PM, Oliver Kowalke wrote:
Am 02.09.2010 22:03, schrieb Jan Rovins:


-----Original Message-----
From: Oliver Kowalke [mailto:[email protected]]
Sent: Thursday, September 02, 2010 2:59 AM
To: Jan Rovins; [email protected]
Subject: Re: RE: [t2] MIPS64 not working

Hello Jan,

I have been able to get a usable user space built for Mips64 using T2
8.0

that are good news

The next thing you will run into is some "internal compiler errors" with
the latest GCC It failed for me on 4.5.0, but may have been fixed in
4.5.1, if not you will have to Roll GCC back to version 4.4.3

I'll go with 4.4.3

I was able to get either a pure 64 abi build, or an n32
abi build, but not both in the same project.

do you mean n64 or o64?


mabi=64  which would be n64.

The n64 built OK, but I did not test it as extensively as the n32 build.

I built it to run on the Cavium Octeon processor. What type of system will
you be building for?

O2 with R5000

Oliver


Index: architecture/mips64/kernel.conf.m4
===================================================================
--- architecture/mips64/kernel.conf.m4	(revision 36064)
+++ architecture/mips64/kernel.conf.m4	(working copy)
@@ -14,8 +14,55 @@
 define(`MIPS', `MIPS')dnl
 
 CONFIG_MIPS=y
-CONFIG_MIPS64=y
+dnl CONFIG_MIPS64=y
+CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD=y
+CONFIG_CAVIUM_OCTEON_SPECIFIC_OPTIONS=y
+CONFIG_CAVIUM_OCTEON_HW_FIX_UNALIGNED=y
+CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=1
+CONFIG_CAVIUM_OCTEON_LOCK_L2=y
+CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB=y
+CONFIG_CAVIUM_OCTEON_LOCK_L2_EXCEPTION=y
+CONFIG_CAVIUM_OCTEON_LOCK_L2_LOW_LEVEL_INTERRUPT=y
+CONFIG_CAVIUM_OCTEON_LOCK_L2_INTERRUPT=y
+CONFIG_CAVIUM_OCTEON_LOCK_L2_MEMCPY=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
 
+
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_R4K_LIB=y
+
+
+
+CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_SYS_SUPPORTS_HUGETLBFS=y
+CONFIG_IRQ_CPU=y
+CONFIG_IRQ_CPU_OCTEON=y
+
+CONFIG_MTD=y
+
+CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=y
+CONFIG_MIPS32_COMPAT=y
+CONFIG_COMPAT=y
+CONFIG_SYSVIPC_COMPAT=y
+CONFIG_MIPS32_O32=y
+CONFIG_MIPS32_N32=y
+CONFIG_BINFMT_ELF32=y
+dnl needed for undef syms jlr
+CONFIG_SERIO_I8042=y
+CONFIG_INPUT_PCSPKR=y
+
 include(`kernel-common.conf.m4')
 include(`kernel-block.conf.m4')
 include(`kernel-net.conf.m4')
Index: architecture/mips64/archtest.sh
===================================================================
--- architecture/mips64/archtest.sh	(revision 36064)
+++ architecture/mips64/archtest.sh	(working copy)
@@ -11,7 +11,6 @@
 # the Free Software Foundation; version 2 of the License. A copy of the
 # GNU General Public License can be found in the file COPYING.
 # --- T2-COPYRIGHT-NOTE-END ---
-
 case "$SDECFG_MIPS64_ENDIANESS" in
     EL)
     	arch_bigendian=no
@@ -21,3 +20,10 @@
 	arch_target="mips64-t2-linux-gnu" ;;
 esac
 
+# try a different build triplet to force 64 bits
+# gcc stage1 fails without this
+#if [ "$SDECFG_MIPS64_OPT" = "octeon" ] ; then
+#       arch_target="mips64-octeon-linux-gnu"
+#fi
+
+
Index: architecture/mips64/config.hlp
===================================================================
--- architecture/mips64/config.hlp	(revision 36064)
+++ architecture/mips64/config.hlp	(working copy)
@@ -19,3 +19,5 @@
 SDECFG_MIPS64_OPT
   Please select the CPU you want to optimise for.
 
+SDECFG_MIPS64_SYSLIBS
+  Please select the userspace system libries to use.
Index: architecture/mips64/config.in
===================================================================
--- architecture/mips64/config.in	(revision 36064)
+++ architecture/mips64/config.in	(working copy)
@@ -24,11 +24,35 @@
 	generic "No special optimisation"	\
 	r5000   "Build for R5000 CPU"		\
 	r6000   "Build for R6000 CPU"		\
-	r8000   "Build for R8000 CPU"
+	r8000   "Build for R8000 CPU"		\
+	octeon  "Build for Cavium Octeon SOC"
 
 if [ $SDECFG_MIPS64_OPT != generic ]; then
 	SDECFG_ID="$SDECFG_ID-$SDECFG_MIPS64_OPT"
 fi
 
-SDECFGSET_MULTILIB=1
+choice SDECFG_MIPS64_SYSLIBS n32over64				\
+	pure64      "Use pure n64 bit ABI System Libs"			\
+	n32over64   "Use n32 ABI System Libs run on 64-bit kernel"	\
+	n32_n64     "Use Multilib: n32 and n64 ABI System Libs"		\
+	o32_n32_n64 "Use triple Multilib: o32, n32 and n64 ABI System Libs"	
 
+if   [ $SDECFG_MIPS64_SYSLIBS = pure64      ]; then 
+	# Should set to build everything -mabi=64
+	SDECFGSET_MULTILIB=0
+elif [ $SDECFG_MIPS64_SYSLIBS = n32over64   ]; then 
+	# Should set to build everything -mabi=n32
+	# TBD: Set up kernel to build as 64 bit
+	SDECFGSET_MULTILIB=0
+elif [ $SDECFG_MIPS64_SYSLIBS = n32_n64     ]; then 
+	# This would be the vanella multilib configuration
+	SDECFGSET_MULTILIB=1
+	#const SDECFG_MULTILIBLIST "64,n32"
+	#SDECFGSET_MULTILIBLIST="64,n32"
+elif [ $SDECFG_MIPS64_SYSLIBS = o32_n32_n64 ]; then 
+	# TBD: figure out how to build with 3 libs
+	SDECFGSET_MULTILIB=1
+	#const SDECFG_MULTILIBLIST "n32,64,o32"
+	#SDECFGSET_MULTILIBLIST="n32,64,o32"
+fi
+
Index: architecture/mips64/gcc-options.in
===================================================================
--- architecture/mips64/gcc-options.in	(revision 36064)
+++ architecture/mips64/gcc-options.in	(working copy)
@@ -16,3 +16,26 @@
 	var_append GCC_WRAPPER_INSERT " " "-march=$SDECFG_MIPS64_OPT"
 fi
 
+case $SDECFG_MIPS64_SYSLIBS in
+	"pure64")
+		#atstage toolchain || var_append GCC_WRAPPER_INSERT " " "-mabi=64";;	
+		var_append GCC_WRAPPER_INSERT " " "-mabi=64";;	
+	"n32over64")
+		atstage toolchain || var_append GCC_WRAPPER_INSERT " " "-mabi=n32";;
+	"n32_n64")
+		echo "!!! WARNING:"
+		echo "n32_n64 Multi-lib is not yet working, Proceed at your own risk ..."
+		# add this for everything, since so many stage1 things fail because they cant find  crtn.o or  crt1.o
+		##[[ $libdir = *lib64 ]] && var_append GCC_WRAPPER_INSERT " " "-L$root/usr/lib64 -L$root/lib64"	
+		#
+		# since gcc defaults to -mabi=n32, this shoukd get us 64 bit libs built in /lib64
+		# and also build all 64 bit binaries, but still build the 32bit stuff correctly
+		var_append GCC_WRAPPER_INSERT " " "-mabi=64" 
+		sleep 2;;
+	"o32_n32_n64")
+		echo "!!! WARNING:"
+		echo "o32_n32_n64  Multi-lib is not yet implemented, Proceed at your own risk ..."
+		var_append GCC_WRAPPER_INSERT " " "-mabi=64" 
+		sleep 2;;
+esac
+
Index: architecture/share/kernel-common.conf.m4
===================================================================
--- architecture/share/kernel-common.conf.m4	(revision 36064)
+++ architecture/share/kernel-common.conf.m4	(working copy)
@@ -125,7 +125,7 @@
 CONFIG_INPUT_TABLET=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_EVBUG=m
-CONFIG_SERIO_PCIPS2=y
+CONFIG_SERIO_PCIPS2=m
 CONFIG_MOUSE_SERIAL=y
 CONFIG_MOUSE_PS2=y
 
Index: target/generic/pkgsel/00-bootstrap.in
===================================================================
--- target/generic/pkgsel/00-bootstrap.in	(revision 36064)
+++ target/generic/pkgsel/00-bootstrap.in	(working copy)
@@ -20,7 +20,8 @@
 # TODO: for now:
 O *
 = glibc
-= glibc32
+# JLR not for n32 build
+#= glibc32
 
 # Add strictly required packages
 X 00-dirtree
@@ -58,7 +59,10 @@
 X ncompress
 X ncurses
 X patch
-X perl
+
+# does not build for mips multilib
+#X perl
+
 X pkgconfig
 X readline
 X sed
Index: target/generic/pkgsel/10-minimal-xorg.in
===================================================================
--- target/generic/pkgsel/10-minimal-xorg.in	(revision 36064)
+++ target/generic/pkgsel/10-minimal-xorg.in	(working copy)
@@ -25,7 +25,7 @@
 X python
 
 # mostly just for xkeyboard-config
-X perl-xml-parser
+# JLR X perl-xml-parser
 
 # needed by xsm:
 X netkit-rsh
Index: target/generic/pkgsel/00-minimal.in
===================================================================
--- target/generic/pkgsel/00-minimal.in	(revision 36064)
+++ target/generic/pkgsel/00-minimal.in	(working copy)
@@ -18,17 +18,20 @@
 # reuse the bootstrap
 include target/generic/pkgsel/00-bootstrap.in
 
-X dietlibc
+#JLR
+# Broken on Mips64# X dietlibc
 X dhcp
 X dialog
+#JLR
+X libstdc++-v3
 X bdb
 X bzip2
 X ccache
 X cracklib
 X cron
-X disktype
+# JLR X disktype
 X eject
-X embutils
+# JLR X embutils
 X ethtool
 X ed
 X expat
@@ -48,7 +51,8 @@
 X wpa_supplicant
 X kbd
 X less
-X linux26
+# JLR
+#X linux26
 X man-pages
 X minised
 X modutils
@@ -80,11 +84,13 @@
 X sysfsutils
 X sysklogd
 X sysvinit
-X udev
+# fails on multiulib
+###X udev
 X unzip
 X vlock
 X wget
-X perl-gettext
+## dosnt build fir mips64 muitilib
+#X perl-gettext
 X help2man
 X zile
 X zip
@@ -102,7 +108,7 @@
 # and let people create T2 ISOs and LiveCD/DVDs
 X cmake
 X libcap
-X cdrkit
+#X cdrkit
 X popt
 X squashfs-tools
 X unionfs
@@ -116,6 +122,7 @@
 X hfsutils
 X milo
 X grub
+X lilo
 X elftoaout
 X silo
 X syslinux
@@ -124,3 +131,27 @@
 
 # sysfiles split
 X mkinitrd
+
+# JLR Extra packages for Adax GW
+X libpcap
+X ash
+X sash
+X textinfo
+X xinetd
+X netkit-ftp
+X netkit-tftp
+X netkit-telnet
+X hdparm
+X gdbm
+X gnutls
+X libgpg-error
+X setserial
+X tcpdump
+X traceroute
+X ntp
+X lm_sensors
+X smartmontools
+#X tcl
+#X expect
+X gawk
+X ksymoops
Index: package/archiver/zziplib/zziplib.desc
===================================================================
--- package/archiver/zziplib/zziplib.desc	(revision 36064)
+++ package/archiver/zziplib/zziplib.desc	(working copy)
@@ -31,6 +31,6 @@
 [L] GPL
 [S] Beta
 [V] 0.13.58
-[P] X -----5---9 112.500
+[P] X 1----5---9 112.500
 
 [D] 925795281 zziplib-0.13.58.tar.bz2 http://dl.sourceforge.net/sourceforge/zziplib/
Index: package/archiver/gzip/gzip.conf
===================================================================
--- package/archiver/gzip/gzip.conf	(revision 36064)
+++ package/archiver/gzip/gzip.conf	(working copy)
@@ -30,3 +30,12 @@
     fi
 }
 hook_add postmake 5 "pm_move_to_bin"
+
+# Do this for Mips64 multilib
+if [[ $libdir = *lib64 ]]; then
+sleep 3
+	export LDFLAGS="$LDFLAGS -L$root/usr/lib64"
+#	var_insert LD_LIBRARY_PATH ':' "$LD_LIBRARY_PATH"
+	#var_append confopt " " "export LDFLAGS='${LDFLAGS} -L$root/usr/lib64'"
+fi
+
Index: package/perl/perl/perl.conf
===================================================================
--- package/perl/perl/perl.conf	(revision 36064)
+++ package/perl/perl/perl.conf	(working copy)
@@ -72,7 +72,7 @@
 runconfig=0
 
 [[ $libdir = *lib64 ]] && var_append patchfiles ' ' "$confdir/lib64.diff"
-libpth="/usr/local/${libdir##*/} /${libdir##*/} /usr/${libdir##*/}"
+libpth="$root/usr/local/${libdir##*/} /$root$/{libdir##*/} $root/usr/${libdir##*/}"
 confopt="-des -Dcc=gcc -Darchname=$arch_target -Dprefix=/$prefix \
 	-Dmyhostname=$SDECFG_PKG_PERL5_HOST_NAME \
 	-Dsiteprefix=/$SDECFG_PKG_PERL5_SITE_PREFIX \
Index: package/network/tcpdump/tcpdump.conf
===================================================================
--- package/network/tcpdump/tcpdump.conf	(revision 0)
+++ package/network/tcpdump/tcpdump.conf	(revision 0)
@@ -0,0 +1,34 @@
+# --- T2-COPYRIGHT-NOTE-BEGIN ---
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+#
+# T2 SDE: package/.../e2fsprogs/e2fsprogs.conf
+# Copyright (C) 2004 - 2010 The T2 SDE Project
+# Copyright (C) 1998 - 2004 ROCK Linux Project
+#
+# More information can be found in the files COPYING and README.
+#
+# 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; version 2 of the License. A copy of the
+# GNU General Public License can be found in the file COPYING.
+# --- T2-COPYRIGHT-NOTE-END ---
+
+cross_setup() {
+	var_append confopt " " "--config-cache"
+	cat >> ./config.cache <<-EOT
+	ac_cv_linux_vers=2 
+	ac_cv_res_inet6=no 
+	ac_cv_func_pcap_datalink_name_to_val=yes
+	ac_cv_func_pcap_list_datalinks=yes
+	ac_cv_func_pcap_datalink_name_to_val=yes
+	ac_cv_func_pcap_datalink_val_to_description=yes
+	ac_cv_func_pcap_dump_ftell=yes
+	EOT
+}
+
+atstage cross  && hook_add preconf 5 cross_setup
+
+
+# Note, on some multi lib architecures (i.e Mips64), tcpdump must be built
+# as 64 bit, if running a 64 bit kernel, otherwise it will not work
+# TBD: add some code to handle that here.
Index: package/network/tcpdump/tcpdump.desc
===================================================================
--- package/network/tcpdump/tcpdump.desc	(revision 36064)
+++ package/network/tcpdump/tcpdump.desc	(working copy)
@@ -25,9 +25,11 @@
 
 [C] base/tool
 
+[F] CROSS
+
 [L] OpenSource
 [S] Stable
 [V] 4.1.1
-[P] X -----5---9 117.700
+[P] X -1---5---9 117.700
 
 [D] 2922579683 tcpdump-4.1.1.tar.gz http://www.tcpdump.org/release/
Index: package/develop/expect/expect-5.43.0-spawn-1.patch
===================================================================
--- package/develop/expect/expect-5.43.0-spawn-1.patch	(revision 0)
+++ package/develop/expect/expect-5.43.0-spawn-1.patch	(revision 0)
@@ -0,0 +1,217 @@
+Submitted By: LFS Book <[email protected]>
+Date: 2003-10-05
+Initial Package Version: 5.38
+Origin: Redhat RPM (Patch by HJ Lu)
+Description: NA
+diff -uNr expect-5.38.orig/exp_chan.c expect-5.38/exp_chan.c
+--- expect-5.38.orig/exp_chan.c	2002-02-12 13:00:55.000000000 +1100
++++ expect-5.38/exp_chan.c	2003-03-01 10:36:18.000000000 +1100
+@@ -519,6 +519,7 @@
+     esPtr->buffer = Tcl_NewStringObj("",0);
+     Tcl_IncrRefCount(esPtr->buffer);
+     esPtr->umsize = exp_default_match_max;
++    esPtr->umsize_changed = exp_default_match_max_changed;
+     /* this will reallocate object with an appropriate sized buffer */
+     expAdjust(esPtr);
+ 
+diff -uNr expect-5.38.orig/exp_command.h expect-5.38/exp_command.h
+--- expect-5.38.orig/exp_command.h	2002-04-08 08:57:20.000000000 +1000
++++ expect-5.38/exp_command.h	2003-03-01 10:36:18.000000000 +1100
+@@ -25,6 +25,7 @@
+ EXTERN char *		exp_get_var _ANSI_ARGS_((Tcl_Interp *,char *));
+ 
+ EXTERN int exp_default_match_max;
++EXTERN int exp_default_match_max_changed;
+ EXTERN int exp_default_parity;
+ EXTERN int exp_default_rm_nulls;
+ 
+@@ -97,6 +98,7 @@
+     int msize;	        /* # of bytes that buffer can hold (max) */
+     int umsize;	        /* # of bytes (min) that is guaranteed to match */
+ 			/* this comes from match_max command */
++    int umsize_changed;	/* is umsize changed by user?  */
+     int printed;	/* # of bytes written to stdout (if logging on) */
+                         /* but not actually returned via a match yet */
+     int echoed;	        /* additional # of bytes (beyond "printed" above) */
+diff -uNr expect-5.38.orig/expect.c expect-5.38/expect.c
+--- expect-5.38.orig/expect.c	2002-04-08 09:00:33.000000000 +1000
++++ expect-5.38/expect.c	2003-03-01 10:36:18.000000000 +1100
+@@ -41,8 +41,17 @@
+ #include "tcldbg.h"
+ #endif
+ 
++/* The initial length is 2000. We increment it by 2000. The maximum
++   is 8MB (0x800000).  */
++#define EXP_MATCH_MAX		2000
++#define EXP_MATCH_INC		2000
++#define EXP_MATCH_STEP_LIMIT	0x700000
++#define EXP_MATCH_LIMIT		0x800000
++#define EXP_MATCH_LIMIT_QUOTE	"0x800000"
++
+ /* initial length of strings that we can guarantee patterns can match */
+-int exp_default_match_max =	2000;
++int exp_default_match_max =	EXP_MATCH_MAX;
++int exp_default_match_max_changed = 0;
+ #define INIT_EXPECT_TIMEOUT_LIT	"10"	/* seconds */
+ #define INIT_EXPECT_TIMEOUT	10	/* seconds */
+ int exp_default_parity =	TRUE;
+@@ -1618,6 +1627,76 @@
+     return newsize;
+ }
+ 
++/* returns # of bytes until we see a newline at the end or EOF.  */
++/*ARGSUSED*/
++static int
++expReadNewLine(interp,esPtr,save_flags) /* INTL */
++Tcl_Interp *interp;
++ExpState *esPtr;
++int save_flags;
++{
++    int size;
++    int exp_size;
++    int full_size;
++    int count;
++    char *str;
++
++    count = 0;
++    for (;;) {
++	exp_size = expSizeGet(esPtr);
++
++	/* When we reach the limit, we will only read one char at a
++	   time.  */
++	if (esPtr->umsize >= EXP_MATCH_STEP_LIMIT)
++	    size = TCL_UTF_MAX;
++	else
++	    size = exp_size;
++
++	if (exp_size + TCL_UTF_MAX >= esPtr->msize) {
++	    if (esPtr->umsize >= EXP_MATCH_LIMIT) {
++		expDiagLogU("WARNING: interact buffer is full. probably your program\r\n");
++		expDiagLogU("is not interactive or has a very long output line. The\r\n");
++		expDiagLogU("current limit is " EXP_MATCH_LIMIT_QUOTE ".\r\n");
++		expDiagLogU("Dumping first half of buffer in order to continue\r\n");
++		expDiagLogU("Recommend you enlarge the buffer.\r\n");
++		exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect");
++		return count;
++	    }
++	    else {
++		esPtr->umsize += EXP_MATCH_INC;
++		expAdjust(esPtr);
++	    }
++	}
++
++	full_size = esPtr->msize - (size / TCL_UTF_MAX);
++	size = Tcl_ReadChars(esPtr->channel,
++			esPtr->buffer,
++			full_size,
++			1 /* append */);
++	if (size > 0) {
++	    count += size;
++	    /* We try again if there are more to read and we haven't
++	       seen a newline at the end. */
++	    if (size == full_size) {
++		str = Tcl_GetStringFromObj(esPtr->buffer, &size);
++		if (str[size - 1] != '\n')
++		    continue;
++	    }
++	}
++	else {
++	    /* It is even trickier. We got an error from read. We have
++	       to recover from it. Let's make sure the size of
++	       buffer is correct. It can be corrupted. */
++	    str = Tcl_GetString(esPtr->buffer);
++	    Tcl_SetObjLength(esPtr->buffer, strlen(str));
++	}
++
++	break;
++    }
++
++    return count;
++}
++
+ /* returns # of bytes read or (non-positive) error of form EXP_XXX */
+ /* returns 0 for end of file */
+ /* If timeout is non-zero, set an alarm before doing the read, else assume */
+@@ -1632,6 +1711,8 @@
+ {
+     int cc = EXP_TIMEOUT;
+     int size = expSizeGet(esPtr);
++    int full_size;
++    int count;
+ 
+     if (size + TCL_UTF_MAX >= esPtr->msize) 
+ 	exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect");
+@@ -1648,11 +1729,43 @@
+     }
+ #endif
+ 
+-    
++    /* FIXME: If we ask less than what is available in the tcl buffer
++       when tcl has seen EOF, we will throw away the remaining data
++       since the next read will get EOF. Since expect is line-oriented,
++       we exand our buffer to get EOF or the next newline at the end of
++       the input buffer. I don't know if it is the right fix.  H.J. */
++    count = 0;
++    full_size = esPtr->msize - (size / TCL_UTF_MAX);
+     cc = Tcl_ReadChars(esPtr->channel,
+-	    esPtr->buffer,
+-	    esPtr->msize - (size / TCL_UTF_MAX),
+-	    1 /* append */);
++		esPtr->buffer,
++		full_size,
++		1 /* append */);
++    if (cc > 0) {
++	count += cc;
++	/* It gets very tricky. There are more to read. We will expand
++	   our buffer and get EOF or a newline at the end unless the
++	   buffer length has been changed.  */
++	if (cc == full_size) {
++	    char *str;
++	    str = Tcl_GetStringFromObj(esPtr->buffer, &size);
++	    if (str[size - 1] != '\n') {
++		if (esPtr->umsize_changed) {
++		    char buf[20];	/* big enough for 64bit int in hex.  */
++		    snprintf(buf,sizeof(buf),"0x%x", esPtr->umsize);
++		    expDiagLogU("WARNING: interact buffer is not large enough to hold\r\n");
++		    expDiagLogU("all output. probably your program is not interactive or\r\n");
++		    expDiagLogU("has a very long output line. The current limit is ");
++		    expDiagLogU(buf);
++		    expDiagLogU(".\r\n");
++		}
++		else {
++		    cc = expReadNewLine(interp,esPtr,save_flags);
++		    if (cc > 0)
++			count += cc;
++		}
++	    }
++	}
++    }
+     i_read_errno = errno;
+ 
+ #ifdef SIMPLE_EVENT
+@@ -1673,7 +1786,7 @@
+ 	}
+     }
+ #endif
+-    return cc;	
++    return count > 0 ? count : cc;
+ }
+ 
+ /*
+@@ -2746,8 +2859,14 @@
+ 	return(TCL_ERROR);
+     }
+ 
+-    if (Default) exp_default_match_max = size;
+-    else esPtr->umsize = size;
++    if (Default) {
++	exp_default_match_max = size;
++	exp_default_match_max_changed = 1;
++    }
++    else {
++	esPtr->umsize = size;
++	esPtr->umsize_changed = 1;
++    }
+ 
+     return(TCL_OK);
+ }
Index: package/develop/expect/expect.desc
===================================================================
--- package/develop/expect/expect.desc	(revision 36064)
+++ package/develop/expect/expect.desc	(working copy)
@@ -31,7 +31,7 @@
 [M] Juergen "George" Sawinski <[email protected]>
 
 [C] extra/tool extra/shell
-[F] NOPARALLEL
+[F] NOPARALLEL CROSS
 
 [L] Free-to-use
 [S] Stable
Index: package/develop/expect/expect.conf
===================================================================
--- package/develop/expect/expect.conf	(revision 36064)
+++ package/develop/expect/expect.conf	(working copy)
@@ -15,7 +15,25 @@
 et() {
     tar $taropt `match_source_file -p $1 $1`
     var_append confopt ' ' "--with-"$1"include=`pwd`/$1`pkgprefix ver $1`/{unix,generic}/"
+    if  atstage cross; then
+        var_append confopt ' ' "--with-"$1"=$root/usr/lib"
+    fi
+
 }
 
-hook_add preconf 1 "et tcl ; et tk"
-hook_add premake 2 "cp tcldbgcf.h.in tcldbgcf.h"
+hook_add preconf 1 "et tcl"
+if pkginstalled tk; then
+       hook_add preconf 2 "et tk"
+else
+        var_append confopt ' ' "--with-x=no"
+fi
+
+if atstage cross; then
+        var_append confopt ' ' "--disable-shared"
+        var_append confopt ' ' "--includedir=$root/usr/include"
+        var_append confopt ' ' "--with-tclinclude=$root/usr/include"
+        var_append makeinstopt ' ' "INSTALL_ROOT=$root"
+fi
+
+hook_add premake 3 "cp tcldbgcf.h.in tcldbgcf.h"
+
Index: package/develop/expect/expect-5.43.0-tcl_8.5.5_fix-1.patch
===================================================================
--- package/develop/expect/expect-5.43.0-tcl_8.5.5_fix-1.patch	(revision 0)
+++ package/develop/expect/expect-5.43.0-tcl_8.5.5_fix-1.patch	(revision 0)
@@ -0,0 +1,125 @@
+Submitted By: DJ Lucas <dj_AT_linuxfromscratch_DOT_org>
+Date: 2008-09-28
+Initial Package Version: 5.43
+Upstream status: Not Submitted
+Origin: LFS ticket 2126 (http://wiki.linuxfromscratch.org/lfs/ticket/2126)
+        Bryan Kadzban <[email protected]>
+Description: Removes references to functions that Tcl 8.5 no longer exposes 
+             and correct other minor build problems WRT TCL-8.5.x.
+
+diff -Naur expect-5.43-orig/Dbg.c expect-5.43/Dbg.c
+--- expect-5.43-orig/Dbg.c	2002-03-22 22:11:54.000000000 -0600
++++ expect-5.43/Dbg.c	2008-08-24 01:30:15.000000000 -0500
+@@ -9,7 +9,7 @@
+ */
+ 
+ #include <stdio.h>
+-
++#include "expect_cf.h"
+ #include "tcldbgcf.h"
+ #if 0
+ /* tclInt.h drags in stdlib.  By claiming no-stdlib, force it to drag in */
+diff -Naur expect-5.43-orig/exp_inter.c expect-5.43/exp_inter.c
+--- expect-5.43-orig/exp_inter.c	2004-08-17 21:03:00.000000000 -0500
++++ expect-5.43/exp_inter.c	2008-08-24 01:28:59.000000000 -0500
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
+ 
+ #include "tcl.h"
++#include "tclInt.h"
+ #include "string.h"
+ 
+ #include "exp_tty_in.h"
+diff -Naur expect-5.43/exp_command.c expect-5.43-patched/exp_command.c
+--- expect-5.43/exp_command.c	2004-08-20 13:18:01.000000000 -0400
++++ expect-5.43-patched/exp_command.c	2008-01-12 11:42:45.000000000 -0500
+@@ -2265,6 +2265,8 @@
+ 	/*NOTREACHED*/
+ }
+ 
++static struct exp_cmd_data cmd_data[];
++
+ /*ARGSUSED*/
+ static int
+ Exp_CloseObjCmd(clientData, interp, objc, objv)
+@@ -2311,12 +2313,23 @@
+ 	/* Historical note: we used "close"  long before there was a */
+ 	/* Tcl builtin by the same name. */
+ 
++	/* The code that registered this function as the handler for */
++	/* the "close" command stored away the old handler in the */
++	/* exp_cmd_data for the "close" command. */
++
++	struct exp_cmd_data *cmd_ptr;
+ 	Tcl_CmdInfo info;
++
++	for(cmd_ptr = &cmd_data[0]; cmd_ptr->name; cmd_ptr++) {
++	    if(strncmp(cmd_ptr->name, "close", 5) == 0)
++		break;
++	}
++
+ 	Tcl_ResetResult(interp);
+ 	if (0 == Tcl_GetCommandInfo(interp,"close",&info)) {
+ 	    info.clientData = 0;
+ 	}
+-	return(Tcl_CloseObjCmd(info.clientData,interp,objc_orig,objv_orig));
++	return(cmd_ptr->old_objProc(info.clientData,interp,objc_orig,objv_orig));
+     }
+ 
+     if (chanName) {
+@@ -2961,7 +2974,10 @@
+     /* if successful (i.e., TCL_RETURN is returned) */
+     /* modify the result, so that we will handle it specially */
+ 
+-    int result = Tcl_ReturnObjCmd(clientData,interp,objc,objv);
++    Tcl_CmdInfo info;
++    Tcl_GetCommandInfo(interp, "return", &info);
++
++    int result = info.objProc(clientData,interp,objc,objv);
+     if (result == TCL_RETURN)
+         result = EXP_TCL_RETURN;
+     return result;
+@@ -3062,8 +3078,7 @@
+ 
+ 	for (;c->name;c++) {
+ 		/* if already defined, don't redefine */
+-		if ((c->flags & EXP_REDEFINE) ||
+-		    !(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
++		if (!(Tcl_FindHashEntry(&globalNsPtr->cmdTable,c->name) ||
+ 		      Tcl_FindHashEntry(&currNsPtr->cmdTable,c->name))) {
+ 			if (c->objproc)
+ 				Tcl_CreateObjCommand(interp,c->name,
+@@ -3072,6 +3087,21 @@
+ 				Tcl_CreateCommand(interp,c->name,c->proc,
+ 						  c->data,exp_deleteProc);
+ 		}
++		else if (c->flags & EXP_REDEFINE) { /* unless the REDEFINE flag is present */
++			Tcl_CmdInfo info;
++
++			if (Tcl_GetCommandInfo(interp, c->name, &info)) {
++				c->old_proc	= info.proc;
++				c->old_objProc	= info.objProc;
++			}
++
++			if (c->objproc)
++				Tcl_CreateObjCommand(interp,c->name,
++						     c->objproc,c->data,exp_deleteObjProc);
++			else
++				Tcl_CreateCommand(interp,c->name,c->proc,
++						  c->data,exp_deleteProc);
++		}
+ 		if (!(c->name[0] == 'e' &&
+ 		      c->name[1] == 'x' &&
+ 		      c->name[2] == 'p')
+diff -Naur expect-5.43/exp_command.h expect-5.43-patched/exp_command.h
+--- expect-5.43/exp_command.h	2008-01-12 11:44:11.000000000 -0500
++++ expect-5.43-patched/exp_command.h	2008-01-12 11:26:05.000000000 -0500
+@@ -297,6 +297,8 @@
+ 	Tcl_CmdProc	*proc;
+ 	ClientData	data;
+ 	int 		flags;
++	Tcl_CmdProc	*old_proc;     /* these store the procedure for the old command, */
++	Tcl_ObjCmdProc	*old_objProc;  /* if any */
+ };
+ 
+ EXTERN void		exp_create_commands _ANSI_ARGS_((Tcl_Interp *,
Index: package/develop/apr-util/apr-util.conf
===================================================================
--- package/develop/apr-util/apr-util.conf	(revision 36064)
+++ package/develop/apr-util/apr-util.conf	(working copy)
@@ -44,8 +44,8 @@
 
 if pkginstalled bdb; then
 	var_append extraconfopt ' ' '--with-dbm=db44'
-	var_append extraconfopt ' ' \
-	           "--with-berkeley-db=`pkgprefix includedir bdb`"
+	#var_append extraconfopt ' ' "--with-berkeley-db=`pkgprefix includedir bdb`"
+	var_append extraconfopt ' ' "--with-berkeley-db=$root$( pkgprefix includedir bdb )"
 fi
 
 # fix .la files in combination with libsuff.patch
Index: package/scientific/mpfr/mpfr.conf
===================================================================
--- package/scientific/mpfr/mpfr.conf	(revision 36064)
+++ package/scientific/mpfr/mpfr.conf	(working copy)
@@ -17,3 +17,18 @@
 	var_append extraconfopt ' ' '--with-gmp-include=$root/$includedir --with-gmp-lib=$root/$libdir'
 	var_append extraconfopt ' ' '--enable-shared=no'
 fi
+if atstage cross; then
+	if  [ $arch = mips64 ]; then
+		if [ $SDECFG_MIPS64_SYSLIBS = "n32over64" ]; then
+			# It defaults to this
+			export CPPFLAGS=-mabi=n32 && var_insert GCC_WRAPPER_INSERT ' ' '-mabi=n32'
+		else
+			export CPPFLAGS=-mabi=64 && var_insert GCC_WRAPPER_INSERT ' ' '-mabi=64'
+		fi
+		export slibdir=lib && export libdir=/usr/lib
+	fi
+	var_append extraconfopt ' ' ' --with-gmp-lib=$root/$libdir'
+fi
+
+
+
Index: package/scientific/mpfr/impos_constraint-asm.patch.mips64
===================================================================
--- package/scientific/mpfr/impos_constraint-asm.patch.mips64	(revision 0)
+++ package/scientific/mpfr/impos_constraint-asm.patch.mips64	(revision 0)
@@ -0,0 +1,23 @@
+diff -ur mpfr-2.4.2/mpfr-longlong.h mpfr-2.4.2.fix/mpfr-longlong.h
+--- mpfr-2.4.2/mpfr-longlong.h	2009-11-29 21:43:08.000000000 -0500
++++ mpfr-2.4.2.fix/mpfr-longlong.h	2010-02-08 13:47:25.000000000 -0500
+@@ -1023,6 +1023,11 @@
+ #define UDIV_TIME 100
+ #endif /* __mips */
+ 
++#if 0 /*JLR 
++Get rid of this to get rid of:
++mul.c:315: error: impossible constraint in 'asm'
++in T2 Mips64 build
++*/
+ #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
+ #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+ #define umul_ppmm(w1, w0, u, v) \
+@@ -1035,6 +1040,7 @@
+ #define UMUL_TIME 20
+ #define UDIV_TIME 140
+ #endif /* __mips */
++#endif /*JLR */
+ 
+ #if defined (__ns32000__) && W_TYPE_SIZE == 32
+ #define umul_ppmm(w1, w0, u, v) \
Index: package/scientific/gmp/gmp.conf
===================================================================
--- package/scientific/gmp/gmp.conf	(revision 36064)
+++ package/scientific/gmp/gmp.conf	(working copy)
@@ -23,3 +23,15 @@
 
 # g++ not yet available at gmp priority
 atstage cross || var_append extraconfopt ' ' '--enable-cxx'
+
+if  [ $arch = mips64 ]; then
+#GMP laready takes this into account, and builds all ASBI's
+# see the configure script
+#	if [ $SDECFG_MIPS64_SYSLIBS = "pure64" ]; then
+#		atstage cross && export CPPFLAGS=-mabi=64 && var_insert GCC_WRAPPER_INSERT ' ' '-mabi=64'
+#	else
+#		# It defaults to this ?
+#		atstage cross && export CPPFLAGS=-mabi=n32 && var_insert GCC_WRAPPER_INSERT ' ' '-mabi=n32'
+#	fi
+	atstage cross && export slibdir=lib && export libdir=/usr/lib
+fi
Index: package/filesystem/e2fsprogs/u64_s64_fix.patch.mips64
===================================================================
--- package/filesystem/e2fsprogs/u64_s64_fix.patch.mips64	(revision 0)
+++ package/filesystem/e2fsprogs/u64_s64_fix.patch.mips64	(revision 0)
@@ -0,0 +1,13 @@
+diff -ur e2fsprogs-1.41.11/misc/filefrag.c e2fsprogs-1.41.11.fix/misc/filefrag.c
+--- e2fsprogs-1.41.11/misc/filefrag.c	2010-02-22 23:40:50.000000000 -0500
++++ e2fsprogs-1.41.11.fix/misc/filefrag.c	2010-03-17 12:04:05.000000000 -0400
+@@ -39,7 +39,8 @@
+ #include <sys/vfs.h>
+ #include <sys/ioctl.h>
+ #include <linux/fd.h>
+-#include <ext2fs/ext2_types.h>
++// JLR on Mips 64 cross built on a 32 bit host, this confilcts with previous defines
++//#include <ext2fs/ext2_types.h>
+ #include <ext2fs/fiemap.h>
+ 
+ int verbose = 0;
Index: package/filesystem/e2fsprogs/powerpc64.patch
===================================================================
--- package/filesystem/e2fsprogs/powerpc64.patch	(revision 36064)
+++ package/filesystem/e2fsprogs/powerpc64.patch	(working copy)
@@ -21,7 +21,7 @@
   * also defined the types that we need.
   */
 -#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
-+#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && !defined(_PPC64_TYPES_H) && \
++#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && !(defined(_PPC64_TYPES_H) || defined(_ASM_GENERIC_INT_L64_H)) && \
  	!defined(_EXT2_TYPES_H))
  #define _BLKID_TYPES_H
 
@@ -32,7 +32,7 @@
   * also defined the types that we need.
   */
 -#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
-+#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && !defined(_PPC64_TYPES_H) && \
++#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && !(defined(_PPC64_TYPES_H) || defined(_ASM_GENERIC_INT_L64_H)) && \
  	!defined(_EXT2_TYPES_H))
  #define _EXT2_TYPES_H
  
Index: package/filesystem/e2fsprogs/e2fsprogs.desc.v10
===================================================================
--- package/filesystem/e2fsprogs/e2fsprogs.desc.v10	(revision 0)
+++ package/filesystem/e2fsprogs/e2fsprogs.desc.v10	(revision 0)
@@ -0,0 +1,34 @@
+[COPY] --- T2-COPYRIGHT-NOTE-BEGIN ---
+[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+[COPY] 
+[COPY] T2 SDE: package/.../e2fsprogs/e2fsprogs.desc
+[COPY] Copyright (C) 2004 - 2010 The T2 SDE Project
+[COPY] Copyright (C) 1998 - 2004 ROCK Linux Project
+[COPY] 
+[COPY] More information can be found in the files COPYING and README.
+[COPY] 
+[COPY] This program is free software; you can redistribute it and/or modify
+[COPY] it under the terms of the GNU General Public License as published by
+[COPY] the Free Software Foundation; version 2 of the License. A copy of the
+[COPY] GNU General Public License can be found in the file COPYING.
+[COPY] --- T2-COPYRIGHT-NOTE-END ---
+
+[I] Utilities for use with the ext2 filesystem
+
+[T] The filesystem utilities for the EXT2 filesystem, including
+[T] e2fsck, mke2fs, dumpe2fs, fsck, and others.
+
+[U] http://e2fsprogs.sourceforge.net
+
+[A] Theodore T'so <[email protected]>
+[M] Rene Rebe <[email protected]>
+
+[C] base/system extra/filesystem
+[F] CROSS DIETLIBC FPIC-QUIRK
+
+[L] GPL LGPL
+[S] Stable
+[V] 1.41.10
+[P] X -1-3-----9 179.199
+
+[D] 3028093348 e2fsprogs-1.41.10.tar.gz http://dl.sourceforge.net/sourceforge/e2fsprogs/
Index: package/filesystem/e2fsprogs/e2fsprogs.conf
===================================================================
--- package/filesystem/e2fsprogs/e2fsprogs.conf	(revision 36064)
+++ package/filesystem/e2fsprogs/e2fsprogs.conf	(working copy)
@@ -24,6 +24,20 @@
 	done
 }
 
+fix_mips_64_bit() {
+	# need to set these for mips64 
+	# if cross building true 64 bit on a 32 bit build  host
+	# we take the values from: 
+	# usr/include/asm-generic/int-l64.h
+	var_append confopt " " "--config-cache"
+        cat >> ./config.cache <<-EOT
+	ac_cv_sizeof_short=2
+	ac_cv_sizeof_int=4
+	ac_cv_sizeof_long=8
+	ac_cv_sizeof_long_long=8
+	EOT
+}
+
 if [ "$SDECFG_DIETLIBC_e2fsprogs" == "1" ] ; then
 	confopt="$confopt --with-diet-libc"
 	[ "$dietlibc_dynamic_static" = "dynamic" ] &&
@@ -44,8 +58,11 @@
 var_append makeinstopt ' ' 'install-libs'
 hook_add preconf 1 'fix_pkgconfig_dir'
 
+atstage cross &&  [ "$SDECFG_MIPS64_SYSLIBS" = "pure64" ] && hook_add preconf 5 fix_mips_64_bit 
+
 if pkginstalled glibc; then
   case "`pkgprefix ver glibc`" in
 	2.3*) var_append confopt ' ' '--disable-tls'
   esac
 fi
+
Index: package/base/00-dirtree/00-dirtree.conf
===================================================================
--- package/base/00-dirtree/00-dirtree.conf	(revision 36064)
+++ package/base/00-dirtree/00-dirtree.conf	(working copy)
@@ -41,6 +41,11 @@
 			echo "m lib64"
 			echo "m usr/lib64"
 			echo "m usr/local/lib64" 
+			if  [ $arch = mips64 ]; then
+				echo "l lib32 lib"
+				echo "l usr/lib32 ./lib"
+				echo "l usr/local/lib32 ./lib/" 
+			fi
 		fi
 	)
 }
Index: package/base/gcc/gcc.conf
===================================================================
--- package/base/gcc/gcc.conf	(revision 36064)
+++ package/base/gcc/gcc.conf	(working copy)
@@ -107,12 +107,18 @@
 	var_append extraconfopt ' ' '--with-mpfr=$root --with-mpfr-lib=$root/$libdir'
 	var_append extraconfopt ' ' '--with-ppl=$root --with-cloog=$root --with-gmp=$root'
 	export LDFLAGS="-Wl,-rpath,${root}${libdir}"
+	#if  [ $arch = mips64 ]  ; then
+	#	export CFLAGS="-static-libgcc"
+	#fi
 fi
 
 if atstage cross; then
 	# historically we did not had to explicitly specifiy the target for canadian
 	# cross, since gcc-4.3 we have to:
 	var_append confopt ' ' '--target=$arch_target'
+	#if  [ $arch = mips64 ]  ; then
+	#	export CFLAGS="-static-libgcc"
+	#fi
 fi
 
 if ! atstage native; then
Index: package/base/gcc/JLR-RPATH_ENVVAR-fixup.patch
===================================================================
--- package/base/gcc/JLR-RPATH_ENVVAR-fixup.patch	(revision 0)
+++ package/base/gcc/JLR-RPATH_ENVVAR-fixup.patch	(revision 0)
@@ -0,0 +1,44 @@
+diff -u gcc-4.4.3/Makefile.in gcc-4.4.3-fix/Makefile.in
+--- gcc-4.4.3/Makefile.in	2009-04-25 00:10:29.000000000 -0400
++++ gcc-4.4.3-fix/Makefile.in	2010-03-05 16:10:33.000000000 -0500
+@@ -204,7 +204,7 @@
+ @if gcc-bootstrap
+ 	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
+ @endif gcc-bootstrap
+-	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
++	#$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
+ 
+ # Similar, for later GCC stages.
+ POSTSTAGE1_HOST_EXPORTS = \
+@@ -245,7 +245,7 @@
+ 	STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
+ 	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
+ 	WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
+-	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
++	#$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
+ 
+ RAW_CXX_TARGET_EXPORTS = \
+ 	$(BASE_TARGET_EXPORTS) \
+diff -u gcc-4.4.3/Makefile.tpl gcc-4.4.3-fix/Makefile.tpl
+--- gcc-4.4.3/Makefile.tpl	2009-04-14 04:57:33.000000000 -0400
++++ gcc-4.4.3-fix/Makefile.tpl	2010-03-05 16:01:43.000000000 -0500
+@@ -207,7 +207,7 @@
+ @if gcc-bootstrap
+ 	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
+ @endif gcc-bootstrap
+-	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
++	#$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
+ 
+ # Similar, for later GCC stages.
+ POSTSTAGE1_HOST_EXPORTS = \
+@@ -248,7 +248,7 @@
+ 	STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
+ 	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
+ 	WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
+-	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
++	#$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
+ 
+ RAW_CXX_TARGET_EXPORTS = \
+ 	$(BASE_TARGET_EXPORTS) \
+Common subdirectories: gcc-4.4.3/objdir and gcc-4.4.3-fix/objdir
+Common subdirectories: gcc-4.4.3/zlib and gcc-4.4.3-fix/zlib
Index: package/base/binutils/binutils-2.20-genscripts_multilib-1.patch
===================================================================
--- package/base/binutils/binutils-2.20-genscripts_multilib-1.patch	(revision 0)
+++ package/base/binutils/binutils-2.20-genscripts_multilib-1.patch	(revision 0)
@@ -0,0 +1,68 @@
+Submitted By: Ryan Oliver (ryan dot oliver at pha dot com dot au)
+Origin: Ryan Oliver
+Date: 2010-01-01
+Initial package version: 2.15 (problem also exists in 2.14 series)
+Description:
+        Rediffed for 2.19.1 by Jim Gifford
+        Rediffed for 2.10 by Joe Ciccone
+
+        Updated patch, use this for all binutils 2.15 series instead of the
+        binutils-2.15.90.0.1-genscripts-multilib.patch
+
+        If --with-libpath= was specified during configure (or LIB_PATH was
+        supplied during make) we want to have these libraries added to the
+        linker scripts search paths, and in the case of multi-lib have them
+        processed to provide both lib and lib64 search paths.
+        This patch produces this behaviour when building a cross-binutils.
+
+        Also to fix an annoyance we remove whatever was specified (if anything)
+        by --libdir= from the linker script search path. This is so when cross-
+        compiling a 64bit target-native biarch toolchain we can specify the
+        installation directory for binutils produced libraries to be */lib64
+        without having this directory added to the 32bit emulation search path.
+
+        By rights we should really check if ${libdir} matches a search path in
+        any of the supported emulations for this target (as opposed to only the
+        one genscripts.sh is currently processing) and if so ignore ${libpath}.
+
+        This patch differs from the preceding genscripts-multilib patch as now
+        USE_LIBPATH will always be set if LIB_PATH is non empty
+
+diff -Naur binutils-2.20.orig/ld/genscripts.sh binutils-2.20/ld/genscripts.sh
+--- binutils-2.20.orig/ld/genscripts.sh	2009-09-02 03:25:35.000000000 -0400
++++ binutils-2.20/ld/genscripts.sh	2010-01-01 12:45:50.201595087 -0500
+@@ -132,7 +132,8 @@
+ esac
+ 
+ # If the emulparams file sets NATIVE, make sure USE_LIBPATH is set also.
+-if test "x$NATIVE" = "xyes" ; then
++# Also set USE_LIBPATH if LIB_PATH has been set
++if [ "x$NATIVE" = "xyes" -o "x${LIB_PATH}" != "x" ] ; then
+   USE_LIBPATH=yes
+ fi
+ 
+@@ -147,17 +148,17 @@
+ #
+ # If the emulparams file set LIBPATH_SUFFIX, prepend an extra copy of
+ # the library path with the suffix applied.
+-
+-if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
++if [ "x${USE_LIBPATH}" = xyes ] ; then
+   LIB_PATH2=
++  if [ "x${LIB_PATH}" = "x" ] ; then 
++    libs="${NATIVE_LIB_DIRS}"
++  else
++    libs=`echo ${LIB_PATH} | sed 's/:/ /g'`
++    LIB_PATH=
++  fi
+ 
+-  libs=${NATIVE_LIB_DIRS}
+   if [ "x${use_sysroot}" != "xyes" ] ; then
+     case " ${libs} " in
+-      *" ${libdir} "*) ;;
+-      *) libs="${libdir} ${libs}" ;;
+-    esac
+-    case " ${libs} " in
+       *" ${tool_lib} "*) ;;
+       *) libs="${tool_lib} ${libs}" ;;
+     esac
Index: package/base/binutils/binutils.conf
===================================================================
--- package/base/binutils/binutils.conf	(revision 36064)
+++ package/base/binutils/binutils.conf	(working copy)
@@ -28,4 +28,14 @@
 	fi
 
 	var_append GCC_WRAPPER_REMOVE ' ' '-Werror'
+
+	if  [ $arch = mips64 ]  ; then
+		# !! JLR: not uet tested
+		# set up for 32 bit libs in lib32
+		# var_append confopt ' ' "--libdir=$root/usr/lib32" 
+		if [ "${SDECFG_MIPS64_SYSLIBS}" = n32_n64 ]; then
+			atstage toolchain && var_append confopt ' ' "--with-lib-path=/$root/usr/lib32:/$root/usr/lib64:/$root/lib" 
+		fi
+		var_append confopt ' ' "--enable-64-bit-bfd" 
+	fi
 fi
Index: package/base/glibc/glibc.conf
===================================================================
--- package/base/glibc/glibc.conf	(revision 36064)
+++ package/base/glibc/glibc.conf	(working copy)
@@ -12,6 +12,10 @@
 # GNU General Public License can be found in the file COPYING.
 # --- T2-COPYRIGHT-NOTE-END ---
 
+mips_fix_dynamic-link () {
+	sed -ie "s%\(.*-dynamic-linker=\)\(\$(slibdir)/.*\)%\1$root/$slibdir/\$(rtld-installed-name)%g  " Makeconfig
+}
+
 # overwrite prefix to not point to the tools, but the real root for the headers
 if atstage toolchain; then
 	# hack due to sane variable not available and prefix is tools prefix
@@ -40,7 +44,25 @@
 # "sysdeps/ieee754/dbl-64/s_copysign.c:27: error: redefinition of '__copysign'"
 # Tweaking libc_cv_gnu89_inline in config.cache did not help,
 [ $arch = mips64 ] && var_insert GCC_WRAPPER_INSERT ' ' '-fgnu89-inline'
+#[ $arch = mips64 ] && var_insert GCC_WRAPPER_INSERT ' ' '-Wa,-xgot'
+# JLR TBD: do this only at stage cross
+# atstage cross && [ $arch = mips64 ] && var_insert GCC_WRAPPER_INSERT ' ' "-Wl,-dynamic-linker=$root$slibdir/ld.so.1"
 
+# glibc on mips64 is very tricky, 
+# it tries to pick it's abi from the CPPFLAGS,
+# otherwise it will default to ELF-32/n32
+# we want 64 bit libs in lib64 configure needs this set 
+# (it will get removed from the tool chain gcc at line 23 above) 
+# also have to addd mabi=64 to gcc wrapper, or build will fail
+if ( [ $arch = mips64 ] && [ $pkg = glibc ] ) ; then
+	if  [ $SDECFG_MIPS64_SYSLIBS != n32over64 ]; then
+		export CPPFLAGS=-mabi=64
+		# This was done in mips64/gcc-options.in
+		#var_insert GCC_WRAPPER_INSERT ' ' '-mabi=64'
+	fi
+fi
+
+
 # does currently not inline all necessary with -Os
 # glibc-2.7/objdir/libc_pic.os: In function `faccessat': (.text+0x7bfaf): undefined reference to `fstatat64'
 GCC_WRAPPER_INSERT="${GCC_WRAPPER_INSERT//-Os/-O2}"
@@ -49,6 +71,11 @@
 var_remove GCC_WRAPPER_APPEND ' ' '-ffast-math'
 var_remove GCC_WRAPPER_INSERT ' ' '-ffast-math'
 
+# JLR
+#if ( atstage cross && [ $arch = mips64 ] ); then
+#	hook_add preconf 2  "mips_fix_dynamic-link" 
+#fi
+
 # We must use an 'objdir' directory for building glibc
 # Disable glibc internal debuging but build debuging and profile
 # code so we can use this glibc to debug other programs.
@@ -80,6 +107,7 @@
 else    
 	var_append extraconfopt " " \
 	           "--enable-add-ons=linuxthreads --without-__thread --disable-sanity-checks"
+	###JLR try removing  this ???
 	[[ $arch = mips* ]] && var_append extraconfopt " " "--without-tls"
 fi
 
Index: package/base/glibc32/glibc32.conf
===================================================================
--- package/base/glibc32/glibc32.conf	(revision 36064)
+++ package/base/glibc32/glibc32.conf	(working copy)
@@ -14,9 +14,11 @@
 
 if [[ $arch_target = *mips* ]]; then
        # -m32 option is not a  legal option for mips
-       var_remove GCC_WRAPPER_INSERT  ' ' '-m32'
+       var_remove GCC_WRAPPER_INSERT ' ' '-m32'
        # force 32 bit code
-       var_insert GCC_WRAPPER_INSERT " " "-mabi=32"
+       var_remove GCC_WRAPPER_INSERT ' ' '-mabi=64'
+       var_insert GCC_WRAPPER_INSERT ' ' '-mabi=32'
+       export CPPFLAGS=-mabi=n32 
        # not sure if these help or not
        #var_insert GCC_WRAPPER_INSERT " " "-mlong32"
        #var_insert GCC_WRAPPER_INSERT " " "-mgp32"
@@ -25,10 +27,25 @@
        var_insert GCC_WRAPPER_INSERT " " "-m32"
 fi
 
-arch_target="`echo $arch_target | arch2arch32`"
-echo_status "Set arch_target to $arch_target ..."
-set_confopt
+# on Mips64  we get errors when we do arch2arch:
+#./ports/sysdeps/mips/memcpy.S: Assembler messages:
+#../ports/sysdeps/mips/memcpy.S:68: Error: illegal operands `lw t4,16($5)'
+#../ports/sysdeps/mips/memcpy.S:69: Error: illegal operands `lw t5,20($5)'
 
+if [[ $arch_target != *mips* ]]; then
+	arch_target="`echo $arch_target | arch2arch32`"
+	echo_status "Set arch_target to $arch_target ..."
+	echo "Set arch_target to $arch_target ..."
+	set_confopt
+	libdir=${libdir%64}
+	slibdir=lib
+else
+	# Mips64 will get a n32 abi build into lib32
+	libdir=${libdir%64}32
+	slibdir=lib32
+	echo "Set up for mips64: libdir: $libdir slibdir: $slibdir"
+fi
+
 # force minimal optimization due TLS
 [ "$SDECFG_X8664_OPT" = "generic" ] && var_append GCC_WRAPPER_INSERT " " "-march=i686"
 
@@ -50,8 +67,6 @@
 var_remove makeinstopt ' ' 'install'
 var_append makeinstopt ' ' 'install-lib-all'
 
-libdir=${libdir%64}
-slibdir=lib
 
 # glibc installs some headers it should not
 var_append INSTALL_WRAPPER_FILTER "|" "sed -e 's,.*usr/include/.*\.h,/tmp/weg.h,'"
@@ -60,6 +75,13 @@
 
 glibc_postmake()
 {
+	#if [[ $arch_target = *mips* ]]; then
+	#	# Mips64 will get a n32 abi build into lib32
+	#	libdir=${libdir%64}32
+	#	slibdir=lib32
+	#	echo "Set up for mips64: libdir: $libdir slibdir: $slibdir"
+	#fi
+
 	# No wrong absolute path in libc.so
 	# Obsolete? -ReneR
 	#
Index: package/base/dietlibc/dietlibc.conf
===================================================================
--- package/base/dietlibc/dietlibc.conf	(revision 36064)
+++ package/base/dietlibc/dietlibc.conf	(working copy)
@@ -29,6 +29,9 @@
 	if atstage cross || [ "$toolsdir" == tools.cross ] ; then
 		mkdir -p bin-$cpu bin-$hostcpu
 		ln -s bin-$cpu "bin-${CC%%-*}"
+		# Hardcode for Mips64
+		# should also do for MipsEl
+		ln -s mips mips64
 	fi
 }
 
Index: package/base/tcl/tcl.desc
===================================================================
--- package/base/tcl/tcl.desc	(revision 36064)
+++ package/base/tcl/tcl.desc	(working copy)
@@ -26,9 +26,10 @@
 
 [C] extra/development extra/tool extra/shell
 
+[F] CROSS
 [L] OpenSource
 [S] Stable
 [V] 8.5.8
-[P] X -----5---9 119.000
+[P] X01----5---9 119.000
 
 [D] 626910321 tcl8.5.8-src.tar.gz http://dl.sourceforge.net/sourceforge/tcl/
Index: package/base/tcl/2819200.patch
===================================================================
--- package/base/tcl/2819200.patch	(revision 0)
+++ package/base/tcl/2819200.patch	(revision 0)
@@ -0,0 +1,25 @@
+diff -ur tcl8.5.8/generic/tclStrToD.c tcl8.5.8-fix/generic/tclStrToD.c
+--- tcl8.5.8/generic/tclStrToD.c	2009-07-16 16:50:54.000000000 -0400
++++ tcl8.5.8-fix/generic/tclStrToD.c	2010-03-05 19:03:03.000000000 -0500
+@@ -71,9 +71,10 @@
+ 
+ /*
+  * MIPS floating-point units need special settings in control registers
+- * to use gradual underflow as we expect.
++ * to use gradual underflow as we expect.  This fix is for the MIPSpro
++ * compiler.  
+  */
+-#if defined(__mips)
++#if defined(__sgi) && defined(_COMPILER_VERSION)
+ #include <sys/fpu.h>
+ #endif
+ /*
+@@ -2166,7 +2167,7 @@
+     } bitwhack;
+ #endif
+ 
+-#if defined(__mips)
++#if defined(__sgi) && defined(_COMPILER_VERSION)
+     union fpc_csr mipsCR;
+ 
+     mipsCR.fc_word = get_fpc_csr();
Index: package/base/tcl/tcl.conf
===================================================================
--- package/base/tcl/tcl.conf	(revision 36064)
+++ package/base/tcl/tcl.conf	(working copy)
@@ -17,9 +17,25 @@
     mm=`echo $ver | cut -d . -f 1-2`
     ln -vsf $bindir/tclsh$mm $root/$bindir/tclsh
     ln -vsf $libdir/libtcl$mm.so $root/$libdir/libtcl.so
-    install -m 644 ../generic/tcl{Int,IntDecls,Port,IntPlatDecls}.h $includedir
-    install -m 644 ../unix/tclUnixPort.h $includedir
+
+    #JLR ? do we need seperate include paths for cross & non cross builds?
+    # or can $root$includedir work for native builds too?
+    if atstage native; then
+       install -m 644 ../generic/tcl{Int,IntDecls,Port,IntPlatDecls}.h $includedir
+       install -m 644 ../unix/tclUnixPort.h $includedir
+    else
+       install -m 644 ../generic/tcl{Int,IntDecls,Port,IntPlatDecls}.h $root$includedir
+       install -m 644 ../unix/tclUnixPort.h $root$includedir
+    fi
 }
 
+strtod_fix () {
+	export ac_cv_func_strtod=yes
+	export tcl_cv_strtod_buggy=1
+}
+
 hook_add preconf 3 "cd unix"
+if ! atstage native; then
+	 hook_add preconf 4 strtod_fix
+fi
 hook_add postmake 5 ptcl
Index: package/base/tcl/cross-install.patch
===================================================================
--- package/base/tcl/cross-install.patch	(revision 0)
+++ package/base/tcl/cross-install.patch	(revision 0)
@@ -0,0 +1,12 @@
+diff -ur tcl8.5.8/unix/Makefile.in tcl8.5.8.fix/unix/Makefile.in
+--- tcl8.5.8/unix/Makefile.in	2009-11-13 13:38:45.000000000 -0500
++++ tcl8.5.8.fix/unix/Makefile.in	2010-03-17 15:39:27.000000000 -0400
+@@ -824,7 +824,7 @@
+ 	@echo "Installing message catalogs"
+ 	@@ld_library_path_...@="`pwd`:$...@ld_library_path_var@}"; export @LD_LIBRARY_PATH_VAR@; \
+ 	TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
+-	./tclsh $(TOOL_DIR)/installData.tcl \
++	$(TCL_EXE) $(TOOL_DIR)/installData.tcl \
+ 	    $(TOP_DIR)/library/msgs "$(SCRIPT_INSTALL_DIR)"/msgs
+ 
+ install-doc: doc
----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[email protected] with a subject of: unsubscribe t2

Reply via email to