nanobsd.sh revision 181751
1#!/bin/sh 2# 3# Copyright (c) 2005 Poul-Henning Kamp. 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 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. 14# 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 25# SUCH DAMAGE. 26# 27# $FreeBSD: head/tools/tools/nanobsd/nanobsd.sh 181751 2008-08-15 08:28:15Z phk $ 28# 29 30set -e 31 32####################################################################### 33# 34# Setup default values for all controlling variables. 35# These values can be overridden from the config file(s) 36# 37####################################################################### 38 39# Name of this NanoBSD build. (Used to construct workdir names) 40NANO_NAME=full 41 42# Source tree directory 43NANO_SRC=/usr/src 44 45# Where nanobsd additional files live under the source tree 46NANO_TOOLS=tools/tools/nanobsd 47 48# Where cust_pkg() finds packages to install 49NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg 50 51# Object tree directory 52# default is subdir of /usr/obj 53# XXX: MAKEOBJDIRPREFIX handling... ? 54#NANO_OBJ="" 55 56# The directory to put the final images 57# default is ${NANO_OBJ} 58#NANO_DISKIMGDIR="" 59 60# Parallel Make 61NANO_PMAKE="make -j 3" 62 63# Options to put in make.conf during buildworld only 64CONF_BUILD=' ' 65 66# Options to put in make.conf during installworld only 67CONF_INSTALL=' ' 68 69# Options to put in make.conf during both build- & installworld. 70CONF_WORLD=' ' 71 72# Kernel config file to use 73NANO_KERNEL=GENERIC 74 75# Customize commands. 76NANO_CUSTOMIZE="" 77 78# Late customize commands. 79NANO_LATE_CUSTOMIZE="" 80 81# Newfs paramters to use 82NANO_NEWFS="-b 4096 -f 512 -i 8192 -O1 -U" 83 84# The drive name of the media at runtime 85NANO_DRIVE=ad0 86 87# Target media size in 512 bytes sectors 88NANO_MEDIASIZE=1000000 89 90# Number of code images on media (1 or 2) 91NANO_IMAGES=2 92 93# 0 -> Leave second image all zeroes so it compresses better. 94# 1 -> Initialize second image with a copy of the first 95NANO_INIT_IMG2=1 96 97# Size of code file system in 512 bytes sectors 98# If zero, size will be as large as possible. 99NANO_CODESIZE=0 100 101# Size of configuration file system in 512 bytes sectors 102# Cannot be zero. 103NANO_CONFSIZE=2048 104 105# Size of data file system in 512 bytes sectors 106# If zero: no partition configured. 107# If negative: max size possible 108NANO_DATASIZE=0 109 110# Size of the /etc ramdisk in 512 bytes sectors 111NANO_RAM_ETCSIZE=10240 112 113# Size of the /tmp+/var ramdisk in 512 bytes sectors 114NANO_RAM_TMPVARSIZE=10240 115 116# Media geometry, only relevant if bios doesn't understand LBA. 117NANO_SECTS=63 118NANO_HEADS=16 119 120# boot0 flags/options and configuration 121NANO_BOOT0CFG="-o packet -s 1 -m 3" 122NANO_BOOTLOADER="boot/boot0sio" 123 124# Backing type of md(4) device 125# Can be "file" or "swap" 126NANO_MD_BACKING="file" 127 128####################################################################### 129# Not a variable at this time 130 131NANO_ARCH=i386 132 133####################################################################### 134# 135# The functions which do the real work. 136# Can be overridden from the config file(s) 137# 138####################################################################### 139 140clean_build ( ) ( 141 echo "## Clean and create object directory (${MAKEOBJDIRPREFIX})" 142 143 if rm -rf ${MAKEOBJDIRPREFIX} > /dev/null 2>&1 ; then 144 true 145 else 146 chflags -R noschg ${MAKEOBJDIRPREFIX} 147 rm -rf ${MAKEOBJDIRPREFIX} 148 fi 149 mkdir -p ${MAKEOBJDIRPREFIX} 150 printenv > ${MAKEOBJDIRPREFIX}/_.env 151) 152 153make_conf_build ( ) ( 154 echo "## Construct build make.conf ($NANO_MAKE_CONF)" 155 156 echo "${CONF_WORLD}" > ${NANO_MAKE_CONF} 157 echo "${CONF_BUILD}" >> ${NANO_MAKE_CONF} 158) 159 160build_world ( ) ( 161 echo "## run buildworld" 162 echo "### log: ${MAKEOBJDIRPREFIX}/_.bw" 163 164 cd ${NANO_SRC} 165 ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF} buildworld \ 166 > ${MAKEOBJDIRPREFIX}/_.bw 2>&1 167) 168 169build_kernel ( ) ( 170 echo "## build kernel ($NANO_KERNEL)" 171 echo "### log: ${MAKEOBJDIRPREFIX}/_.bk" 172 173 if [ -f ${NANO_KERNEL} ] ; then 174 cp ${NANO_KERNEL} ${NANO_SRC}/sys/${NANO_ARCH}/conf 175 fi 176 177 (cd ${NANO_SRC}; 178 # unset these just in case to avoid compiler complaints 179 # when cross-building 180 unset TARGET_CPUTYPE 181 unset TARGET_BIG_ENDIAN 182 ${NANO_PMAKE} buildkernel \ 183 __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ 184 > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 185 ) 186) 187 188clean_world ( ) ( 189 echo "## Clean and create world directory (${NANO_WORLDDIR})" 190 if rm -rf ${NANO_WORLDDIR}/ > /dev/null 2>&1 ; then 191 true 192 else 193 chflags -R noschg ${NANO_WORLDDIR}/ 194 rm -rf ${NANO_WORLDDIR}/ 195 fi 196 mkdir -p ${NANO_WORLDDIR}/ 197) 198 199make_conf_install ( ) ( 200 echo "## Construct install make.conf ($NANO_MAKE_CONF)" 201 202 echo "${CONF_WORLD}" > ${NANO_MAKE_CONF} 203 echo "${CONF_INSTALL}" >> ${NANO_MAKE_CONF} 204) 205 206install_world ( ) ( 207 echo "## installworld" 208 echo "### log: ${MAKEOBJDIRPREFIX}/_.iw" 209 210 cd ${NANO_SRC} 211 ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF} installworld \ 212 DESTDIR=${NANO_WORLDDIR} \ 213 > ${MAKEOBJDIRPREFIX}/_.iw 2>&1 214 chflags -R noschg ${NANO_WORLDDIR} 215) 216 217install_etc ( ) ( 218 219 echo "## install /etc" 220 echo "### log: ${MAKEOBJDIRPREFIX}/_.etc" 221 222 cd ${NANO_SRC} 223 ${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF} distribution \ 224 DESTDIR=${NANO_WORLDDIR} \ 225 > ${MAKEOBJDIRPREFIX}/_.etc 2>&1 226) 227 228install_kernel ( ) ( 229 echo "## install kernel" 230 echo "### log: ${MAKEOBJDIRPREFIX}/_.ik" 231 232 cd ${NANO_SRC} 233 ${NANO_PMAKE} installkernel \ 234 DESTDIR=${NANO_WORLDDIR} \ 235 __MAKE_CONF=${NANO_MAKE_CONF} KERNCONF=`basename ${NANO_KERNEL}` \ 236 > ${MAKEOBJDIRPREFIX}/_.ik 2>&1 237) 238 239run_customize() ( 240 241 echo "## run customize scripts" 242 for c in $NANO_CUSTOMIZE 243 do 244 echo "## customize \"$c\"" 245 echo "### log: ${MAKEOBJDIRPREFIX}/_.cust.$c" 246 echo "### `type $c`" 247 ( $c ) > ${MAKEOBJDIRPREFIX}/_.cust.$c 2>&1 248 done 249) 250 251run_late_customize() ( 252 253 echo "## run late customize scripts" 254 for c in $NANO_LATE_CUSTOMIZE 255 do 256 echo "## late customize \"$c\"" 257 echo "### log: ${MAKEOBJDIRPREFIX}/_.late_cust.$c" 258 echo "### `type $c`" 259 ( $c ) > ${MAKEOBJDIRPREFIX}/_.late_cust.$c 2>&1 260 done 261) 262 263setup_nanobsd ( ) ( 264 echo "## configure nanobsd setup" 265 echo "### log: ${MAKEOBJDIRPREFIX}/_.dl" 266 267 ( 268 cd ${NANO_WORLDDIR} 269 270 # Move /usr/local/etc to /etc/local so that the /cfg stuff 271 # can stomp on it. Otherwise packages like ipsec-tools which 272 # have hardcoded paths under ${prefix}/etc are not tweakable. 273 if [ -d usr/local/etc ] ; then 274 ( 275 mkdir etc/local 276 cd usr/local/etc 277 find . -print | cpio -dumpl ../../../etc/local 278 cd .. 279 rm -rf etc 280 ln -s ../../etc/local etc 281 ) 282 fi 283 284 for d in var etc 285 do 286 # link /$d under /conf 287 # we use hard links so we have them both places. 288 # the files in /$d will be hidden by the mount. 289 # XXX: configure /$d ramdisk size 290 mkdir -p conf/base/$d conf/default/$d 291 find $d -print | cpio -dumpl conf/base/ 292 done 293 294 echo "$NANO_RAM_ETCSIZE" > conf/base/etc/md_size 295 echo "$NANO_RAM_TMPVARSIZE" > conf/base/var/md_size 296 297 # pick up config files from the special partition 298 echo "mount -o ro /dev/${NANO_DRIVE}s3" > conf/default/etc/remount 299 300 # Put /tmp on the /var ramdisk (could be symlink already) 301 rmdir tmp || true 302 rm tmp || true 303 ln -s var/tmp tmp 304 305 ) > ${MAKEOBJDIRPREFIX}/_.dl 2>&1 306) 307 308setup_nanobsd_etc ( ) ( 309 echo "## configure nanobsd /etc" 310 311 ( 312 cd ${NANO_WORLDDIR} 313 314 # create diskless marker file 315 touch etc/diskless 316 317 # Make root filesystem R/O by default 318 echo "root_rw_mount=NO" >> etc/defaults/rc.conf 319 320 # save config file for scripts 321 echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf 322 323 echo "/dev/${NANO_DRIVE}s1a / ufs ro 1 1" > etc/fstab 324 echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab 325 mkdir -p cfg 326 ) 327) 328 329prune_usr() ( 330 331 # Remove all empty directories in /usr 332 find ${NANO_WORLDDIR}/usr -type d -depth -print | 333 while read d 334 do 335 rmdir $d > /dev/null 2>&1 || true 336 done 337) 338 339create_i386_diskimage ( ) ( 340 echo "## build diskimage" 341 echo "### log: ${MAKEOBJDIRPREFIX}/_.di" 342 343 ( 344 echo $NANO_MEDIASIZE $NANO_IMAGES \ 345 $NANO_SECTS $NANO_HEADS \ 346 $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | 347 awk ' 348 { 349 printf "# %s\n", $0 350 351 # size of cylinder in sectors 352 cs = $3 * $4 353 354 # number of full cylinders on media 355 cyl = int ($1 / cs) 356 357 # output fdisk geometry spec, truncate cyls to 1023 358 if (cyl <= 1023) 359 print "g c" cyl " h" $4 " s" $3 360 else 361 print "g c" 1023 " h" $4 " s" $3 362 363 if ($7 > 0) { 364 # size of data partition in full cylinders 365 dsl = int (($7 + cs - 1) / cs) 366 } else { 367 dsl = 0; 368 } 369 370 # size of config partition in full cylinders 371 csl = int (($6 + cs - 1) / cs) 372 373 if ($5 == 0) { 374 # size of image partition(s) in full cylinders 375 isl = int ((cyl - dsl - csl) / $2) 376 } else { 377 isl = int (($5 + cs - 1) / cs) 378 } 379 380 # First image partition start at second track 381 print "p 1 165 " $3, isl * cs - $3 382 c = isl * cs; 383 384 # Second image partition (if any) also starts offset one 385 # track to keep them identical. 386 if ($2 > 1) { 387 print "p 2 165 " $3 + c, isl * cs - $3 388 c += isl * cs; 389 } 390 391 # Config partition starts at cylinder boundary. 392 print "p 3 165 " c, csl * cs 393 c += csl * cs 394 395 # Data partition (if any) starts at cylinder boundary. 396 if ($7 > 0) { 397 print "p 4 165 " c, dsl * cs 398 } else if ($7 < 0 && $1 > c) { 399 print "p 4 165 " c, $1 - c 400 } else if ($1 < c) { 401 print "Disk space overcommitted by", \ 402 c - $1, "sectors" > "/dev/stderr" 403 exit 2 404 } 405 } 406 ' > ${MAKEOBJDIRPREFIX}/_.fdisk 407 408 IMG=${NANO_DISKIMGDIR}/_.disk.full 409 MNT=${MAKEOBJDIRPREFIX}/_.mnt 410 mkdir -p ${MNT} 411 412 if [ "${NANO_MD_BACKING}" = "swap" ] ; then 413 MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ 414 -y ${NANO_HEADS}` 415 else 416 echo "Creating md backing file..." 417 dd if=/dev/zero of=${IMG} bs=${NANO_SECTS}b \ 418 count=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}` 419 MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ 420 -y ${NANO_HEADS}` 421 fi 422 423 trap "df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT 424 425 fdisk -i -f ${MAKEOBJDIRPREFIX}/_.fdisk ${MD} 426 fdisk ${MD} 427 # XXX: params 428 # XXX: pick up cached boot* files, they may not be in image anymore. 429 boot0cfg -B -b ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ${NANO_BOOT0CFG} ${MD} 430 bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}s1 431 bsdlabel ${MD}s1 432 433 # Create first image 434 newfs ${NANO_NEWFS} /dev/${MD}s1a 435 mount /dev/${MD}s1a ${MNT} 436 df -i ${MNT} 437 echo "Copying worlddir..." 438 ( cd ${NANO_WORLDDIR} && find . -print | cpio -dump ${MNT} ) 439 df -i ${MNT} 440 echo "Generating mtree..." 441 ( cd ${MNT} && mtree -c ) > ${MAKEOBJDIRPREFIX}/_.mtree 442 ( cd ${MNT} && du -k ) > ${MAKEOBJDIRPREFIX}/_.du 443 umount ${MNT} 444 445 if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then 446 # Duplicate to second image (if present) 447 echo "Duplicating to second image..." 448 dd if=/dev/${MD}s1 of=/dev/${MD}s2 bs=64k 449 mount /dev/${MD}s2a ${MNT} 450 for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab 451 do 452 sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f 453 done 454 umount ${MNT} 455 456 fi 457 458 # Create Config slice 459 newfs ${NANO_NEWFS} /dev/${MD}s3 460 # XXX: fill from where ? 461 462 # Create Data slice, if any. 463 if [ $NANO_DATASIZE -gt 0 ] ; then 464 newfs ${NANO_NEWFS} /dev/${MD}s4 465 # XXX: fill from where ? 466 fi 467 468 if [ "${NANO_MD_BACKING}" = "swap" ] ; then 469 echo "Writing out _.disk.full..." 470 dd if=/dev/${MD} of=${IMG} bs=64k 471 fi 472 473 echo "Writing out _.disk.image..." 474 dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k 475 mdconfig -d -u $MD 476 ) > ${MAKEOBJDIRPREFIX}/_.di 2>&1 477) 478 479last_orders () ( 480 # Redefine this function with any last orders you may have 481 # after the build completed, for instance to copy the finished 482 # image to a more convenient place: 483 # cp ${MAKEOBJDIRPREFIX}/_.disk.image /home/ftp/pub/nanobsd.disk 484) 485 486####################################################################### 487# 488# Optional convenience functions. 489# 490####################################################################### 491 492####################################################################### 493# Common Flash device geometries 494# 495 496FlashDevice () { 497 if [ -d ${NANO_TOOLS} ] ; then 498 . ${NANO_TOOLS}/FlashDevice.sub 499 else 500 . ${NANO_SRC}/${NANO_TOOLS}/FlashDevice.sub 501 fi 502 sub_FlashDevice $1 $2 503} 504 505 506####################################################################### 507# Setup serial console 508 509cust_comconsole () ( 510 # Enable getty on console 511 sed -i "" -e /tty[du]0/s/off/on/ ${NANO_WORLDDIR}/etc/ttys 512 513 # Disable getty on syscons devices 514 sed -i "" -e '/^ttyv[0-8]/s/ on/ off/' ${NANO_WORLDDIR}/etc/ttys 515 516 # Tell loader to use serial console early. 517 echo " -h" > ${NANO_WORLDDIR}/boot.config 518) 519 520####################################################################### 521# Allow root login via ssh 522 523cust_allow_ssh_root () ( 524 sed -i "" -e '/PermitRootLogin/s/.*/PermitRootLogin yes/' \ 525 ${NANO_WORLDDIR}/etc/ssh/sshd_config 526) 527 528####################################################################### 529# Install the stuff under ./Files 530 531cust_install_files () ( 532 cd ${NANO_TOOLS}/Files 533 find . -print | grep -v /CVS | cpio -dumpv ${NANO_WORLDDIR} 534) 535 536####################################################################### 537# Install packages from ${NANO_PACKAGE_DIR} 538 539cust_pkg () ( 540 541 # Copy packages into chroot 542 mkdir -p ${NANO_WORLDDIR}/Pkg 543 cp ${NANO_PACKAGE_DIR}/* ${NANO_WORLDDIR}/Pkg 544 545 # Count & report how many we have to install 546 todo=`ls ${NANO_WORLDDIR}/Pkg | wc -l` 547 echo "=== TODO: $todo" 548 ls ${NANO_WORLDDIR}/Pkg 549 echo "===" 550 while true 551 do 552 # Record how may we have now 553 have=`ls ${NANO_WORLDDIR}/var/db/pkg | wc -l` 554 555 # Attempt to install more packages 556 # ...but no more than 200 at a time due to pkg_add's internal 557 # limitations. 558 chroot ${NANO_WORLDDIR} sh -c \ 559 'ls Pkg/*tbz | xargs -n 200 pkg_add -F' || true 560 561 # See what that got us 562 now=`ls ${NANO_WORLDDIR}/var/db/pkg | wc -l` 563 echo "=== NOW $now" 564 ls ${NANO_WORLDDIR}/var/db/pkg 565 echo "===" 566 567 568 if [ $now -eq $todo ] ; then 569 echo "DONE $now packages" 570 break 571 elif [ $now -eq $have ] ; then 572 echo "FAILED: Nothing happened on this pass" 573 exit 2 574 fi 575 done 576 rm -rf ${NANO_WORLDDIR}/Pkg 577) 578 579####################################################################### 580# Convenience function: 581# Register $1 as customize function. 582 583customize_cmd () { 584 NANO_CUSTOMIZE="$NANO_CUSTOMIZE $1" 585} 586 587####################################################################### 588# Convenience function: 589# Register $1 as late customize function to run just before 590# image creation. 591 592late_customize_cmd () { 593 NANO_LATE_CUSTOMIZE="$NANO_LATE_CUSTOMIZE $1" 594} 595 596####################################################################### 597# 598# All set up to go... 599# 600####################################################################### 601 602usage () { 603 ( 604 echo "Usage: $0 [-b/-k/-w] [-c config_file]" 605 echo " -b suppress builds (both kernel and world)" 606 echo " -k suppress buildkernel" 607 echo " -w suppress buildworld" 608 echo " -i suppress disk image build" 609 echo " -c specify config file" 610 ) 1>&2 611 exit 2 612} 613 614####################################################################### 615# Parse arguments 616 617do_kernel=true 618do_world=true 619do_image=true 620 621set +e 622args=`getopt bc:hkwi $*` 623if [ $? -ne 0 ] ; then 624 usage 625 exit 2 626fi 627set -e 628 629set -- $args 630for i 631do 632 case "$i" 633 in 634 -b) 635 shift; 636 do_world=false 637 do_kernel=false 638 ;; 639 -k) 640 shift; 641 do_kernel=false 642 ;; 643 -c) 644 . "$2" 645 shift; 646 shift; 647 ;; 648 -h) 649 usage 650 ;; 651 -i) 652 do_image=false 653 ;; 654 -w) 655 shift; 656 do_world=false 657 ;; 658 --) 659 shift; 660 break; 661 esac 662done 663 664if [ $# -gt 0 ] ; then 665 echo "$0: Extraneous arguments supplied" 666 usage 667fi 668 669####################################################################### 670# Setup and Export Internal variables 671# 672if [ "x${NANO_OBJ}" = "x" ] ; then 673 MAKEOBJDIRPREFIX=/usr/obj/nanobsd.${NANO_NAME}/ 674 NANO_OBJ=${MAKEOBJDIRPREFIX} 675else 676 MAKEOBJDIRPREFIX=${NANO_OBJ} 677fi 678 679if [ "x${NANO_DISKIMGDIR}" = "x" ] ; then 680 NANO_DISKIMGDIR=${MAKEOBJDIRPREFIX} 681fi 682 683NANO_WORLDDIR=${MAKEOBJDIRPREFIX}/_.w 684NANO_MAKE_CONF=${MAKEOBJDIRPREFIX}/make.conf 685 686if [ -d ${NANO_TOOLS} ] ; then 687 true 688elif [ -d ${NANO_SRC}/${NANO_TOOLS} ] ; then 689 NANO_TOOLS=${NANO_SRC}/${NANO_TOOLS} 690else 691 echo "NANO_TOOLS directory does not exist" 1>&2 692 exit 1 693fi 694 695export MAKEOBJDIRPREFIX 696 697export NANO_ARCH 698export NANO_CODESIZE 699export NANO_CONFSIZE 700export NANO_CUSTOMIZE 701export NANO_DATASIZE 702export NANO_DRIVE 703export NANO_HEADS 704export NANO_IMAGES 705export NANO_MAKE_CONF 706export NANO_MEDIASIZE 707export NANO_NAME 708export NANO_NEWFS 709export NANO_OBJ 710export NANO_PMAKE 711export NANO_SECTS 712export NANO_SRC 713export NANO_TOOLS 714export NANO_WORLDDIR 715export NANO_BOOT0CFG 716export NANO_BOOTLOADER 717 718####################################################################### 719# And then it is as simple as that... 720 721if $do_world ; then 722 clean_build 723 make_conf_build 724 build_world 725else 726 echo "## Skipping buildworld (as instructed)" 727fi 728 729if $do_kernel ; then 730 build_kernel 731else 732 echo "## Skipping buildkernel (as instructed)" 733fi 734 735clean_world 736make_conf_install 737install_world 738install_etc 739setup_nanobsd_etc 740install_kernel 741 742run_customize 743setup_nanobsd 744prune_usr 745run_late_customize 746if $do_image ; then 747 create_${NANO_ARCH}_diskimage 748else 749 echo "## Skipping image build (as instructed)" 750fi 751last_orders 752 753echo "# NanoBSD image completed" 754