add an installmodules=<dir> command to build.sh

This commit is contained in:
jmcneill 2011-08-08 22:15:42 +00:00
parent 941368522d
commit b415fa375b
2 changed files with 48 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.286 2011/06/29 02:05:24 mrg Exp $
# $NetBSD: Makefile,v 1.287 2011/08/08 22:15:42 jmcneill Exp $
#
# This is the top-level makefile for building NetBSD. For an outline of
@ -341,6 +341,29 @@ installworld: .PHONY .MAKE
@echo "make ${.TARGET} started at: ${START_TIME}"
@printf "make ${.TARGET} finished at: " && date
#
# Install modules from $DESTDIR to $INSTALLMODULESDIR
#
installmodules: .PHONY .MAKE
.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
@echo "Can't make ${.TARGET} to DESTDIR=/"
@false
.endif
.if !defined(INSTALLMODULESDIR) || \
${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
.if (${HOST_UNAME_S} != "NetBSD")
@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
@false
.endif
.if (${HOST_UNAME_M} != ${MACHINE})
@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
@false
.endif
.endif
${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:*/}
@echo "make ${.TARGET} started at: ${START_TIME}"
@printf "make ${.TARGET} finished at: " && date
#
# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
#

View File

@ -1,5 +1,5 @@
#! /usr/bin/env sh
# $NetBSD: build.sh,v 1.244 2011/01/26 01:18:43 pooka Exp $
# $NetBSD: build.sh,v 1.245 2011/08/08 22:15:42 jmcneill Exp $
#
# Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
# All rights reserved.
@ -258,6 +258,7 @@ initdefaults()
do_kernel=false
do_releasekernel=false
do_modules=false
do_installmodules=false
do_install=false
do_sets=false
do_sourcesets=false
@ -618,6 +619,8 @@ Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cdextras]
except \`etc'. Useful after "distribution" or "release"
kernel=conf Build kernel with config file \`conf'
releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR.
installmodules=idir Run "make installmodules" to \`idir' to install all
kernel modules.
modules Build kernel modules.
rumptest Do a linktest for rump (for developers).
sets Create binary sets in
@ -910,7 +913,7 @@ parseoptions()
op=modules
;;
install=*)
install=*|installmodules=*)
arg=${op#*=}
op=${op%%=*}
[ -n "${arg}" ] ||
@ -1384,7 +1387,7 @@ createmakewrapper()
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
# Generated from: \$NetBSD: build.sh,v 1.244 2011/01/26 01:18:43 pooka Exp $
# Generated from: \$NetBSD: build.sh,v 1.245 2011/08/08 22:15:42 jmcneill Exp $
# with these arguments: ${_args}
#
@ -1547,6 +1550,14 @@ buildmodules()
statusmsg "Successful build of kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}"
}
installmodules()
{
dir="$1"
${runcmd} "${makewrapper}" INSTALLMODULESDIR="${dir}" installmodules ||
bomb "Failed to make installmodules to ${dir}"
statusmsg "Successful installmodules to ${dir}"
}
installworld()
{
dir="$1"
@ -1718,6 +1729,16 @@ main()
buildmodules
;;
installmodules=*)
arg=${op#*=}
if [ "${arg}" = "/" ] && \
( [ "${uname_s}" != "NetBSD" ] || \
[ "${uname_m}" != "${MACHINE}" ] ); then
bomb "'${op}' must != / for cross builds."
fi
installmodules "${arg}"
;;
install=*)
arg=${op#*=}
if [ "${arg}" = "/" ] && \