picobsd (76459) | picobsd (78494) |
---|---|
1#!/bin/sh - 2# | 1#!/bin/sh - 2# |
3# $FreeBSD: head/release/picobsd/build/picobsd 76459 2001-05-11 07:39:40Z luigi $ | 3# $FreeBSD: head/release/picobsd/build/picobsd 78494 2001-06-20 14:16:48Z luigi $ |
4# 5# The new PicoBSD build script. Invoked as 6# 7# picobsd [options] floppy_type site_name 8# 9# Where floppy_type is a directory where the picobsd config info 10# is held, and ${floppy_type}/floppy.tree.${site_name} contains 11# optional site-specific configuration. 12# 13# For Options, see the bottom of the file where the processing is | 4# 5# The new PicoBSD build script. Invoked as 6# 7# picobsd [options] floppy_type site_name 8# 9# Where floppy_type is a directory where the picobsd config info 10# is held, and ${floppy_type}/floppy.tree.${site_name} contains 11# optional site-specific configuration. 12# 13# For Options, see the bottom of the file where the processing is |
14# done... so | 14# done. The picobsd(8) manpage might be of some help, but code and docs 15# tend to lose sync over time... |
15# 16# This script depends on the following files: 17# 18# in ${PICO_TREE} : 19# Makefile.conf Makefile used to build the kernel 20# config shell variables, sourced here. 21# mfs.mtree mtree config file 22# --- 9 unchanged lines hidden (view full) --- 32# floppy.tree.${site}/ same as above, site specific. 33 34# 35#--- here are various functions used by the script. 36#--- The main entry point is at the end. 37# 38 39# initialize some shell variables used by the script. | 16# 17# This script depends on the following files: 18# 19# in ${PICO_TREE} : 20# Makefile.conf Makefile used to build the kernel 21# config shell variables, sourced here. 22# mfs.mtree mtree config file 23# --- 9 unchanged lines hidden (view full) --- 33# floppy.tree.${site}/ same as above, site specific. 34 35# 36#--- here are various functions used by the script. 37#--- The main entry point is at the end. 38# 39 40# initialize some shell variables used by the script. |
41# This must be done after option parsing so user-specified values 42# are used to compute dependent ones. Make sure to use the 43# VAR=${VAR:-value} construct for those variables which can 44# be overridden from the command line. |
|
40 41init_vars() { # OK 42 43 # if you include the floppy tree in the mfs, you | 45 46init_vars() { # OK 47 48 # if you include the floppy tree in the mfs, you |
44 # can boot from the image via diskless. 45 INCLUDE_FLOPPY_IN_MFS="yes" | 49 # can boot from the image via diskless. Default to yes. 50 INCLUDE_FLOPPY_IN_MFS=${INCLUDE_FLOPPY_IN_MFS:-yes} |
46 47 # SRC points to your FreeBSD source tree. 48 # OBJ points to the obj tree. Normally /usr/obj-pico. 49 # PICO_TREE is where standard picobsd stuff resides. 50 # MY_TREE (set later) is where this floppy type resides. 51 # START_DIR is the directory where we start 52 # BUILDDIR is the build directory, which is the current one. 53 54 SRC=${SRC:-/usr/src} 55 OBJ=${OBJ:-/usr/obj-pico} | 51 52 # SRC points to your FreeBSD source tree. 53 # OBJ points to the obj tree. Normally /usr/obj-pico. 54 # PICO_TREE is where standard picobsd stuff resides. 55 # MY_TREE (set later) is where this floppy type resides. 56 # START_DIR is the directory where we start 57 # BUILDDIR is the build directory, which is the current one. 58 59 SRC=${SRC:-/usr/src} 60 OBJ=${OBJ:-/usr/obj-pico} |
56 PICO_TREE=${PICO_TREE:-/usr/src/release/picobsd} | 61 PICO_TREE=${PICO_TREE:-${SRC}/release/picobsd} |
57 START_DIR=`pwd` 58 59 # Various temporary files and directories. 60 # User replies will be put in $RISU 61 RISU=${RISU:-`mktemp "/tmp/reply.XXXXXXXXXX"`} 62 MFS_MOUNTPOINT=`mktemp -d "/tmp/picobsd.XXXXXXXXXX"` 63 64 MFS_NAME=fs.PICOBSD 65 66 # EDITOR is the editor you use 67 # SITE is site_name above. 68 # FLOPPY_SIZE floppy size in KB (default to 1440). You can use 1480, 69 # 1720, 2880, etc. but beware that only 1440 and 1480 will boot 70 # from 1.44M floppy drives (1480 will not work on vmware). 71 EDITOR=${EDITOR:-vi} | 62 START_DIR=`pwd` 63 64 # Various temporary files and directories. 65 # User replies will be put in $RISU 66 RISU=${RISU:-`mktemp "/tmp/reply.XXXXXXXXXX"`} 67 MFS_MOUNTPOINT=`mktemp -d "/tmp/picobsd.XXXXXXXXXX"` 68 69 MFS_NAME=fs.PICOBSD 70 71 # EDITOR is the editor you use 72 # SITE is site_name above. 73 # FLOPPY_SIZE floppy size in KB (default to 1440). You can use 1480, 74 # 1720, 2880, etc. but beware that only 1440 and 1480 will boot 75 # from 1.44M floppy drives (1480 will not work on vmware). 76 EDITOR=${EDITOR:-vi} |
72 SITE= | 77 SITE=${SITE:-} |
73 FLOPPY_SIZE=${FLOPPY_SIZE:-1440} 74 75 NO_DEVFS=yes # DEVFS is currently broken. Always set this. 76 77 # Find a suitable vnode 78 VNUM=`mount | awk "/vn/ { num++ } END { printf \"%d\", num }"` 79 log "---> Using vn${VNUM}..." 80 81 # Location of the boot blocks (in case you want them custom-built) 82 boot1=/boot/boot1 83 boot2=/boot/boot2 84 | 78 FLOPPY_SIZE=${FLOPPY_SIZE:-1440} 79 80 NO_DEVFS=yes # DEVFS is currently broken. Always set this. 81 82 # Find a suitable vnode 83 VNUM=`mount | awk "/vn/ { num++ } END { printf \"%d\", num }"` 84 log "---> Using vn${VNUM}..." 85 86 # Location of the boot blocks (in case you want them custom-built) 87 boot1=/boot/boot1 88 boot2=/boot/boot2 89 |
90 makeopts=${MAKEOPTS:--s} # be silent by default |
|
85 # abort in case of error... 86 set -e 87 88 trap fail 2 # catch user interrupt 89 free_vnode 90} 91 92# log something on stdout if verbose. --- 6 unchanged lines hidden (view full) --- 99 100# set_type <type> looks for the floppy type specified as 101# first argument in user- or standard- directory. 102# If found set variables accordingly. 103 104set_type() { # OK 105 a=$1 106 for i in ${START_DIR}/${a} ${PICO_TREE}/${a} ; do | 91 # abort in case of error... 92 set -e 93 94 trap fail 2 # catch user interrupt 95 free_vnode 96} 97 98# log something on stdout if verbose. --- 6 unchanged lines hidden (view full) --- 105 106# set_type <type> looks for the floppy type specified as 107# first argument in user- or standard- directory. 108# If found set variables accordingly. 109 110set_type() { # OK 111 a=$1 112 for i in ${START_DIR}/${a} ${PICO_TREE}/${a} ; do |
113 log "set_type: checking $i" |
|
107 if [ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] ; then 108 set -- `cat $i/PICOBSD | \ 109 awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'` 110 if [ "$1" != "" ]; then 111 MFS_SIZE=$1 ; INIT=$2 112 MFS_INODES=$3 ; FLOPPY_INODES=$4 113 name=`(cd $i ; pwd) ` 114 name=`basename $name` --- 239 unchanged lines hidden (view full) --- 354 else 355 rm -f ${BUILDDIR}/kernel.gz ${BUILDDIR}/${MFS_NAME} # cleanup... 356 fi 357} 358 359# invoke the makefile to compile the kernel. 360# Then copy it here and strip as much as possible. 361do_kernel() { # OK | 114 if [ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] ; then 115 set -- `cat $i/PICOBSD | \ 116 awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'` 117 if [ "$1" != "" ]; then 118 MFS_SIZE=$1 ; INIT=$2 119 MFS_INODES=$3 ; FLOPPY_INODES=$4 120 name=`(cd $i ; pwd) ` 121 name=`basename $name` --- 239 unchanged lines hidden (view full) --- 361 else 362 rm -f ${BUILDDIR}/kernel.gz ${BUILDDIR}/${MFS_NAME} # cleanup... 363 fi 364} 365 366# invoke the makefile to compile the kernel. 367# Then copy it here and strip as much as possible. 368do_kernel() { # OK |
362 log "---> Preparing kernel "$name" in $MY_TREE" | 369 log "---> Preparing kernel \"$name\" in $MY_TREE" |
363 export name SRC # used in this makefile 364 (cd $MY_TREE; make -v -f ${PICO_TREE}/build/Makefile.conf ) 365 cp -p ${SRC}/sys/compile/PICOBSD-${name}/kernel ${BUILDDIR}/kernel || \ 366 fail $? missing_kernel 367 (cd ${BUILDDIR}; 368 strip kernel 369 strip --remove-section=.note --remove-section=.comment kernel 370 ) --- 119 unchanged lines hidden (view full) --- 490 sed -e "s@CWD@${MY_TREE}@" > $a 491 arg="" 492 if [ -f ${MY_TREE}/crunch.inc ] ; then 493 h="-h ${MY_TREE}/crunch.inc" 494 fi 495 crunchgen -p ${PICO_OBJ} -o $arg -m ${BUILDDIR}/crunch.mk $a || true 496 # failure is not critical here 497 log "Now make -f crunch.mk" | 370 export name SRC # used in this makefile 371 (cd $MY_TREE; make -v -f ${PICO_TREE}/build/Makefile.conf ) 372 cp -p ${SRC}/sys/compile/PICOBSD-${name}/kernel ${BUILDDIR}/kernel || \ 373 fail $? missing_kernel 374 (cd ${BUILDDIR}; 375 strip kernel 376 strip --remove-section=.note --remove-section=.comment kernel 377 ) --- 119 unchanged lines hidden (view full) --- 497 sed -e "s@CWD@${MY_TREE}@" > $a 498 arg="" 499 if [ -f ${MY_TREE}/crunch.inc ] ; then 500 h="-h ${MY_TREE}/crunch.inc" 501 fi 502 crunchgen -p ${PICO_OBJ} -o $arg -m ${BUILDDIR}/crunch.mk $a || true 503 # failure is not critical here 504 log "Now make -f crunch.mk" |
498 make -s -f ${BUILDDIR}/crunch.mk | 505 make ${makeopts} -f ${BUILDDIR}/crunch.mk |
499 strip --remove-section=.note --remove-section=.comment crunch1 500 mv crunch1 ${MFS_MOUNTPOINT}/stand/crunch 501 chmod 555 ${MFS_MOUNTPOINT}/stand/crunch 502 log "---> Making links for binaries..." 503 for i in `crunchgen -l $a` ; do 504 ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/${i}; 505 done 506 rm $a --- 138 unchanged lines hidden (view full) --- 645 free_vnode 646 rm -rf ${MFS_MOUNTPOINT} 647 rm ${BUILDDIR}/kernel.gz ${BUILDDIR}/${MFS_NAME} 648} 649 650#------------------------------------------------------------------- 651# Main entry of the script 652 | 506 strip --remove-section=.note --remove-section=.comment crunch1 507 mv crunch1 ${MFS_MOUNTPOINT}/stand/crunch 508 chmod 555 ${MFS_MOUNTPOINT}/stand/crunch 509 log "---> Making links for binaries..." 510 for i in `crunchgen -l $a` ; do 511 ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/${i}; 512 done 513 rm $a --- 138 unchanged lines hidden (view full) --- 652 free_vnode 653 rm -rf ${MFS_MOUNTPOINT} 654 rm ${BUILDDIR}/kernel.gz ${BUILDDIR}/${MFS_NAME} 655} 656 657#------------------------------------------------------------------- 658# Main entry of the script 659 |
653init_vars | 660verbose="" 661TAR_VERBOSE="" |
654 655while [ true ]; do 656 case $1 in | 662 663while [ true ]; do 664 case $1 in |
665 --src) # set the source path instead of /usr/src 666 SRC=$2 667 # Optionally creates include directory, and set cflags 668 # accordingly. Note that you will still need the right 669 # libraries... 670 671 #i=${SRC}/usr/include # the include directory... 672 #if [ \! -d $i ] ; then 673 # echo "Create \"$i\" as include directory" 674 # mkdir -p $i 675 # (cd ${SRC}; DESTDIR=${SRC} make includes ) 676 #fi 677 #CFLAGS="-nostdinc -I$i" ; export CFLAGS 678 shift 679 ;; |
|
657 --floppy_size) 658 FLOPPY_SIZE=$2 659 shift 660 ;; 661 -n) 662 interactive="NO" 663 ;; 664 -c*) # clean 665 clean="YES" 666 interactive="NO" 667 ;; 668 -v) 669 verbose="YES" 670 TAR_VERBOSE="v" | 680 --floppy_size) 681 FLOPPY_SIZE=$2 682 shift 683 ;; 684 -n) 685 interactive="NO" 686 ;; 687 -c*) # clean 688 clean="YES" 689 interactive="NO" 690 ;; 691 -v) 692 verbose="YES" 693 TAR_VERBOSE="v" |
694 makeopts="-d l" # be verbose |
|
671 ;; 672 *) 673 break ; 674 ;; 675 676 esac 677 shift 678done | 695 ;; 696 *) 697 break ; 698 ;; 699 700 esac 701 shift 702done |
703init_vars |
|
679 680THETYPE=$1 681SITE=$2 682set_type $THETYPE 683 684# If $1="package", it creates a neat set of floppies 685 686if [ "$1" = "package" ] ; then --- 13 unchanged lines hidden --- | 704 705THETYPE=$1 706SITE=$2 707set_type $THETYPE 708 709# If $1="package", it creates a neat set of floppies 710 711if [ "$1" = "package" ] ; then --- 13 unchanged lines hidden --- |