summaryrefslogtreecommitdiffstats
path: root/release/picobsd/build
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2009-03-24 16:03:46 +0000
committerluigi <luigi@FreeBSD.org>2009-03-24 16:03:46 +0000
commit6dd8d432a88c8f6e69c19591d48a19f5fefcbd54 (patch)
treed884e45a2c35d409fe7d596adb657e3fd63fc367 /release/picobsd/build
parentd645281c2823819de5d4554bf28f24363b50df02 (diff)
downloadFreeBSD-src-6dd8d432a88c8f6e69c19591d48a19f5fefcbd54.zip
FreeBSD-src-6dd8d432a88c8f6e69c19591d48a19f5fefcbd54.tar.gz
remove unused "package" entry.
default to use devfs (we do that anyways) Many small changes in comments
Diffstat (limited to 'release/picobsd/build')
-rwxr-xr-xrelease/picobsd/build/picobsd121
1 files changed, 55 insertions, 66 deletions
diff --git a/release/picobsd/build/picobsd b/release/picobsd/build/picobsd
index 85ed85a..20a693d 100755
--- a/release/picobsd/build/picobsd
+++ b/release/picobsd/build/picobsd
@@ -3,17 +3,17 @@
# $FreeBSD$
# This file requires sysutils/makefs to run
#
-# The new PicoBSD build script. Invoked as
+# The PicoBSD build script. Invoked as
#
-# picobsd [options] floppy_type site_name
+# picobsd [options] image_type [site_name]
#
-# Where floppy_type is a directory where the picobsd config info
-# is held, and ${floppy_type}/floppy.tree.${site_name} contains
+# Where image_type is a directory with the picobsd config info,
+# and ${image_type}/floppy.tree.${site_name} contains
# optional site-specific configuration.
#
# For Options, see the bottom of the file where the processing is
# done. The picobsd(8) manpage might be of some help, but code and docs
-# tend to lose sync over time...
+# tend to lose sync over time.
#
# This script depends on the following files:
#
@@ -33,36 +33,42 @@
# floppy.tree/ local additions to ${PICO_TREE}/mfs_free
# floppy.tree.${site}/ same as above, site specific.
# mfs_tree/ local additions to the mfs_free
-# buildtree.mk optional makefile to build an extension for floppy tree
+# buildtree.mk optional Makefile to build an extension for floppy tree
# (generated in buildtree/ )
#
#--- The main entry point is at the end.
#
-# There are two set of initialization. The first one (set_defaults)
-# is done on entry to the script, and is used to set default values
-# for all variables which do not depend on floppy type and source tree.
+# There are two initialization functions:
#
-# The second set is done after command line parsing, e.g.
-# to resolve dependencies on the source tree.
+# + set_defaults
+# is run on entry to the script, and is used to set default values
+# for all variables that do not depend on image type and source tree.
#
-# Naming:
+# + set_build_parameters
+# is run after command line parsing
+#
+# VARIABLE NAMES:
# + variables that control operation (e.g. verbosity) and are generally
# set from the command line have o_ ("option") as a name prefix
#
-# + variables which contain pathnames and values that should not change
+# + variables that contain pathnames and values that should not change
# have c_ ("constant") as a name prefix
#
# + variables exported to Makefiles and subshells are CAPITAL
#
# + variables local to the script are lowercase, possibly with
-# an l_ ("local") prefix
+# an l_ ("local") prefix.
+#
+# There are unfortunately exceptions:
+# name, l_usrtree, l_objtree
# SRC points to your FreeBSD source tree.
# l_usrtree points to the /usr subdir for the source tree.
# Normally /usr or ${SRC}/../usr
# l_objtree points to the obj tree. Normally ${l_usrtree}/obj-pico
+# c_label is either bsdlabel or disklabel
# PICO_TREE is where standard picobsd stuff resides.
# Normally ${SRC}/release/picobsd
# You can set SRC with --src <directory>
@@ -71,28 +77,27 @@
# MY_TREE (set later) is where this floppy type resides.
# BUILDDIR is the build directory
-# set some default values for variables.
-# needs to be done as the first thing in the script.
-
# log something on stdout if verbose.
o_verbose=0 # this needs to be here!
-log() {
+log() { # message
local foo
[ ${o_verbose} -gt 0 ] && printf "\n*** %s\n" "$*"
[ ${o_verbose} -gt 1 ] && read -p "=== Press enter to continue" foo
return 0
}
-logverbose() {
+# unconditionally log and wait for input
+logverbose() { # message
local foo
printf "\n*** %s\n" "$*"
read -p "=== Press enter to continue" foo
return 0
}
-set_defaults() {
- # no way to use logging in this function, variable not set yet.
+# set some default values for variables.
+# needs to be done as the first thing in the script.
+set_defaults() { # no arguments
# EDITOR is the editor you use
# fd_size floppy size in KB (default to 1440). You can use 1480,
# 1720, 2880, etc. but beware that only 1440 and 1480 will boot
@@ -101,15 +106,20 @@ set_defaults() {
fd_size=${fd_size:-1440}
o_use_loader="yes" # use /boot/loader
- o_all_in_mfs="yes" # put all files in mfs so you can boot and run
- # the image via diskless boot.
- o_clean="" # do not clean
+ # You should not change it unless you are really short
+ # of space, and your kernel is small enough that the
+ # bootblocks manage to load it.
+
+ o_all_in_mfs="yes" # put all files in mfs so you can boot
+ # and run the image via diskless boot.
+ o_clean="" # set if you want to clean prev.builds.
o_interactive="" # default is interactive
o_verbose=0 # verbose level, 0 is silent
o_tarv="" # tar verbose flag, "" or "v"
- o_init_src="" # non "" if we need to init libs and includes.
+ o_init_src="" # set to build libs and includes.
o_makeopts=${MAKEOPTS:--s} # make options, be silent by default
- o_no_devfs=yes # we do not want devfs
+ o_no_devfs= # default is use devfs.
+ # You should only set it when building 4.x images
o_do_modules="" # do not build modules
SRC="/usr/src" # default location for sources
@@ -132,13 +142,13 @@ set_defaults() {
c_img=picobsd.bin # filename used for the picobsd image
generate_iso="NO" # don't generate the iso image
- # select the right memory disk name
+ # select the right disklabel program
case `uname -r` in
- 7.*|6.*|5.*)
- l_label="bsdlabel"
+ 4.*)
+ c_label="disklabel"
;;
*)
- l_label="disklabel"
+ c_label="bsdlabel"
;;
esac
@@ -173,7 +183,7 @@ create_includes_and_libraries() {
log "create_includes_and_libraries() for ${SRC}"
# Optionally creates include directory and libraries.
- mkdir -p ${l_usrtree}/include # the include directory...
+ mkdir -p ${l_usrtree}/include # the include directory...
mkdir -p ${l_usrtree}/share/misc # a few things go here
mkdir -p ${l_usrtree}/lib # libraries
mkdir -p ${l_usrtree}/sbin # some binaries
@@ -210,11 +220,12 @@ create_includes_and_libraries() {
log "Libraries done"
}
-# set_type <type> looks in user or system directories for the floppy type
-# specified as first argument, and sets variables according to the config.
-# file. Also sets MY_TREE and BUILDDIR and SITE
+# set_type <the_type> [the_site] looks in user or system directories
+# for the directory named as the first argument, reads the configuration
+# files and sets variables according to the config.
+# Also sets MY_TREE and BUILDDIR and SITE
-set_type() {
+set_type() { # the_type the_site
local a i
log "set_type() : Type '$1' site '$2'"
@@ -312,27 +323,6 @@ build_image() {
fill_floppy_image # copies everything into the floppy
}
-build_package() {
- local z msg
-
- log "build_package()"
- rm -rf build.status
- echo "##############################################" >>build.status
- echo "## `date` ">>build.status
- echo "##############################################" >>build.status
- for z in bridge dial router net isp ; do
- set_type ${z}
- echo "---------------------------------------------">>build.status
- echo "Building TYPE=${z}, SIZE=${MFS_SIZE}" >>build.status
- msg="(ok)" # error message
- build_image || msg="** FAILED! **"
- echo " ${msg}">>build.status
- # where do i put things ?
- # clean_tree
- done
- exit 0
-}
-
# Set build parameters interactively
main_dialog() {
@@ -664,6 +654,7 @@ populate_mfs_tree() {
if [ -n "${copy_files}" ] ; then
do_copyfiles ${dst} copy_files
fi
+ do_copyfiles_user ${dst} || true
# The 'import_files' mechanism is deprecated, as it requires
# root permissions to follow the symlinks, and also does
@@ -829,22 +820,22 @@ fill_floppy_image() {
(cd ${BUILDDIR}
makefs -t ffs -o bsize=4096 -o fsize=512 \
-s ${blocks}k -f 50 ${c_img} ${dst}
- # ${l_label} -f `pwd`/${c_img}
- ${l_label} -w -f `pwd`/${c_img} auto # write in a label
+
+ ${c_label} -w -f `pwd`/${c_img} auto # write in a label
# copy partition c: into a: with some sed magic
- ${l_label} -f `pwd`/${c_img} | sed -e '/ c:/{p;s/c:/a:/;}' | \
- ${l_label} -R -f `pwd`/${c_img} /dev/stdin
- ${l_label} -f `pwd`/${c_img}
+ ${c_label} -f `pwd`/${c_img} | sed -e '/ c:/{p;s/c:/a:/;}' | \
+ ${c_label} -R -f `pwd`/${c_img} /dev/stdin
+ ${c_label} -f `pwd`/${c_img}
ls -l ${c_img}
- ${l_label} -f `pwd`/${c_img}
+ ${c_label} -f `pwd`/${c_img}
logverbose "after disklabel"
)
echo "BUILDDIR ${BUILDDIR}"
if [ "${generate_iso}" = "YES" ]; then
echo "generate_iso ${generate_iso}"
- #build_iso_image()
+ # build_iso_image # XXX not implemented yet
exit 1
fi
@@ -968,12 +959,10 @@ while [ true ]; do
esac
shift
done
+
set_build_parameters # things that depend on ${SRC}
set_type $1 $2 # type and site, respectively
-# If $1="package", it creates a neat set of floppies
-[ "$1" = "package" ] && build_package
-
[ "${o_interactive}" != "NO" ] && main_dialog
if [ "${o_clean}" = "YES" ] ; then
OpenPOWER on IntegriCloud