version 1.251, 2011/10/17 16:22:12 |
version 1.251.2.5, 2014/05/22 13:23:26 |
Line 263 progname=${0##*/} |
|
Line 263 progname=${0##*/} |
|
toppid=$$ |
toppid=$$ |
results=/dev/null |
results=/dev/null |
tab=' ' |
tab=' ' |
|
nl=' |
|
' |
trap "exit 1" 1 2 3 15 |
trap "exit 1" 1 2 3 15 |
|
|
bomb() |
bomb() |
|
|
unsetmakeenv INFODIR |
unsetmakeenv INFODIR |
unsetmakeenv LESSCHARSET |
unsetmakeenv LESSCHARSET |
unsetmakeenv MAKEFLAGS |
unsetmakeenv MAKEFLAGS |
|
unsetmakeenv TERMINFO |
setmakeenv LC_ALL C |
setmakeenv LC_ALL C |
|
|
# Find information about the build platform. This should be |
# Find information about the build platform. This should be |
|
|
do_syspkgs=false |
do_syspkgs=false |
do_iso_image=false |
do_iso_image=false |
do_iso_image_source=false |
do_iso_image_source=false |
|
do_live_image=false |
|
do_install_image=false |
|
do_disk_image=false |
do_params=false |
do_params=false |
do_rump=false |
do_rump=false |
|
|
|
|
|
|
} |
} |
|
|
|
# valid_MACHINE_ARCH -- A multi-line string, listing all valid |
|
# MACHINE/MACHINE_ARCH pairs. |
|
# |
|
# Each line contains a MACHINE and MACHINE_ARCH value, an optional ALIAS |
|
# which may be used to refer to the MACHINE/MACHINE_ARCH pair, and an |
|
# optional DEFAULT or NO_DEFAULT keyword. |
|
# |
|
# When a MACHINE corresponds to multiple possible values of |
|
# MACHINE_ARCH, then this table should list all allowed combinations. |
|
# If the MACHINE is associated with a default MACHINE_ARCH (to be |
|
# used when the user specifies the MACHINE but fails to specify the |
|
# MACHINE_ARCH), then one of the lines should have the "DEFAULT" |
|
# keyword. If there is no default MACHINE_ARCH for a particular |
|
# MACHINE, then there should be a line with the "NO_DEFAULT" keyword, |
|
# and with a blank MACHINE_ARCH. |
|
# |
|
valid_MACHINE_ARCH=' |
|
MACHINE=acorn26 MACHINE_ARCH=arm |
|
MACHINE=acorn32 MACHINE_ARCH=arm |
|
MACHINE=algor MACHINE_ARCH=mips64el ALIAS=algor64 |
|
MACHINE=algor MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=alpha MACHINE_ARCH=alpha |
|
MACHINE=amd64 MACHINE_ARCH=x86_64 |
|
MACHINE=amiga MACHINE_ARCH=m68k |
|
MACHINE=amigappc MACHINE_ARCH=powerpc |
|
MACHINE=arc MACHINE_ARCH=mips64el ALIAS=arc64 |
|
MACHINE=arc MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=atari MACHINE_ARCH=m68k |
|
MACHINE=bebox MACHINE_ARCH=powerpc |
|
MACHINE=cats MACHINE_ARCH=arm DEFAULT |
|
MACHINE=cats MACHINE_ARCH=earmv4 ALIAS=ecats |
|
MACHINE=cesfic MACHINE_ARCH=m68k |
|
MACHINE=cobalt MACHINE_ARCH=mips64el ALIAS=cobalt64 |
|
MACHINE=cobalt MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=dreamcast MACHINE_ARCH=sh3el |
|
MACHINE=emips MACHINE_ARCH=mipseb |
|
MACHINE=epoc32 MACHINE_ARCH=arm |
|
MACHINE=evbarm MACHINE_ARCH=arm ALIAS=evbarm-el DEFAULT |
|
MACHINE=evbarm MACHINE_ARCH=armeb ALIAS=evbarm-eb |
|
MACHINE=evbarm MACHINE_ARCH=earm ALIAS=evbearm-el |
|
MACHINE=evbarm MACHINE_ARCH=earmeb ALIAS=evbearm-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmhf ALIAS=evbearmhf-el |
|
MACHINE=evbarm MACHINE_ARCH=earmhfeb ALIAS=evbearmhf-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmv4 ALIAS=evbearmv4-el |
|
MACHINE=evbarm MACHINE_ARCH=earmv4eb ALIAS=evbearmv4-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmv5 ALIAS=evbearmv5-el |
|
MACHINE=evbarm MACHINE_ARCH=earmv5eb ALIAS=evbearmv5-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmv6 ALIAS=evbearmv6-el |
|
MACHINE=evbarm MACHINE_ARCH=earmv6hf ALIAS=evbearmv6hf-el |
|
MACHINE=evbarm MACHINE_ARCH=earmv6eb ALIAS=evbearmv6-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmv6hfeb ALIAS=evbearmv6hf-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmv7 ALIAS=evbearmv7-el |
|
MACHINE=evbarm MACHINE_ARCH=earmv7eb ALIAS=evbearmv7-eb |
|
MACHINE=evbarm MACHINE_ARCH=earmv7hf ALIAS=evbearmv7hf-el |
|
MACHINE=evbarm MACHINE_ARCH=earmv7hfeb ALIAS=evbearmv7hf-eb |
|
MACHINE=evbcf MACHINE_ARCH=coldfire |
|
MACHINE=evbmips MACHINE_ARCH= NO_DEFAULT |
|
MACHINE=evbmips MACHINE_ARCH=mips64eb ALIAS=evbmips64-eb |
|
MACHINE=evbmips MACHINE_ARCH=mips64el ALIAS=evbmips64-el |
|
MACHINE=evbmips MACHINE_ARCH=mipseb ALIAS=evbmips-eb |
|
MACHINE=evbmips MACHINE_ARCH=mipsel ALIAS=evbmips-el |
|
MACHINE=evbppc MACHINE_ARCH=powerpc DEFAULT |
|
MACHINE=evbppc MACHINE_ARCH=powerpc64 ALIAS=evbppc64 |
|
MACHINE=evbsh3 MACHINE_ARCH= NO_DEFAULT |
|
MACHINE=evbsh3 MACHINE_ARCH=sh3eb ALIAS=evbsh3-eb |
|
MACHINE=evbsh3 MACHINE_ARCH=sh3el ALIAS=evbsh3-el |
|
MACHINE=ews4800mips MACHINE_ARCH=mipseb |
|
MACHINE=hp300 MACHINE_ARCH=m68k |
|
MACHINE=hppa MACHINE_ARCH=hppa |
|
MACHINE=hpcarm MACHINE_ARCH=arm DEFAULT |
|
MACHINE=hpcarm MACHINE_ARCH=earm ALIAS=hpcearm |
|
MACHINE=hpcmips MACHINE_ARCH=mipsel |
|
MACHINE=hpcsh MACHINE_ARCH=sh3el |
|
MACHINE=i386 MACHINE_ARCH=i386 |
|
MACHINE=ia64 MACHINE_ARCH=ia64 |
|
MACHINE=ibmnws MACHINE_ARCH=powerpc |
|
MACHINE=iyonix MACHINE_ARCH=arm DEFAULT |
|
MACHINE=iyonix MACHINE_ARCH=earm ALIAS=eiyonix |
|
MACHINE=landisk MACHINE_ARCH=sh3el |
|
MACHINE=luna68k MACHINE_ARCH=m68k |
|
MACHINE=mac68k MACHINE_ARCH=m68k |
|
MACHINE=macppc MACHINE_ARCH=powerpc DEFAULT |
|
MACHINE=macppc MACHINE_ARCH=powerpc64 ALIAS=macppc64 |
|
MACHINE=mipsco MACHINE_ARCH=mipseb |
|
MACHINE=mmeye MACHINE_ARCH=sh3eb |
|
MACHINE=mvme68k MACHINE_ARCH=m68k |
|
MACHINE=mvmeppc MACHINE_ARCH=powerpc |
|
MACHINE=netwinder MACHINE_ARCH=arm DEFAULT |
|
MACHINE=netwinder MACHINE_ARCH=earmv4 ALIAS=enetwinder |
|
MACHINE=news68k MACHINE_ARCH=m68k |
|
MACHINE=newsmips MACHINE_ARCH=mipseb |
|
MACHINE=next68k MACHINE_ARCH=m68k |
|
MACHINE=ofppc MACHINE_ARCH=powerpc DEFAULT |
|
MACHINE=ofppc MACHINE_ARCH=powerpc64 ALIAS=ofppc64 |
|
MACHINE=playstation2 MACHINE_ARCH=mipsel |
|
MACHINE=pmax MACHINE_ARCH=mips64el ALIAS=pmax64 |
|
MACHINE=pmax MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=prep MACHINE_ARCH=powerpc |
|
MACHINE=rs6000 MACHINE_ARCH=powerpc |
|
MACHINE=sandpoint MACHINE_ARCH=powerpc |
|
MACHINE=sbmips MACHINE_ARCH= NO_DEFAULT |
|
MACHINE=sbmips MACHINE_ARCH=mips64eb ALIAS=sbmips64-eb |
|
MACHINE=sbmips MACHINE_ARCH=mips64el ALIAS=sbmips64-el |
|
MACHINE=sbmips MACHINE_ARCH=mipseb ALIAS=sbmips-eb |
|
MACHINE=sbmips MACHINE_ARCH=mipsel ALIAS=sbmips-el |
|
MACHINE=sgimips MACHINE_ARCH=mips64eb ALIAS=sgimips64 |
|
MACHINE=sgimips MACHINE_ARCH=mipseb DEFAULT |
|
MACHINE=shark MACHINE_ARCH=arm DEFAULT |
|
MACHINE=shark MACHINE_ARCH=earmv4 ALIAS=eshark |
|
MACHINE=sparc MACHINE_ARCH=sparc |
|
MACHINE=sparc64 MACHINE_ARCH=sparc64 |
|
MACHINE=sun2 MACHINE_ARCH=m68000 |
|
MACHINE=sun3 MACHINE_ARCH=m68k |
|
MACHINE=vax MACHINE_ARCH=vax |
|
MACHINE=x68k MACHINE_ARCH=m68k |
|
MACHINE=zaurus MACHINE_ARCH=arm DEFAULT |
|
MACHINE=zaurus MACHINE_ARCH=earm ALIAS=ezaurus |
|
' |
|
|
|
# getarch -- find the default MACHINE_ARCH for a MACHINE, |
|
# or convert an alias to a MACHINE/MACHINE_ARCH pair. |
|
# |
|
# Saves MACHINE in makewrappermachine before possibly modifying MACHINE. |
|
# |
|
# Sets MACHINE and MACHINE_ARCH if the input MACHINE value is |
|
# recognised as an alias, or recognised as a machine that has a default |
|
# MACHINE_ARCH (or that has only one possible MACHINE_ARCH). |
|
# |
|
# Leaves MACHINE and MACHINE_ARCH unchanged if MACHINE is recognised |
|
# as being associated with multiple MACHINE_ARCH values with no default. |
|
# |
|
# Bombs if MACHINE is not recognised. |
|
# |
getarch() |
getarch() |
{ |
{ |
# Translate some MACHINE name aliases (known only to build.sh) |
local IFS |
# into proper MACHINE and MACHINE_ARCH names. Save the alias |
local found="" |
# name in makewrappermachine. |
local line |
# |
|
case "${MACHINE}" in |
IFS="${nl}" |
|
makewrappermachine="${MACHINE}" |
evbarm-e[bl]) |
for line in ${valid_MACHINE_ARCH}; do |
makewrappermachine=${MACHINE} |
line="${line%%#*}" # ignore comments |
# MACHINE_ARCH is "arm" or "armeb", not "armel" |
line="$( IFS=" ${tab}" ; echo $line )" # normalise white space |
MACHINE_ARCH=arm${MACHINE##*-} |
case "${line} " in |
MACHINE_ARCH=${MACHINE_ARCH%el} |
"") |
MACHINE=${MACHINE%-e[bl]} |
# skip blank lines or comment lines |
;; |
continue |
|
;; |
evbmips-e[bl]|sbmips-e[bl]) |
*" ALIAS=${MACHINE} "*) |
makewrappermachine=${MACHINE} |
# Found a line with a matching ALIAS=<alias>. |
MACHINE_ARCH=mips${MACHINE##*-} |
found="$line" |
MACHINE=${MACHINE%-e[bl]} |
break |
;; |
;; |
|
"MACHINE=${MACHINE} "*" NO_DEFAULT"*) |
evbmips64-e[bl]|sbmips64-e[bl]) |
# Found an explicit "NO_DEFAULT" for this MACHINE. |
makewrappermachine=${MACHINE} |
found="$line" |
MACHINE_ARCH=mips64${MACHINE##*-} |
break |
MACHINE=${MACHINE%64-e[bl]} |
;; |
;; |
"MACHINE=${MACHINE} "*" DEFAULT"*) |
|
# Found an explicit "DEFAULT" for this MACHINE. |
evbsh3-e[bl]) |
found="$line" |
makewrappermachine=${MACHINE} |
break |
MACHINE_ARCH=sh3${MACHINE##*-} |
;; |
MACHINE=${MACHINE%-e[bl]} |
"MACHINE=${MACHINE} "*) |
;; |
# Found a line for this MACHINE. If it's the |
|
# first such line, then tentatively accept it. |
esac |
# If it's not the first matching line, then |
|
# remember that there was more than one match. |
# Translate a MACHINE into a default MACHINE_ARCH. |
case "$found" in |
# |
'') found="$line" ;; |
case "${MACHINE}" in |
*) found="MULTIPLE_MATCHES" ; break ;; |
|
esac |
acorn26|acorn32|cats|hpcarm|iyonix|netwinder|shark|zaurus) |
;; |
MACHINE_ARCH=arm |
esac |
;; |
done |
|
|
evbarm) # unspecified MACHINE_ARCH gets LE |
|
MACHINE_ARCH=${MACHINE_ARCH:=arm} |
|
;; |
|
|
|
hp700) |
|
MACHINE_ARCH=hppa |
|
;; |
|
|
|
sun2) |
|
MACHINE_ARCH=m68000 |
|
;; |
|
|
|
amiga|atari|cesfic|hp300|luna68k|mac68k|mvme68k|news68k|next68k|sun3|x68k) |
|
MACHINE_ARCH=m68k |
|
;; |
|
|
|
evbmips|sbmips) # no default MACHINE_ARCH |
|
;; |
|
|
|
sgimips64) |
|
makewrappermachine=${MACHINE} |
|
MACHINE=${MACHINE%64} |
|
MACHINE_ARCH=mips64eb |
|
;; |
|
|
|
ews4800mips|mipsco|newsmips|sgimips|emips) |
|
MACHINE_ARCH=mipseb |
|
;; |
|
|
|
algor64|arc64|cobalt64|pmax64) |
|
makewrappermachine=${MACHINE} |
|
MACHINE=${MACHINE%64} |
|
MACHINE_ARCH=mips64el |
|
;; |
|
|
|
algor|arc|cobalt|hpcmips|pmax) |
|
MACHINE_ARCH=mipsel |
|
;; |
|
|
|
evbppc64|macppc64|ofppc64) |
|
makewrappermachine=${MACHINE} |
|
MACHINE=${MACHINE%64} |
|
MACHINE_ARCH=powerpc64 |
|
;; |
|
|
|
amigappc|bebox|evbppc|ibmnws|macppc|mvmeppc|ofppc|prep|rs6000|sandpoint) |
|
MACHINE_ARCH=powerpc |
|
;; |
|
|
|
evbsh3) # no default MACHINE_ARCH |
|
;; |
|
|
|
mmeye) |
|
MACHINE_ARCH=sh3eb |
|
;; |
|
|
|
dreamcast|hpcsh|landisk) |
|
MACHINE_ARCH=sh3el |
|
;; |
|
|
|
amd64) |
|
MACHINE_ARCH=x86_64 |
|
;; |
|
|
|
alpha|i386|sparc|sparc64|vax|ia64) |
case "$found" in |
MACHINE_ARCH=${MACHINE} |
*NO_DEFAULT*|*MULTIPLE_MATCHES*) |
|
# MACHINE is OK, but MACHINE_ARCH is still unknown |
|
return |
|
;; |
|
"MACHINE="*" MACHINE_ARCH="*) |
|
# Obey the MACHINE= and MACHINE_ARCH= parts of the line. |
|
IFS=" " |
|
for frag in ${found}; do |
|
case "$frag" in |
|
MACHINE=*|MACHINE_ARCH=*) |
|
eval "$frag" |
|
;; |
|
esac |
|
done |
;; |
;; |
|
|
*) |
*) |
bomb "Unknown target MACHINE: ${MACHINE}" |
bomb "Unknown target MACHINE: ${MACHINE}" |
;; |
;; |
|
|
esac |
esac |
} |
} |
|
|
|
# validatearch -- check that the MACHINE/MACHINE_ARCH pair is supported. |
|
# |
|
# Bombs if the pair is not supported. |
|
# |
validatearch() |
validatearch() |
{ |
{ |
# Ensure that the MACHINE_ARCH exists (and is supported by build.sh). |
local IFS |
# |
local line |
case "${MACHINE_ARCH}" in |
local foundpair=false foundmachine=false foundarch=false |
|
|
alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|mips64e[bl]|powerpc|powerpc64|sh3e[bl]|sparc|sparc64|vax|x86_64|ia64) |
|
;; |
|
|
|
|
case "${MACHINE_ARCH}" in |
"") |
"") |
bomb "No MACHINE_ARCH provided" |
bomb "No MACHINE_ARCH provided" |
;; |
;; |
|
|
*) |
|
bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}" |
|
;; |
|
|
|
esac |
esac |
|
|
# Determine valid MACHINE_ARCHs for MACHINE |
IFS="${nl}" |
# |
for line in ${valid_MACHINE_ARCH}; do |
case "${MACHINE}" in |
line="${line%%#*}" # ignore comments |
|
line="$( IFS=" ${tab}" ; echo $line )" # normalise white space |
evbarm) |
case "${line} " in |
arches="arm armeb" |
"") |
;; |
# skip blank lines or comment lines |
|
continue |
algor|arc|cobalt|pmax) |
;; |
arches="mipsel mips64el" |
"MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} "*) |
;; |
foundpair=true |
|
;; |
evbmips|sbmips) |
"MACHINE=${MACHINE} "*) |
arches="mipseb mipsel mips64eb mips64el" |
foundmachine=true |
;; |
;; |
|
*"MACHINE_ARCH=${MACHINE_ARCH} "*) |
|
foundarch=true |
|
;; |
|
esac |
|
done |
|
|
sgimips) |
case "${foundpair}:${foundmachine}:${foundarch}" in |
arches="mipseb mips64eb" |
true:*) |
|
: OK |
;; |
;; |
|
*:false:*) |
evbsh3) |
bomb "Unknown target MACHINE: ${MACHINE}" |
arches="sh3eb sh3el" |
|
;; |
;; |
|
*:*:false) |
macppc|evbppc|ofppc) |
bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}" |
arches="powerpc powerpc64" |
|
;; |
;; |
*) |
*) |
oma="${MACHINE_ARCH}" |
bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'" |
getarch |
|
arches="${MACHINE_ARCH}" |
|
MACHINE_ARCH="${oma}" |
|
;; |
;; |
|
|
esac |
esac |
|
|
# Ensure that MACHINE_ARCH supports MACHINE |
|
# |
|
archok=false |
|
for a in ${arches}; do |
|
if [ "${a}" = "${MACHINE_ARCH}" ]; then |
|
archok=true |
|
break |
|
fi |
|
done |
|
${archok} || |
|
bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'" |
|
} |
} |
|
|
# nobomb_getmakevar -- |
# nobomb_getmakevar -- |
Line 851 Usage: ${progname} [-EhnorUuxy] [-a arch |
|
Line 922 Usage: ${progname} [-EhnorUuxy] [-a arch |
|
install=idir Run "make installworld" to \`idir' to install all sets |
install=idir Run "make installworld" to \`idir' to install all sets |
except \`etc'. Useful after "distribution" or "release" |
except \`etc'. Useful after "distribution" or "release" |
kernel=conf Build kernel with config file \`conf' |
kernel=conf Build kernel with config file \`conf' |
|
kernel.gdb=conf Build kernel (including netbsd.gdb) with config |
|
file \`conf' |
releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR. |
releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR. |
installmodules=idir Run "make installmodules" to \`idir' to install all |
installmodules=idir Run "make installmodules" to \`idir' to install all |
kernel modules. |
kernel modules. |
Line 864 Usage: ${progname} [-EhnorUuxy] [-a arch |
|
Line 937 Usage: ${progname} [-EhnorUuxy] [-a arch |
|
RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. |
RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs. |
iso-image Create CD-ROM image in RELEASEDIR/iso. |
iso-image Create CD-ROM image in RELEASEDIR/iso. |
iso-image-source Create CD-ROM image with source in RELEASEDIR/iso. |
iso-image-source Create CD-ROM image with source in RELEASEDIR/iso. |
|
live-image Create bootable live image in |
|
RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage. |
|
install-image Create bootable installation image in |
|
RELEASEDIR/RELEASEMACHINEDIR/installation/installimage. |
|
disk-image=target Creae bootable disk image in |
|
RELEASEDIR/RELEASEMACHINEDIR/binary/gzimg/target.img.gz. |
params Display various make(1) parameters. |
params Display various make(1) parameters. |
|
|
Options: |
Options: |
|
|
op=iso_image_source # used as part of a variable name |
op=iso_image_source # used as part of a variable name |
;; |
;; |
|
|
kernel=*|releasekernel=*) |
live-image) |
|
op=live_image # used as part of a variable name |
|
;; |
|
|
|
install-image) |
|
op=install_image # used as part of a variable name |
|
;; |
|
|
|
kernel=*|releasekernel=*|kernel.gdb=*) |
arg=${op#*=} |
arg=${op#*=} |
op=${op%%=*} |
op=${op%%=*} |
[ -n "${arg}" ] || |
[ -n "${arg}" ] || |
bomb "Must supply a kernel name with \`${op}=...'" |
bomb "Must supply a kernel name with \`${op}=...'" |
;; |
;; |
|
|
|
disk-image=*) |
|
arg=${op#*=} |
|
op=disk_image |
|
[ -n "${arg}" ] || |
|
bomb "Must supply a target name with \`${op}=...'" |
|
|
|
;; |
|
|
modules) |
modules) |
op=modules |
op=modules |
;; |
;; |
|
|
# |
# |
sanitycheck() |
sanitycheck() |
{ |
{ |
|
# Install as non-root is a bad idea. |
|
# |
|
if ${do_install} && [ "$id_u" -ne 0 ] ; then |
|
if ${do_expertmode}; then |
|
warning "Will install as an unprivileged user." |
|
else |
|
bomb "-E must be set for install as an unprivileged user." |
|
fi |
|
fi |
|
|
# If the PATH contains any non-absolute components (including, |
# If the PATH contains any non-absolute components (including, |
# but not limited to, "." or ""), then complain. As an exception, |
# but not limited to, "." or ""), then complain. As an exception, |
# allow "" or "." as the last component of the PATH. This is fatal |
# allow "" or "." as the last component of the PATH. This is fatal |
Line 1339 print_tooldir_make() |
|
Line 1444 print_tooldir_make() |
|
# 1. build a new version of nbmake in a temporary directory; |
# 1. build a new version of nbmake in a temporary directory; |
# 2. use the temporary nbmake to create the top level obj directory; |
# 2. use the temporary nbmake to create the top level obj directory; |
# 3. use $(getmakevar TOOLDIR) with the temporary nbmake to |
# 3. use $(getmakevar TOOLDIR) with the temporary nbmake to |
# get the corect value of TOOLDIR; |
# get the correct value of TOOLDIR; |
# 4. move the temporary nbmake to ${TOOLDIR}/bin/nbmake. |
# 4. move the temporary nbmake to ${TOOLDIR}/bin/nbmake. |
# |
# |
# However, people don't like building nbmake unnecessarily if their |
# However, people don't like building nbmake unnecessarily if their |
|
|
${runcmd} env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" \ |
${runcmd} env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" \ |
CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \ |
CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \ |
${HOST_SH} "${TOP}/tools/make/configure" || |
${HOST_SH} "${TOP}/tools/make/configure" || |
bomb "Configure of ${toolprefix}make failed" |
( cp ${tmpdir}/config.log ${tmpdir}-config.log |
|
bomb "Configure of ${toolprefix}make failed, see ${tmpdir}-config.log for details" ) |
${runcmd} ${HOST_SH} buildmake.sh || |
${runcmd} ${HOST_SH} buildmake.sh || |
bomb "Build of ${toolprefix}make failed" |
bomb "Build of ${toolprefix}make failed" |
make="${tmpdir}/${toolprefix}make" |
make="${tmpdir}/${toolprefix}make" |
|
|
# Perform some late sanity checks, after rebuildmake, |
# Perform some late sanity checks, after rebuildmake, |
# but before createmakewrapper or any real work. |
# but before createmakewrapper or any real work. |
# |
# |
# Also create the top-level obj directory. |
# Creates the top-level obj directory, because that |
|
# is needed by some of the sanity checks. |
|
# |
|
# Prints status messages reporting the values of several variables. |
# |
# |
validatemakeparams() |
validatemakeparams() |
{ |
{ |
|
# MAKECONF (which defaults to /etc/mk.conf in share/mk/bsd.own.mk) |
|
# can affect many things, so mention it in an early status message. |
|
# |
|
MAKECONF=$(getmakevar MAKECONF) |
|
if [ -e "${MAKECONF}" ]; then |
|
statusmsg2 "MAKECONF file:" "${MAKECONF}" |
|
else |
|
statusmsg2 "MAKECONF file:" "${MAKECONF} (File not found)" |
|
fi |
|
|
|
# Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE. |
|
# These may be set as build.sh options or in "mk.conf". |
|
# Don't export them as they're only used for tests in build.sh. |
|
# |
|
MKOBJDIRS=$(getmakevar MKOBJDIRS) |
|
MKUNPRIVED=$(getmakevar MKUNPRIVED) |
|
MKUPDATE=$(getmakevar MKUPDATE) |
|
|
|
# Non-root should always use either the -U or -E flag. |
|
# |
|
if ! ${do_expertmode} && \ |
|
[ "$id_u" -ne 0 ] && \ |
|
[ "${MKUNPRIVED}" = "no" ] ; then |
|
bomb "-U or -E must be set for build as an unprivileged user." |
|
fi |
|
|
if [ "${runcmd}" = "echo" ]; then |
if [ "${runcmd}" = "echo" ]; then |
TOOLCHAIN_MISSING=no |
TOOLCHAIN_MISSING=no |
EXTERNAL_TOOLCHAIN="" |
EXTERNAL_TOOLCHAIN="" |
Line 1412 validatemakeparams() |
|
Line 1547 validatemakeparams() |
|
exit 1 |
exit 1 |
fi |
fi |
|
|
# Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE |
|
# These may be set as build.sh options or in "mk.conf". |
|
# Don't export them as they're only used for tests in build.sh. |
|
# |
|
MKOBJDIRS=$(getmakevar MKOBJDIRS) |
|
MKUNPRIVED=$(getmakevar MKUNPRIVED) |
|
MKUPDATE=$(getmakevar MKUPDATE) |
|
|
|
if [ "${MKOBJDIRS}" != "no" ]; then |
if [ "${MKOBJDIRS}" != "no" ]; then |
# Create the top-level object directory. |
# Create the top-level object directory. |
# |
# |
Line 1504 validatemakeparams() |
|
Line 1631 validatemakeparams() |
|
removedirs="${TOOLDIR}" |
removedirs="${TOOLDIR}" |
|
|
if [ -z "${DESTDIR}" ] || [ "${DESTDIR}" = "/" ]; then |
if [ -z "${DESTDIR}" ] || [ "${DESTDIR}" = "/" ]; then |
if ${do_build} || ${do_distribution} || ${do_release}; then |
if ${do_distribution} || ${do_release} || \ |
if ! ${do_build} || \ |
[ "${uname_s}" != "NetBSD" ] || \ |
[ "${uname_s}" != "NetBSD" ] || \ |
[ "${uname_m}" != "${MACHINE}" ]; then |
[ "${uname_m}" != "${MACHINE}" ]; then |
bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'." |
bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'." |
fi |
fi |
if ! ${do_expertmode}; then |
if ! ${do_expertmode}; then |
bomb "DESTDIR must != / for non -E (expert) builds" |
bomb "DESTDIR must != / for non -E (expert) builds" |
|
fi |
|
statusmsg "WARNING: Building to /, in expert mode." |
|
statusmsg " This may cause your system to break! Reasons include:" |
|
statusmsg " - your kernel is not up to date" |
|
statusmsg " - the libraries or toolchain have changed" |
|
statusmsg " YOU HAVE BEEN WARNED!" |
|
fi |
fi |
|
statusmsg "WARNING: Building to /, in expert mode." |
|
statusmsg " This may cause your system to break! Reasons include:" |
|
statusmsg " - your kernel is not up to date" |
|
statusmsg " - the libraries or toolchain have changed" |
|
statusmsg " YOU HAVE BEEN WARNED!" |
else |
else |
removedirs="${removedirs} ${DESTDIR}" |
removedirs="${removedirs} ${DESTDIR}" |
fi |
fi |
if ${do_build} || ${do_distribution} || ${do_release}; then |
|
if ! ${do_expertmode} && \ |
|
[ "$id_u" -ne 0 ] && \ |
|
[ "${MKUNPRIVED}" = "no" ] ; then |
|
bomb "-U or -E must be set for build as an unprivileged user." |
|
fi |
|
fi |
|
if ${do_releasekernel} && [ -z "${RELEASEDIR}" ]; then |
if ${do_releasekernel} && [ -z "${RELEASEDIR}" ]; then |
bomb "Must set RELEASEDIR with \`releasekernel=...'" |
bomb "Must set RELEASEDIR with \`releasekernel=...'" |
fi |
fi |
|
|
# Install as non-root is a bad idea. |
|
# |
|
if ${do_install} && [ "$id_u" -ne 0 ] ; then |
|
if ${do_expertmode}; then |
|
warning "Will install as an unprivileged user." |
|
else |
|
bomb "-E must be set for install as an unprivileged user." |
|
fi |
|
fi |
|
|
|
# If a previous build.sh run used -U (and therefore created a |
# If a previous build.sh run used -U (and therefore created a |
# METALOG file), then most subsequent build.sh runs must also |
# METALOG file), then most subsequent build.sh runs must also |
# use -U. If DESTDIR is about to be removed, then don't perform |
# use -U. If DESTDIR is about to be removed, then don't perform |
Line 1553 validatemakeparams() |
|
Line 1661 validatemakeparams() |
|
# DESTDIR is about to be removed |
# DESTDIR is about to be removed |
;; |
;; |
*) |
*) |
if ( ${do_build} || ${do_distribution} || ${do_release} || \ |
if [ -e "${DESTDIR}/METALOG" ] && \ |
${do_install} ) && \ |
|
[ -e "${DESTDIR}/METALOG" ] && \ |
|
[ "${MKUNPRIVED}" = "no" ] ; then |
[ "${MKUNPRIVED}" = "no" ] ; then |
if $do_expertmode; then |
if $do_expertmode; then |
warning "A previous build.sh run specified -U." |
warning "A previous build.sh run specified -U." |
Line 1565 validatemakeparams() |
|
Line 1671 validatemakeparams() |
|
fi |
fi |
;; |
;; |
esac |
esac |
|
|
|
# live-image and install-image targets require binary sets |
|
# (actually DESTDIR/etc/mtree/set.* files) built with MKUNPRIVED. |
|
# If release operation is specified with live-image or install-image, |
|
# the release op should be performed with -U for later image ops. |
|
# |
|
if ${do_release} && ( ${do_live_image} || ${do_install_image} ) && \ |
|
[ "${MKUNPRIVED}" = "no" ] ; then |
|
bomb "-U must be specified on building release to create images later." |
|
fi |
} |
} |
|
|
|
|
|
|
if [ "${MKUPDATE}" = "no" ]; then |
if [ "${MKUPDATE}" = "no" ]; then |
make_in_dir tools cleandir |
make_in_dir tools cleandir |
fi |
fi |
make_in_dir tools dependall |
make_in_dir tools build_install |
make_in_dir tools install |
|
statusmsg "Tools built to ${TOOLDIR}" |
statusmsg "Tools built to ${TOOLDIR}" |
} |
} |
|
|
Line 1713 getkernelconf() |
|
Line 1828 getkernelconf() |
|
kernelbuildpath="${KERNOBJDIR}/${kernelconfname}" |
kernelbuildpath="${KERNOBJDIR}/${kernelconfname}" |
} |
} |
|
|
|
diskimage() |
|
{ |
|
ARG="$(echo $1 | tr '[:lower:]' '[:upper:]')" |
|
[ -f "${DESTDIR}/etc/mtree/set.base" ] || |
|
bomb "The release binaries must be built first" |
|
kerneldir="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel" |
|
kernel="${kerneldir}/netbsd-${ARG}.gz" |
|
[ -f "${kernel}" ] || |
|
bomb "The kernel ${kernel} must be built first" |
|
make_in_dir "${NETBSDSRCDIR}/etc" "smp_${1}" |
|
} |
|
|
buildkernel() |
buildkernel() |
{ |
{ |
if ! ${do_tools} && ! ${buildkernelwarned:-false}; then |
if ! ${do_tools} && ! ${buildkernelwarned:-false}; then |
|
|
[ -x "${TOOLDIR}/bin/${toolprefix}config" ] \ |
[ -x "${TOOLDIR}/bin/${toolprefix}config" ] \ |
|| bomb "${TOOLDIR}/bin/${toolprefix}config does not exist. You need to \"$0 tools\" first." |
|| bomb "${TOOLDIR}/bin/${toolprefix}config does not exist. You need to \"$0 tools\" first." |
${runcmd} "${TOOLDIR}/bin/${toolprefix}config" -b "${kernelbuildpath}" \ |
${runcmd} "${TOOLDIR}/bin/${toolprefix}config" -b "${kernelbuildpath}" \ |
-s "${TOP}/sys" "${kernelconfpath}" || |
${ksymopts} -s "${TOP}/sys" "${kernelconfpath}" || |
bomb "${toolprefix}config failed for ${kernelconf}" |
bomb "${toolprefix}config failed for ${kernelconf}" |
make_in_dir "${kernelbuildpath}" depend |
make_in_dir "${kernelbuildpath}" depend |
make_in_dir "${kernelbuildpath}" all |
make_in_dir "${kernelbuildpath}" all |
|
|
|
|
statusmsg "Building kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}" |
statusmsg "Building kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}" |
if [ "${MKOBJDIRS}" != "no" ]; then |
if [ "${MKOBJDIRS}" != "no" ]; then |
make_in_dir sys/modules obj || |
make_in_dir sys/modules obj |
bomb "Failed to make obj in sys/modules" |
|
fi |
fi |
if [ "${MKUPDATE}" = "no" ]; then |
if [ "${MKUPDATE}" = "no" ]; then |
make_in_dir sys/modules cleandir |
make_in_dir sys/modules cleandir |
fi |
fi |
${runcmd} "${makewrapper}" ${parallel} do-sys-modules || |
make_in_dir sys/modules dependall |
bomb "Failed to make do-sys-modules" |
make_in_dir sys/modules install |
|
|
statusmsg "Successful build of kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}" |
statusmsg "Successful build of kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}" |
} |
} |
|
|
RUMP_LIBSETS=' |
RUMP_LIBSETS=' |
-lrump, |
-lrump, |
-lrumpvfs -lrump, |
-lrumpvfs -lrump, |
-lrumpdev -lrump, |
-lrumpvfs -lrumpdev -lrump, |
-lrumpnet -lrump, |
-lrumpnet -lrump, |
-lrumpkern_tty -lrumpvfs -lrump, |
-lrumpkern_tty -lrumpvfs -lrump, |
-lrumpfs_tmpfs -lrumpvfs -lrump, |
-lrumpfs_tmpfs -lrumpvfs -lrump, |
|
|
[ "${1}" != "rumptest" ] && bomb 'build.sh rump not yet functional. ' \ |
[ "${1}" != "rumptest" ] && bomb 'build.sh rump not yet functional. ' \ |
'did you mean "rumptest"?' |
'did you mean "rumptest"?' |
|
|
|
export RUMPKERN_ONLY=1 |
# create obj and distrib dirs |
# create obj and distrib dirs |
if [ "${MKOBJDIRS}" != "no" ]; then |
if [ "${MKOBJDIRS}" != "no" ]; then |
make_in_dir "${NETBSDSRCDIR}/etc/mtree" obj |
make_in_dir "${NETBSDSRCDIR}/etc/mtree" obj |
|
|
/undefined reference/ && |
/undefined reference/ && |
!/more undefined references.*follow/{ |
!/more undefined references.*follow/{ |
if (match($NF, |
if (match($NF, |
"`(rumpuser_|__" quirks ")") == 0) |
"`(rumpuser_|rumpcomp_|__" quirks ")") == 0) |
fails[NR] = $0 |
fails[NR] = $0 |
} |
} |
/cannot find -l/{fails[NR] = $0} |
/cannot find -l/{fails[NR] = $0} |
|
|
statusmsg "Successful make ${op}" |
statusmsg "Successful make ${op}" |
;; |
;; |
|
|
|
live-image|install-image) |
|
# install-image and live-image require mtree spec files |
|
# built with UNPRIVED. Assume UNPRIVED build has been |
|
# performed if METALOG file is created in DESTDIR. |
|
if [ ! -e "${DESTDIR}/METALOG" ] ; then |
|
bomb "The release binaries must have been built with -U to create images." |
|
fi |
|
${runcmd} "${makewrapper}" ${parallel} ${op} || |
|
bomb "Failed to make ${op}" |
|
statusmsg "Successful make ${op}" |
|
;; |
kernel=*) |
kernel=*) |
arg=${op#*=} |
arg=${op#*=} |
buildkernel "${arg}" |
buildkernel "${arg}" |
;; |
;; |
|
kernel.gdb=*) |
|
arg=${op#*=} |
|
ksymopts="-D DEBUG=-g" |
|
buildkernel "${arg}" |
|
;; |
releasekernel=*) |
releasekernel=*) |
arg=${op#*=} |
arg=${op#*=} |
releasekernel "${arg}" |
releasekernel "${arg}" |
;; |
;; |
|
|
|
disk-image=*) |
|
arg=${op#*=} |
|
diskimage "${arg}" |
|
;; |
|
|
modules) |
modules) |
buildmodules |
buildmodules |
;; |
;; |