Subject: Re: Cross-compiler building success?
To: None <port-newsmips@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-newsmips
Date: 10/08/1999 22:00:43
In <199910071139.UAA18024@mirage.ceres.dti.ne.jp>
I wrote:

> I'm working on a cross-mipseb-netbsd-1.3.0.0 package.
> Now every binary seems woking, so I'll make patches
> in this weekend.

I've just made the patch. It is tested on NetBSD/i386 1.4K
with 19991006 pkgsrc tree, but may work on 1.4R based systems.

Apply the attached patch in pkgsrc/cross directory and
just "make install" in "mipseb-netbsd" directory.

There are some cross compile tips in NetBSD/bebox pages:
http://www.netbsd.org/Ports/bebox/cross.html
The cross make script in this page could be used for newsmips
with some changes.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp


--- binutils/Makefile.orig	Thu Oct  7 20:45:31 1999
+++ binutils/Makefile	Thu Oct  7 20:45:34 1999
@@ -29,7 +29,7 @@
 			i386-cygwin32 i386-elf i386-go32 i386-linux \
 			i386-netbsd i386-netware \
 			m68k-elf m68k-netbsd m68k-sunos4 \
-			mips-dec-netbsd \
+			mips-dec-netbsd mipseb-netbsd \
 			powerpc-eabi powerpcle-eabi \
 			sparc-netbsd sparc-solaris2 sparc-sunos4
 
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ binutils/patches/patch-al	Thu Oct  7 20:35:30 1999
@@ -0,0 +1,30 @@
+--- config.sub.orig	Thu Oct  7 01:50:14 1999
++++ config.sub	Thu Oct  7 01:50:32 1999
+@@ -177,7 +177,7 @@
+ 		| alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \
+ 		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ 		| 1750a | dsp16xx | pdp11 \
+-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
++		| mips64 | mipsel | mipseb | mips64el | mips64orion | mips64orionel \
+ 		| mipstx39 | mipstx39el \
+ 		| sparc | sparclet | sparclite | sparc64 | v850)
+ 		basic_machine=$basic_machine-unknown
+@@ -230,7 +230,7 @@
+ 	      | alphaev6-* | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \
+ 	      | xps100-* | clipper-* | orion-* \
+ 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+-	      | sparc64-* | mips64-* | mipsel-* \
++	      | sparc64-* | mips64-* | mipsel-* | mipseb-* \
+ 	      | mips64el-* | mips64orion-* | mips64orionel-* \
+ 	      | mipstx39-* | mipstx39el-* \
+ 	      | f301-*)
+--- ld/configure.tgt.orig	Thu Oct  7 01:51:22 1999
++++ ld/configure.tgt	Thu Oct  7 01:55:30 1999
+@@ -148,6 +148,7 @@
+ mips*-*-ecoff*)		targ_emul=mipsidt ;;
+ mips*-dec-bsd*)		targ_emul=mipsbsd ;;
+ mips*-dec-netbsd*)	targ_emul=elf32lmip ;;
++mips*eb-*-netbsd*)	targ_emul=elf32ebmip ;;
+ mips*-*-bsd*)		targ_emul=mipsbig ;;
+ mips*vr4300el-*-elf*)	targ_emul=elf32l4300 ;;
+ mips*vr4300-*-elf*)	targ_emul=elf32b4300 ;;
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ COMMON/patches-binutils/patch-ac	Thu Oct  7 02:05:25 1999
@@ -0,0 +1,40 @@
+--- gas/configure.orig	Wed Oct  6 22:59:40 1999
++++ gas/configure	Wed Oct  6 23:00:37 1999
+@@ -1545,6 +1545,7 @@
+ 
+       # don't change em like *-*-bsd does
+       mips-dec-netbsd*)	    fmt=elf endian=little ;;
++      mips-*-netbsd*)       fmt=elf ;;
+       mips-dec-openbsd*)    fmt=elf endian=little ;;
+       mips-dec-bsd*)        fmt=aout ;;
+       mips-sony-bsd*)       fmt=ecoff ;;
+--- config.sub.orig	Thu Oct  7 01:50:14 1999
++++ config.sub	Thu Oct  7 01:50:32 1999
+@@ -177,7 +177,7 @@
+ 		| alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \
+ 		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ 		| 1750a | dsp16xx | pdp11 \
+-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
++		| mips64 | mipsel | mipseb | mips64el | mips64orion | mips64orionel \
+ 		| mipstx39 | mipstx39el \
+ 		| sparc | sparclet | sparclite | sparc64 | v850)
+ 		basic_machine=$basic_machine-unknown
+@@ -230,7 +230,7 @@
+ 	      | alphaev6-* | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \
+ 	      | xps100-* | clipper-* | orion-* \
+ 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+-	      | sparc64-* | mips64-* | mipsel-* \
++	      | sparc64-* | mips64-* | mipsel-* | mipseb-* \
+ 	      | mips64el-* | mips64orion-* | mips64orionel-* \
+ 	      | mipstx39-* | mipstx39el-* \
+ 	      | f301-*)
+--- ld/configure.tgt.orig	Thu Oct  7 01:51:22 1999
++++ ld/configure.tgt	Thu Oct  7 01:55:30 1999
+@@ -148,6 +148,7 @@
+ mips*-*-ecoff*)		targ_emul=mipsidt ;;
+ mips*-dec-bsd*)		targ_emul=mipsbsd ;;
+ mips*-dec-netbsd*)	targ_emul=elf32lmip ;;
++mips*eb-*-netbsd*)	targ_emul=elf32ebmip ;;
+ mips*-*-bsd*)		targ_emul=mipsbig ;;
+ mips*vr4300el-*-elf*)	targ_emul=elf32l4300 ;;
+ mips*vr4300-*-elf*)	targ_emul=elf32b4300 ;;
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ COMMON/patches-egcs/patch-ah	Wed Oct  6 23:16:53 1999
@@ -0,0 +1,21 @@
+--- config.sub.orig	Wed Oct  6 22:53:14 1999
++++ config.sub	Wed Oct  6 22:53:33 1999
+@@ -165,7 +165,7 @@
+ 		| alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \
+ 		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ 		| 1750a | dsp16xx | pdp11 \
+-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
++		| mips64 | mipsel | mipseb | mips64el | mips64orion | mips64orionel \
+ 		| mipstx39 | mipstx39el \
+ 		| sparc | sparclet | sparclite | sparc64 | v850)
+ 		basic_machine=$basic_machine-unknown
+@@ -212,7 +212,7 @@
+ 	      | alphaev6-* | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \
+ 	      | xps100-* | clipper-* | orion-* \
+ 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+-	      | sparc64-* | mips64-* | mipsel-* \
++	      | sparc64-* | mips64-* | mipsel-* | mipseb-* \
+ 	      | mips64el-* | mips64orion-* | mips64orionel-* \
+ 	      | mipstx39-* | mipstx39el-* \
+ 	      | f301-*)
+ 
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/Makefile	Wed Oct  6 23:34:58 1999
@@ -0,0 +1,20 @@
+# $NetBSD: Makefile,v 1.1.1.1 1999/02/03 13:00:43 tv Exp $
+#
+
+DISTVERSION=		1.3.0.0
+DISTFILES=		# none
+
+MAINTAINER=		packages@netbsd.org
+HOMEPAGE=		http://www.netbsd.org/
+
+WRKSRC=			${WRKDIR}/${EGCS_DISTNAME}
+
+USE_CROSS_BINUTILS=	yes
+BINUTILS_GNUTARGET=	elf32-bigmips
+BINUTILS_LDEMULATION=	elf32ebmip
+USE_CROSS_EGCS=		yes
+EGCS_FAKE_RUNTIME=	yes
+
+TARGET_ARCH=		mipseb-netbsd
+
+.include "../COMMON/cross.mk"
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/files/md5	Wed Oct  6 22:22:28 1999
@@ -0,0 +1,5 @@
+$NetBSD: md5,v 1.1.1.1 1999/02/03 13:00:43 tv Exp $
+
+MD5 (binutils-2.9.1.tar.gz) = 8f9ad1a6e96742fd3069479171a63c22
+MD5 (egcs-1.1.1.tar.gz) = 0b3f0e856dcbb2241c183081fc7271af
+MD5 (egcs-1.1.1-NetBSD-19980104.diff.gz) = 8c4d952d999ead62f6604948c65c2454
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/patches/patch-aa	Thu Oct  7 02:18:33 1999
@@ -0,0 +1,56 @@
+--- gcc/config/mips/netbsd.h.orig	Wed Oct  6 22:55:48 1999
++++ gcc/config/mips/netbsd.h	Wed Oct  6 22:56:24 1999
+@@ -20,7 +20,7 @@
+ 
+ /* Define default target values. */
+ 
+-#define TARGET_ENDIAN_DEFAULT 0
++#define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN
+ #define TARGET_DEFAULT MASK_GAS
+ 
+ /* Get generic mips ELF definitions. */
+@@ -41,7 +41,7 @@
+ 
+ #undef CPP_PREDEFINES
+ #define CPP_PREDEFINES \
+- "-D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD \
++ "-D__ANSI_COMPAT -DMIPSEB -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD \
+   -D__NetBSD__ -D__ELF__ -Dmips -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
+   -D_R3000 -Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
+ 
+--- gcc/config.sub.orig	Thu Oct  7 02:05:50 1999
++++ gcc/config.sub	Thu Oct  7 02:06:14 1999
+@@ -154,7 +154,7 @@
+ 		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ 		| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+ 		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
++		| mips64 | mipsel | mipseb | mips64el | mips64orion | mips64orionel \
+ 		| mipstx39 | mipstx39el \
+ 		| sparc | sparclet | sparclite | sparc64 | v850)
+ 		basic_machine=$basic_machine-unknown
+@@ -182,7 +182,7 @@
+ 	      | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+ 	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+ 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+-	      | sparc64-* | mips64-* | mipsel-* \
++	      | sparc64-* | mips64-* | mipsel-* | mipseb-* \
+ 	      | mips64el-* | mips64orion-* | mips64orionel-*  \
+ 	      | mipstx39-* | mipstx39el-* \
+ 	      | f301-*)
+--- gcc/configure.orig	Thu Oct  7 02:14:18 1999
++++ gcc/configure	Thu Oct  7 02:14:22 1999
+@@ -3866,6 +3866,13 @@
+ 		fixincludes=fixinc.wrap
+ 		tmake_file=t-netbsd
+ 		;;
++	mipseb-*-netbsd*)
++		tm_file=mips/netbsd.h
++		xm_file=mips/xm-netbsd.h
++		# On NetBSD, the headers are already okay, except for math.h.
++		fixincludes=fixinc.wrap
++		tmake_file=t-netbsd
++		;;
+ 	mips-sony-bsd* | mips-sony-newsos*)	# Sony NEWS 3600 or risc/news.
+ 		tm_file="mips/news4.h ${tm_file}"
+ 		if [ x$stabs = xyes ]; then
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/pkg/COMMENT	Thu Oct  7 20:32:44 1999
@@ -0,0 +1 @@
+Cross-compile environment for NetBSD/mipseb
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/pkg/DESCR	Thu Oct  7 20:32:58 1999
@@ -0,0 +1 @@
+This cross-compile environment is for NetBSD/mipseb.
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/pkg/MESSAGE	Thu Oct  7 20:33:25 1999
@@ -0,0 +1,12 @@
+=============================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 1999/02/03 13:00:43 tv Exp $
+
+This pkg DOES NOT install headers or runtime link libraries.  Only the
+compilers are installed.
+
+In order to have a complete development setup, you need to install
+includes and libraries in ${CROSSBASE}/mipseb-netbsd/include and
+${CROSSBASE}/mipseb-netbsd/lib respectively, or symlink these paths to
+the appropriate places.
+
+=============================================================================
--- /dev/null	Thu Oct  7 13:08:36 1999
+++ mipseb-netbsd/pkg/PLIST	Wed Oct  6 22:22:27 1999
@@ -0,0 +1 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 1999/02/03 13:00:43 tv Exp $