3 # Copyright (c) 2005 Poul-Henning Kamp.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 nanobsd_sh=`realpath $0`
33 topdir=`dirname ${nanobsd_sh}`
34 . "${topdir}/defaults.sh"
36 #######################################################################
46 do_native_xtools=false
49 # Pull in legacy stuff for now automatically
50 . "${topdir}/legacy.sh"
53 args=`getopt BKXWbc:fhiIknqvw $*`
54 if [ $? -ne 0 ] ; then
67 do_installkernel=false
71 do_installkernel=false
88 # Make config file path available to the config file
89 # itself so that it can access additional files relative
90 # to its own location.
117 PPLEVEL=$(($PPLEVEL - 1))
121 PPLEVEL=$(($PPLEVEL + 1))
131 do_installworld=false
132 do_installkernel=false
143 if [ $# -gt 0 ] ; then
144 echo "$0: Extraneous arguments supplied"
148 #######################################################################
149 # And then it is as simple as that...
151 # File descriptor 3 is used for logging output, see pprint
153 set_defaults_and_export
155 if [ ! -d "${NANO_TOOLS}" ]; then
156 echo "NANO_TOOLS directory does not exist" 1>&2
161 NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
164 pprint 1 "NanoBSD image ${NANO_NAME} build starting"
172 pprint 2 "Using existing build tree (as instructed)"
177 pprint 2 "Skipping buildworld (as instructed)"
181 if ! $do_world ; then
186 pprint 2 "Skipping buildkernel (as instructed)"
189 if $do_installworld ; then
195 pprint 2 "Skipping installworld (as instructed)"
198 if ${do_native_xtools} ; then
201 if ${do_prep_image} ; then
204 if $do_installkernel ; then
207 pprint 2 "Skipping installkernel (as instructed)"
210 if $do_prep_image ; then
215 fixup_before_diskimage
217 pprint 2 "Skipping image prep (as instructed)"
220 calculate_partitioning
225 pprint 2 "Skipping image build (as instructed)"
228 pprint 2 "Skipping code and image build (as instructed)"
232 pprint 1 "NanoBSD image ${NANO_NAME} completed"