source: hybrid/branches/releng-10/nanobsd/cfg/nanobsd.wleiden.apu@ 13376

Last change on this file since 13376 was 13280, checked in by ed, 9 years ago

Change to give /etc fixed size of 8mb because default is 4mb and bit small.
Change to use 8Gb flash disk instead of 4Gb since these are easier to buy these days
Change to let the build script decide the size of the operating system slices

# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 1.8G 370M 1.3G 21% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/md0 8.9M 3.9M 4.2M 48% /etc
/dev/md1 37M 3.4M 31M 10% /var
/dev/md2 19M 24K 17M 0% /tmp

File size: 11.8 KB
Line 
1## Dit is een NanoBSD configuratie-template voor WirelessLeiden.
2## Instellingen weergegeven binnen dit bestand gelden als
3## standaard binnen de organisatie.
4## Tweaked for use with 2Gb SDcard, more VAR and TMP space in Alix.APU1C
5
6# Little hack to allow proper secify of KERNL/PKG location
7if [ -n "$NANO_CFG_FILE" ]; then
8 NANO_CONF_DIR=$(cd $(dirname $NANO_CFG_FILE); pwd -P)
9else
10 NANO_CONF_DIR=$(cd $(dirname $2); pwd -P)
11fi
12
13# object naam in /usr/obj/nanobsd.{obj}
14NANO_NAME=wleiden-hybrid
15NANO_SRC=/usr/src # nanobsd source tree
16NANO_TOOLS=$(pwd)
17NANO_KERNEL=$NANO_CONF_DIR/kernel.wleiden.apu # naam van het kernel configuratiebestand
18NANO_IMAGES=2 # aantal nanobsd code slices/installs (1/2)
19
20NANO_CONFSIZE=8192 # volume van de config slice, default 2048 (512bs)
21NANO_DATASIZE=0 # volume van de data slice, 0 = not configured
22NANO_CODESIZE=0 # Let buildscript the operating system slice as large as posible
23NANO_RAM_ETCSIZE=20480 # 10 Mb for /etc (10*1024*1024/512)
24NANO_RAM_TMPVARSIZE=81920 # 40Mb for /Var and /Tmp(40*1024*1024/512)
25
26NANO_DRIVE=da0 # Naam van de SD card
27
28#XXX: Eeks, fixed packages, needs building a hook to allow building the package
29# of the shelfs if needed, copy to right directory, done. With only input needed
30# a list of ports in the format like net/net-snmp
31NANO_PACKAGE_DIR=$NANO_CONF_DIR/../pkg/All
32NANO_PACKAGE_LIST="*"
33
34
35# Wireless Leiden ports from $WL_PORTSDIR are copied OVER $PORTSDIR
36PORTSDIR='/usr/ports'
37WL_PORTSDIR="$NANO_CONF_DIR/../ports/"
38
39# Dirty quirk to allow comments in part below
40PACKAGE_LIST=`cat <<EOF | sed -e 's/#.*$//g' | xargs
41benchmarks/iperf
42devel/py-yaml
43#dns/dnsmasq
44ftp/curl
45lang/python2
46lang/python
47net/ladvd
48net-mgmt/iftop
49net-mgmt/net-snmp
50net/mtr
51net/isc-dhcp42-server
52net/pen
53ports-mgmt/pkg
54security/sudo
55security/ca_root_nss
56sysutils/screen
57sysutils/ucspi-tcp
58www/apache24
59www/tinyproxy
60
61# Extra WL ports
62net/lvrouted
63`
64# Package target
65PKG_MAKE_ARGS="PACKAGES=$(dirname $NANO_PACKAGE_DIR) BATCH=yes PACKAGE_BUILDING=yes"
66
67PKG_MAKE_CONF="
68# www/py-cherrypy - include apache templating
69# net-mgmt/net-snmp - no perl please (size)
70# net-mgmt/nagios-plugins - no threading (single CPU)
71# shells/bash-static - logging via syslog
72# net/mtr - no X11 (no screen)
73OPTIONS_SET= APACHE FPING SYSLOG
74OPTIONS_UNSET= PERL PERL_EMBEDDED X11
75"
76
77##NANO_PACKAGE_LIST=
78
79# Warning: set to 1 to debug make build errors
80# Number of recurrent parrallel make builds
81if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
82 # Mac OS X Parallels virtual machine
83 NANO_PMAKE="make -B"
84else
85 # Default 2 times number of CPU's inside machine
86 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
87 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
88fi
89
90# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
91# anymore, but boot0 does (weird)
92NANO_BOOTLOADER="boot/boot0"
93
94# Strip down to a more acceptable size
95# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
96NANO_PRUNE="$NANO_PRUNE usr/share/examples"
97NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
98NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
99# NB! usr/share/misc contains termcap, vi(1) etc fails to work without it.
100# NANOBSD_PRUNE += usr/share/misc
101NANO_PRUNE="$NANO_PRUNE usr/share/pcvt"
102NANO_PRUNE="$NANO_PRUNE usr/share/me"
103NANO_PRUNE="$NANO_PRUNE usr/share/doc"
104
105
106
107
108
109# Opties parsed gedurende build & install world
110# Also check man 3 src.conf for details
111# Some flags are misleading, e.g. could only be installworld (e.g.), for details:
112# http://phk.freebsd.dk/misc/build_options/
113# For details on make options also check:
114# /usr/src/share/mk/bsd.own.mk
115CONF_COMMON='
116# Specific enabled options
117#WITHOUT_ACPI=YES # geen advanced configuration power interface
118#WITHOUT_BIND=YES # geen bind tools, dns/named geinstalleerd
119#WITHOUT_CXX=YES # Set to not build g++(1) and related libraries.
120#WITHOUT_GROFF=YES # Set to not build groff(1).
121#WITHOUT_INET6=YES # geen ondersteuning inet versie 6 architectuur
122#WITHOUT_INFO=YES # geen info bestanden, readable online docs
123#WITHOUT_IPFILTER=YES # geen ip filtering geinstalleerd
124#WITHOUT_KLDLOAD=YES # do not allow loading of kernel modules
125#WITHOUT_MAILWRAPPER=YES # geen mailwrapper bij gebruik sendmail
126#WITHOUT_MAN=YES # geen handleidingen gecompileerd
127#WITHOUT_MISC=YES # geen misc sub directory
128#WITHOUT_MODULES=YES # geen ondersteuning toevoegen modules
129#WITHOUT_PAM=YES # geen ondersteuning pa modules
130#WITHOUT_PF=YES # geen packet filtering geinstalleerd
131#WITHOUT_SHARE=YES # geen share sub directory
132#WITHOUT_USB=YES # geen ondersteuning usb modules
133# Specific disabled options
134WITHOUT_ATM=YES # geen ondersteuning Asynchronous Transfer Mode
135WITHOUT_AUDIT=YES # geen event auditing / audit trails
136WITHOUT_AUTHPF=YES # geen authenticating gateway user shell
137WITHOUT_BLUETOOTH=YES # geen ondersteuning Bluetooth modules
138WITHOUT_CALENDAR=YES # geen calendar reminder service gecompileerd
139WITHOUT_CDDL=YES # Set to not build code licensed under Sun CDDL. (also ZFS)
140WITHOUT_CPP=YES # Set to not build cpp(1).
141WITHOUT_CVS=YES # geen cvs tools geinstalleerd
142WITHOUT_DICT=YES # geen dictionary ondersteuning
143WITHOUT_EXAMPLES=YES # geen voorbeeld configuratiebestanden
144WITHOUT_FORTRAN=YES # geen ondersteuning fortran compilers
145WITHOUT_GAMES=YES # geen games gecompileerd
146WITHOUT_GCOV=YES # geen gcov test coverage program
147WITHOUT_GDB=YES # geen gnu debugger gecompileerd
148WITHOUT_GPIB=YES # geen ondersteuning gpib kaarten
149WITHOUT_HTML=YES # geen html help bestanden gecompileerd
150WITHOUT_I4B=YES # geen ondersteuning voor isdn
151WITHOUT_IPX=YES # geen ondersteuning ipx protocols
152WITHOUT_KERBEROS=YES # geen ondersteuning Kerberos authenticatie
153WITHOUT_LOCALES=YES # geen ondersteuning lokalisatie
154WITHOUT_LPR=YES # geen ondersteuning print services
155WITHOUT_NIS=YES # geen ondersteuning network information system
156WITHOUT_PROFILE=YES # Set to avoid compiling profiled libraries.
157WITHOUT_RCMDS=YES # geen ondersteuning rcmds,
158WITHOUT_RESCUE=YES # geen rescue bestanden gecompileerd
159WITHOUT_SENDMAIL=YES # geen sendmail geinstalleerd
160WITHOUT_SHAREDOCS=YES # geen share/docs directories
161WITHOUT_SYSCONS=YES # geen syscon devices gecompileerd
162'
163
164CONF_BUILD="
165${CONF_COMMON}
166"
167
168CONF_INSTALL="
169${CONF_COMMON}
170WITHOUT_TOOLCHAIN=YES # geen freebsd toolchain
171"
172
173
174# Flash disks arrived, sandisk 1g seems to match the geometry of the (blanc) cards
175#FlashDevice sandisk 1g # nanobsd flashdevice entry
176#FlashDevice sandisk 512mb # nanobsd flashdevice entry
177#FlashDevice transcend 2g # nanobsd flashdevice entry
178# Calculated value of PEAK hardware 1GB CF card
179# C/H/S phys 1954/16/63, logical 977/32/63
180# Mediasize is calculated as C*H*S*512
181
182# Using logical values reported by Alix APU board
183# values for PCEngines blanc 2 GB cards
184# C/H/S phys 945/64/63, logical 983/32/63
185# drive 0x000f2ab0: PCHS=0/0/0 translation=lba LCHS=945/64/63 s=3813376
186NANO_MEDIASIZE=`expr -e 4097802240 / 512`
187NANO_HEADS=16
188NANO_SECTS=63
189
190#NANO_MEDIASIZE=`expr 1952448512 / 512`
191#NANO_HEADS=64
192#NANO_SECTS=63
193
194
195# Version tagging
196cust_version_tag() (
197 VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt"
198 (
199 echo "Generated by `id -un`@`hostname -f` at `date`"
200 echo ""
201 echo "=== CONFIG specifics ==="
202 svn info ${NANO_CONF_DIR}/../ || exit 0
203 svn diff ${NANO_CONF_DIR}/../ || exit 0
204 echo "=== BEGIN CONFIG specifics ==="
205 ) > $VERSION_FILE
206)
207
208# Takes a very long time (10+) minutes to generate this file on an ALIX board,
209# not practical for quick debugging and configuration.
210cust_openvpn_dhparam() (
211 DHFILE=${NANO_WORLDDIR}/etc/easy-rsa-keys/dh1024.pem
212 mkdir -p `dirname $DHFILE`
213 openssl dhparam -out $DHFILE 1024
214)
215
216
217
218# Assuming we are running a safe envirionment where snooping could occur during or after the build
219cust_set_root_password() (
220 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
221 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
222 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -n root"
223 else
224 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
225 fi
226)
227
228
229
230# EXPERIMENTAL patch like envirionment
231# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
232# keep us as close as possible to the base OS
233# Patches are applied to the directory they live in
234#cust_apply_nanobsd_patches() (
235# for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
236# cd `dirname ${PATCHFILE}`
237# patch -t -N -p0 -i `basename ${PATCHFILE}`
238# #XX: What to with installed patch files? Delete them for the time beeing
239# rm -v ${PATCHFILE}
240#done
241
242
243
244#)
245
246
247
248# Customize ntpd
249cust_ntpd() (
250 chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift"
251)
252
253
254# Enable Serial TTYs and boot serial at 115200 baud
255cust_serial_ttys() (
256 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[0-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys
257 echo '-h -S115200' > ${NANO_WORLDDIR}/boot.config
258)
259
260
261
262# Install files from specific relative location
263cust_install_files () (
264 cd ${NANO_CONF_DIR}/../files
265 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
266)
267
268
269# Make tools available for root by default
270cust_root_bin_to_tools() {
271 ln -s /tools ${NANO_WORLDDIR}/root/bin
272}
273
274
275# Prune no needed directories of image
276cust_nano_prune () (
277 cd ${NANO_WORLDDIR}
278 for ENTRY in ${NANO_PRUNE}; do
279 rm -vfR ${ENTRY}
280 done
281)
282
283# We actually do need an seperate /tmp, so undo the symlinking done in
284# setup_nanobsd()
285late_cust_unset_common_var_and_tmp() (
286 cd ${NANO_WORLDDIR}
287 rm tmp
288 mkdir -m 1777 tmp
289)
290
291
292# Fill /cfg wmth custom files, based on 'create_i386_diskimage ( )'
293last_nano_fill_cfg () (
294 # Variables to be used
295 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
296 MNT=${MAKEOBJDIRPREFIX}/_.mnt
297
298 # Mount '/cfg' slize in image
299 MD=`mdconfig -a -t vnode -f ${IMG}`
300 mount /dev/${MD}s3 ${MNT}
301
302 # Location of '/cfg' directory
303 cd ${NANO_CONF_DIR}/../cfg-files
304 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
305
306
307 # Leave in nice end state
308 umount ${MNT}
309 mdconfig -d -u ${MD}
310) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
311
312last_nano_disk_usage () (
313 # Variables to be used
314 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
315 MNT=${MAKEOBJDIRPREFIX}/_.mnt
316
317 # Mount root slize
318 MD=`mdconfig -a -t vnode -f ${IMG}`
319 mount /dev/${MD}s1a ${MNT}
320
321 # Show disk usage (percent free) inc header
322 pprint 2 $(df -h | head -1)
323 pprint 2 "$(df -h | grep /dev/${MD})"
324
325 # Leave in nice end state
326 umount ${MNT}
327 mdconfig -d -u ${MD}
328)
329
330last_orders () (
331 last_nano_fill_cfg
332 last_nano_disk_usage
333)
334
335# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
336# instead of a file
337exec 3>/dev/stdout
338# Progress Print
339# Print $2 at level $1
340pprint() {
341 if [ "$1" -le $PPLEVEL ]; then
342 printf "%.${1}s %s\n" "#####" "$2" 1>&3
343 fi
344}
345
346# Cust macro`s gestart in onderstaande volgorde
347# XXX: Determine size before installing all find of additions to see how much
348# base we are actually using ## du -h -d 0
349customize_cmd cust_pkgng
350customize_cmd cust_install_files
351customize_cmd cust_ntpd
352customize_cmd cust_serial_ttys
353customize_cmd cust_version_tag
354customize_cmd cust_root_bin_to_tools
355customize_cmd cust_allow_ssh_root
356customize_cmd cust_openvpn_dhparam
357customize_cmd cust_nano_prune
358customize_cmd cust_set_root_password
359#customize_cmd cust_apply_nanobsd_patches
360late_customize_cmd late_cust_unset_common_var_and_tmp
361
362# Standard overwrite
363if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
364 . $NANO_CONF_DIR/nanobsd.local
365fi
366
367# Extra config if existing is not suffient
368if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
369 for FILE in $EXTRA_NANOBSD_CONFIG; do
370 # File relative to config directory
371 if [ "`echo $FILE | cut -c1`" != "/" ]; then
372 FILE=$NANO_CONF_DIR/$FILE
373 fi
374 pprint 1 "Loading $FILE"
375 . $FILE || exit 1
376 done
377fi
Note: See TracBrowser for help on using the repository browser.