4 # $Id: build,v 1.14 1999/08/22 21:42:30 dwhite Exp $
6 # You can set the SRC variable which points to your source tree. It's
7 # /usr/src by default (most people shouldn't change it).
10 # --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------
11 # The "build" script will ask you for parameters. Just run it... :-)
12 # --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------
14 # EDITOR is the editor you use
16 # LANGUAGE language to be used (en or pl)
18 # SITE site-specific files
21 # FLOPPY_SIZE floppy size in KB (default to 1440)
24 # DEVFS is currently broken. Always set this.
28 # RISU is where dialog replies go.
31 # abort in case of error...
36 # assign default values to variables.
38 TYPE=${TYPE:-dial} # PicoBSD type (isp, router, net, custom, ...
40 while read name suff sz init mfs_in floppy_in ; do
41 if [ "$name" != "#" -a $name != "" ] ; then
42 eval ${name}_suffix=$suff
43 eval ${name}_DFLT_SIZE=$sz
44 eval ${name}_INIT=$init
45 eval ${name}_MFS_INODES=$mfs_in
46 eval ${name}_FLOPPY_INODES=$floppy_in
49 # build MFS - Byte/inode -
50 # name suffix DFLT_SZ init MFS FLOPPY
51 dial -D 1600 init 4096 32768
52 router -R 820 oinit 3072 32768
53 net -N 2200 init 4096 32768
54 isp -I 2400 init 4096 32768
55 custom -C 2400 init 8192 32768
61 if [ "X${TYPE}" = "Xcustom" ] ; then
62 MSG1="${MSG1} (from ${CUST_DIR})"
65 MSG="PicoBSD build -- Current parameters:\n\n\t1. ${MSG1}\n\
66 \t2. MFS size: ${SIZE} kB\n\t3. Language: ${LANGUAGE}\n\
67 \t4. Site-info: ${SITE}\n"
71 # Main build procedure. It calls another scripts (stage1)
79 echo "-> We'll use the sources living in ${SRC}"
81 echo "-> I hope you have checked the ../${TYPE}/PICOBSD config file..."
86 export SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
87 export SITE MFS_INODES FLOPPY_INODES FLOPPY_SIZE
89 # Build the kernel, if necessary
91 echo "-> Checking if we have to build the PICOBSD kernel..."
92 (cd ../${TYPE}; make -f ../build/Makefile.conf )
95 ./stage1 2>&1 | tee stage1.out
96 if [ "X$?" != "X0" ] ; then
98 echo "-> ERROR in \"${i}\" script. Aborting the build process."
99 echo -n "-> Cleaning temporary files... "
101 vnconfig -u /dev/rvn0
106 echo "==================== ${i} completed ====================="
109 # check for existing custom config directory and ask user if they want to use it
111 check_for_old_custom() {
113 if [ ! -d ../custom ] ; then
117 echo " Custom directory setup"
119 echo "There is an existing custom configuration linked to"
120 ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'
122 read -p "Do you wish to use the existing custom directory? (yes/no): " KEEP_CUSTOM
125 # Ask for, and set the custom config directory
128 dialog --title "Custom directory setup" --inputbox \
129 "Please enter the full path to the directory containing your \
131 This directory tree must be laid out exactly like the standard \
132 ones. (E.g. you can type in /home/abial/work/custom, which \
133 should contain crunch1/, floppy.tree/, lang/ )." \
135 CUST_DIR=`cat ${RISU}`
138 # Set type of floppy interactively. Also set the various defaults
139 # associated to each type. We can override them manually afterwards.
143 eval SIZE=$"${TYPE}_DFLT_SIZE"
144 eval INIT=$"${TYPE}_INIT"
145 eval MFS_INODES=$"${TYPE}_MFS_INODES"
146 eval FLOPPY_INODES=$"${TYPE}_FLOPPY_INODES"
147 eval suffix=$"${TYPE}_suffix"
152 if [ "X${KEEP_CUSTOM}" != "Xyes" ] ; then
153 [ -r ../custom ] && rm -f ../custom
155 (cd ..; ln -sf ${CUST_DIR} custom)
165 echo "##############################################" >>build.status
166 echo "## `date` ">>build.status
167 echo "##############################################" >>build.status
170 for z in dial router net isp ; do
174 echo "---------------------------------------------">>build.status
175 echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${SIZE}" >>build.status
177 if [ "X$?" != "X0" ] ; then
178 echo " ** FAILED! **">>build.status
180 echo " (ok)">>build.status
182 mv picobsd.bin pb_${y}${suffix}.bin
183 echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${SIZE}">>build.status
190 # Set build parameters interactively
195 dialog --menu "PicoBSD build menu -- ver ${VER} (22aug1999)" 19 70 12 \
196 N "No change, build it" \
198 K "edit Kernel config file for ${TYPE}" \
199 E "Edit crunch.conf file for ${TYPE}" \
200 S "MFS Size: ${SIZE}kB" \
201 L "Language: ${LANGUAGE}" \
202 I "Init type: ${INIT}" \
203 F "Floppy size: ${FLOPPY_SIZE}kB" \
204 M "MFS bytes per inode: ${MFS_INODES}" \
205 U "UFS bytes per inode: ${FLOPPY_INODES}" \
206 $ "Site-info: ${SITE}" \
213 dialog --menu "Setup the type of configuration" 12 70 5 \
214 dial "dialin (ppp etc.)" \
215 router "router/bridge/mrouter" \
216 net "net admin tool" \
217 isp "isp (ppp and terminal server)" \
218 custom "custom config (need pathname)" 2> ${RISU} || rm ${RISU}
219 if [ -f ${RISU} ] ; then
225 dialog --menu "Choose your init(8) program" \
226 10 70 2 init "Standard init (requires getty)" \
227 oinit "small init from TinyWare" 2> ${RISU} || rm ${RISU}
228 if [ -f ${RISU} ] ; then
233 K) ${EDITOR} ../${TYPE}/PICOBSD ;;
235 E) ${EDITOR} ../${TYPE}/crunch1/crunch.conf ;;
238 dialog --title "MFS Size setup" --inputbox \
239 "MFS size depends on what you need to put on the MFS image. Typically \
240 ranges between 820kB (for very small bridge/router images) to \
241 as much as 2500kB kB for a densely packed image. \
242 Keep in mind that this memory is \
243 totally lost to other programs. Usually you want to keep \
244 this as small as possible. " 10 70 2> ${RISU} || rm ${RISU}
245 if [ -f ${RISU} ] ; then
247 if [ "${SIZE}" = "" ] ; then
248 eval SIZE=$"${TYPE}_DFLT_SIZE"
254 dialog --menu "Please choose language" \
255 10 40 2 en English pl Polish 2> ${RISU} || rm ${RISU}
256 if [ -f ${RISU} ] ; then
257 LANGUAGE=`cat ${RISU}`
262 dialog --title "Site info setup" --inputbox \
263 "Please enter the full path to the directory \
264 containing site-specific setup. \
265 This directory tree must contain files that replace \
266 standard ones in floppy.tree/ and mfs.tree/ . " \
267 10 70 2> ${RISU} || rm ${RISU}
268 if [ -f ${RISU} ] ; then
274 dialog --menu "Set floppy size" 15 70 4 \
275 1440 "1.44MB" 1720 "1.72MB" \
276 2880 "2.88MB" 4096 "4MB" 2> ${RISU} || rm ${RISU}
277 if [ -f ${RISU} ] ; then
278 FLOPPY_SIZE=`cat ${RISU}`
283 dialog --title "MFS bytes per inode:" --inputbox \
284 "Enter MFS bytes per inode (typically 4096..65536). \
285 A larger value means fewer inodes but more space on MFS" \
286 10 70 2> ${RISU} || rm ${RISU}
287 if [ -f ${RISU} ] ; then
288 MFS_INODES=`cat ${RISU}`
289 if [ "${MFS_INODES}" = "" ] ; then
290 eval MFS_INODES=$"${TYPE}_DFLT_MFS_INODES"
296 dialog --title "Floppy bytes per inode:" --inputbox \
297 "Enter floppy bytes per inode (typically 3072..65536). \
298 A larger value means fewer inodes but more space on the floppy." \
299 10 70 2> ${RISU} || rm ${RISU}
300 if [ -f ${RISU} ] ; then
301 FLOPPY_INODES=`cat ${RISU}`
302 if [ "${FLOPPY_INODES}" = "" ] ; then
303 eval FLOPPY_INODES=$"${TYPE}_DFLT_FLOPPY_INODES"
313 *) echo "
\aUnknown option \"${ans}\". Try again."
321 # Call the build procedure
324 dialog --title "Build ${TYPE} completed" --inputbox \
325 "\nThe build process was completed successfuly.\n\
326 Now we are going to install the image on the floppy.\n\
327 Please insert a blank floppy in /dev/fd0.\\n
328 WARNING: the contents of the floppy will be permanently erased!\n\
331 * ^C or [Cancel] to abort,\n\
332 * Enter to install \"${FILENAME}\",\n\
333 * name of other file to install.\n\
335 if [ "$?" = "0" ]; then
336 FILENAME=`cat ${RISU}`
337 if [ "${FILENAME}" = "" ] ; then
340 echo "Writing ${FILENAME}..."
341 dd if=${FILENAME} of=/dev/rfd0
343 echo "Ok, the image is in picobsd.bin"
348 #-------------------------------------------------------------------
349 # Main entry of the script
352 if [ "$1" = "-n" ] ; then
360 # If $1="package", it creates a neat set of floppies
362 if [ "$1" = "package" ] ; then
365 if [ "$interactive" = "YES" ] ; then