Subject: Bi-endian platforms and build.sh
To: None <tech-toolchain@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-toolchain
Date: 12/11/2002 13:11:21
Folks,
The following patch makes it mandatory to specify a -a option
(MACHINE_ARCH) for ports that can be used in either big- or
little-endian. These are currently evbmips and sbmips, but I
suspect evbsh5 (and maybe evbsh3?) may also be added to the
list.
For these ports, the nbmake wrapper script will have an "-eb"
or "-el" suffix. For example
./build.sh -m evbmips -a mipsel -b
will generate a $TOOLDIR/bin/nbmake-evbmips-el.
Comments?
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD Development, Support and Service: http://www.wasabisystems.com/
Index: build.sh
===================================================================
RCS file: /cvsroot/basesrc/build.sh,v
retrieving revision 1.72
diff -d -p -u -r1.72 build.sh
--- build.sh 2002/11/17 12:59:37 1.72
+++ build.sh 2002/12/11 02:00:58
@@ -44,10 +44,14 @@ getarch () {
amiga|atari|cesfic|hp300|sun3|*68k)
MACHINE_ARCH=m68k;;
- mipsco|newsmips|sbmips|sgimips)
+ evbmips|sbmips)
+ bi_endian=true
+ MACHINE_ARCH=mips;;
+
+ mipsco|newsmips|sgimips)
MACHINE_ARCH=mipseb;;
- algor|arc|cobalt|evbmips|hpcmips|playstation2|pmax)
+ algor|arc|cobalt|hpcmips|playstation2|pmax)
MACHINE_ARCH=mipsel;;
pc532)
@@ -78,7 +82,7 @@ getarch () {
validatearch () {
# Ensure that the MACHINE_ARCH exists (and is supported by build.sh).
case $MACHINE_ARCH in
- alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|ns32k|powerpc|sh[35]e[bl]|sparc|sparc64|vax|x86_64)
+ alpha|arm|armeb|hppa|i386|m68000|m68k|mips|mipse[bl]|ns32k|powerpc|sh[35]e[bl]|sparc|sparc64|vax|x86_64)
;;
*) bomb "unknown target MACHINE_ARCH: $MACHINE_ARCH";;
@@ -136,6 +140,7 @@ _usage_
# Set defaults.
MAKEFLAGS=
+bi_endian=false
buildtarget=build
do_buildsystem=true
do_buildkernel=false
@@ -144,6 +149,7 @@ do_rebuildmake=false
do_removedirs=false
makeenv=
makewrapper=
+makewrapper_suffix=
opt_a=no
opts='a:B:bdhj:k:m:nortuw:D:M:O:R:T:U'
runcmd=
@@ -230,6 +236,22 @@ while eval $getoptcmd; do case $opt in
-'?'|-h) usage;;
esac; done
+# Check that MACHINE_ARCH is set correctly for bi-endian machines.
+if $bi_endian; then
+ case $MACHINE_ARCH in
+ mips)
+ echo "MACHINE_ARCH must be set, or -a must be used, for $MACHINE."
+ echo ""; usage
+ ;;
+ esac
+ case $MACHINE_ARCH in
+ *el)
+ makewrapper_suffix=-el;;
+ *eb)
+ makewrapper_suffix=-eb;;
+ esac
+fi
+
# Set up MACHINE*. On a NetBSD host, these are allowed to be unset.
if [ -z "$MACHINE" ]; then
if [ "`uname -s 2>/dev/null`" != "NetBSD" ]; then
@@ -392,7 +414,7 @@ fi
# Build a nbmake wrapper script, usable by hand as well as by build.sh.
if [ -z "$makewrapper" ]; then
- makewrapper="$TOOLDIR/bin/nbmake-$MACHINE"
+ makewrapper="$TOOLDIR/bin/nbmake-$MACHINE$makewrapper_suffix"
if [ ! -z "$BUILDID" ]; then
makewrapper="$makewrapper-$BUILDID"
fi