Subject: xx
To: None <port-mips@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: port-mips
Date: 12/09/2002 12:16:29
Folks,

At the moment we have problems building kernels with platforms that can
run either-endian (evbmips, sbmips).  The current method for selecting
the endianness of a kernel is to uncomment the right include in the
kernel config file to pick up an include file with either

	makeoptions     MACHINE_ARCH="mipseb"
or
	makeoptions     MACHINE_ARCH="mipsel"

I'd like to commit the following patch that removes all these
MACHINE_ARCH settings and just relies on the endianness of the
current toolchain to do the right thing.  For most MIPS ports, it's
just the above line that gets removed.  For evbmips and sbmips, the
std.<foo>.{eb,el} files get removed and the std.<foo>.common gets
renamed to std.<foo>.

With this change, I can now just run "nbmake-sbmips-eb" to build a
big-endian kernel and "nbmake-sbmips-el" to build a little-endian kernel
without having to edit any files.

A further change related to this I'd like to investigate is to _not_
have a default MACHINE_ARCH in build.sh for the bi-endian capable ports,
and force the user to use the "-a mipse{b,l}" option.  Comments on this?


Index: mips/conf/Makefile.mips
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mips/conf/Makefile.mips,v
retrieving revision 1.31
diff -d -p -u -w -r1.31 Makefile.mips
--- mips/conf/Makefile.mips	2002/11/09 20:34:26	1.31
+++ mips/conf/Makefile.mips	2002/12/09 01:00:19
@@ -24,15 +24,6 @@ NEED_OWN_INSTALL_TARGET?=no
 ##
 ## (1) port identification
 ##
-.if ${MACHINE_ARCH} == "mipsel"
-ENDIAN=-EL
-.elif ${MACHINE_ARCH} == "mipseb"
-ENDIAN=-EB
-.else
-.BEGIN:
-	@echo "MACHINE_ARCH ${MACHINE_ARCH} is invalid"
-	@false
-.endif
 .ifndef S
 S=		../../../..
 .endif
@@ -47,8 +38,8 @@ GENASSYM=	${MIPS}/mips/genassym.cf
 CPPFLAGS+=	-D${MACHINE}
 DEFGP?=		-G 0
 GP?=		${DEFGP}
-CFLAGS+=	${ENDIAN} ${GP} -mno-abicalls -msoft-float
-AFLAGS+=	${ENDIAN} -mno-abicalls -x assembler-with-cpp -traditional-cpp
+CFLAGS+=	${GP} -mno-abicalls -msoft-float
+AFLAGS+=	-mno-abicalls -x assembler-with-cpp -traditional-cpp
 
 ##
 ## (3) libkern and compat
@@ -74,12 +65,7 @@ TEXTADDR?=	${DEFTEXTADDR}
 KERNLDSCRIPT?=	${MIPS}/conf/kern.ldscript
 # some mips ports specify a "magic" format
 LINKFORMAT+=	-T ${KERNLDSCRIPT}
-EXTRA_LINKFLAGS=	${ENDIAN} ${GP}
-.if (${ENDIAN} == "-EB")
-EXTRA_LINKFLAGS+=	--oformat elf32-bigmips
-.else
-EXTRA_LINKFLAGS+=	--oformat elf32-littlemips
-.endif
+EXTRA_LINKFLAGS=	${GP}
 LINKFLAGS_NORMAL=	-x
 STRIPFLAGS=	-g -X -x
 

Simon.
--
Simon Burge                                   <simonb@wasabisystems.com>
NetBSD Development, Support and Service:   http://www.wasabisystems.com/