#!/bin/ksh # # chris@nmedia.net # Multiple image builder script for flashdist # # (Assumes that you are installing stock flashdist /etc/rc, /etc/boot.conf # and /etc/ttys files) # # To run this, # 1. Unpack OpenBSD baseXX.tgz, etcXX.tgz and manXX.tgz to /tmp/openbsd # with tar p flag, and as root # 2. You may want to adjust the flash geometry below to match your media size # 3. Compile GENERIC, NET45xx, and GEODE kernels, and leave # them at the /usr/src/sys/arch/i386/compile/XXX/bsd locations, or adjust # the kernels used to what you actually need # 4. Run this from the flashdist direcotry, ./flashimgbld.sh PATH=.:/usr/bin:/usr/sbin:/bin:/sbin date=`date +%Y%m%d` Tmp=`mktemp -d /tmp/flashimg.XXXXXXXX` export device=svnd0 export distloc=/tmp/openbsd # password: root export encpass='$2a$08$aTb87GsjdfI5pnRM362mlOmAzh9bVPY84khbeaKqeEj84CB5P60ma' export syslogserver=none export dnsservers="66.39.178.10 66.39.191.18" export ntpservers="66.39.178.10 66.39.191.18" stripcomcons() { # Bye bye com0 grep -v com0 <$1/etc/boot.conf >$1/etc/boot.conf.new mv $1/etc/boot.conf.new $1/etc/boot.conf # Turn on console egrep -v ^console <$1/etc/ttys >$1/etc/ttys.new echo "console \"/usr/libexec/getty Pc\" vt220 on secure" >>$1/etc/ttys.new mv $1/etc/ttys.new $1/etc/ttys } comcons38400() { sed -e 's/19200/38400/' <$1/etc/boot.conf >$1/etc/boot.conf.new sed -e 's/19200/38400/' <$1/etc/ttys >$1/etc/ttys.new mv $1/etc/boot.conf.new $1/etc/boot.conf mv $1/etc/ttys.new $1/etc/ttys } setvr0() { sed -e 's/sis0/vr0/' <$1/etc/rc >$1/etc/rc.new sed -e 's/sis0/vr0/' <$1/etc/nshrc >$1/etc/nshrc.new mv $1/etc/rc.new $1/etc/rc mv $1/etc/nshrc.new $1/etc/nshrc } ### # The 64MB images export distfile=flash64mb.txt export cylinders=490 # C export trackscylinder=8 # H export sectorstrack=32 # S let totalsize=$cylinders*$trackscylinder*$sectorstrack # GENERIC com0 19200 export kernel=/usr/src/sys/arch/i386/compile/GENERIC/bsd image=flashimg-$date.GENERIC.com0-19200 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi vnconfig -u $device gzip -9f $image # GENERIC.MP com0 19200 export kernel=/usr/src/sys/arch/i386/compile/GENERIC.MP/bsd image=flashimg-$date.GENERIC.MP.com0-19200 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi vnconfig -u $device gzip -9f $image # GENERIC com0 38400 export kernel=/usr/src/sys/arch/i386/compile/GENERIC/bsd image=flashimg-$date.GENERIC.com0-38400 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi mount /dev/"$device"a $Tmp comcons38400 $Tmp umount $Tmp vnconfig -u $device gzip -9f $image # GENERIC.MP com0 38400 export kernel=/usr/src/sys/arch/i386/compile/GENERIC.MP/bsd image=flashimg-$date.GENERIC.MP.com0-38400 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi mount /dev/"$device"a $Tmp comcons38400 $Tmp umount $Tmp vnconfig -u $device gzip -9f $image # GENERIC console export kernel=/usr/src/sys/arch/i386/compile/GENERIC/bsd image=flashimg-$date.GENERIC.console printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi mount /dev/"$device"a $Tmp stripcomcons $Tmp umount $Tmp vnconfig -u $device gzip -9f $image # GENERIC.MP console export kernel=/usr/src/sys/arch/i386/compile/GENERIC.MP/bsd image=flashimg-$date.GENERIC.MP.console printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi mount /dev/"$device"a $Tmp stripcomcons $Tmp umount $Tmp vnconfig -u $device gzip -9f $image # NET45xx com0 19200 export kernel=/usr/src/sys/arch/i386/compile/NET45xx/bsd image=flashimg-$date.NET45xx.com0-19200 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi vnconfig -u $device gzip -9f $image # GEODE com0 19200 export kernel=/usr/src/sys/arch/i386/compile/GEODE/bsd image=flashimg-$date.GEODE.com0-19200 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi mount /dev/"$device"a $Tmp setvr0 $Tmp umount $Tmp vnconfig -u $device gzip -9f $image # GEODE com0 38400 export kernel=/usr/src/sys/arch/i386/compile/GEODE/bsd image=flashimg-$date.GEODE.com0-38400 printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi mount /dev/"$device"a $Tmp comcons38400 $Tmp setvr0 $Tmp umount $Tmp vnconfig -u $device gzip -9f $image ### # The 32MB images # export distfile=flash32mb.txt export sectorstrack=32 export trackscylinder=4 export cylinders=490 let totalsize=$cylinders*$trackscylinder*$sectorstrack # NET45xx com0 19200 export kernel=/usr/src/sys/arch/i386/compile/NET45xx/bsd image=flashimg-$date.NET45xx.com0-19200.32mb printf "\n%% $image\n\n" dd if=/dev/zero of=$image bs=512 count=$totalsize if ! vnconfig $device $image; then echo % vnconfig failure exit fi if ! flashdist.sh -x -k; then echo % Flashdist failure vnconfig -u $device exit fi vnconfig -u $device gzip -9f $image ### # End # rmdir $Tmp