Skip to content

Commit

Permalink
20090902 release:
Browse files Browse the repository at this point in the history
Make default image 950MB instead of 1024MB so it actually fits on any "1GB" flash card.
Make /root a 50MB partition so that you can persistently save things like ssh keys (added root to vnddirs).
Fix -disk option in cfgflashrd.
Fix error reporting for invocation of vnconfig -u when disk specified.
Remove POOL_DEBUG from kernel config before compiling for speed (this option is only enabled during development cycles, delete this out of mkkern if you want -current kernels with POOL_DEBUG).
Copy rc.shutdown as example to preserve tardirs on reboot.
Mount source image rdonly with growimg, makes failure recovery easier.
  • Loading branch information
yellowman committed Jun 2, 2012
1 parent ec9ef8c commit 7758210
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bin/ro
Expand Up @@ -2,7 +2,7 @@

# To exclude certain vnd partitions from being set to read-write or read-only during 'rw' and 'ro' commands, simply remove those partitions from the vnddirs= setting in /bin/rw and /bin/ro

vnddirs="bin etc sbin usr"
vnddirs="root bin etc sbin usr"
dev=svnd0

for i in $vnddirs; do
Expand Down
2 changes: 1 addition & 1 deletion bin/rw
Expand Up @@ -2,7 +2,7 @@

# To exclude certain vnd partitions from being set to read-write or read-only during 'rw' and 'ro' commands, simply remove those partitions from the vnddirs= setting in /bin/rw and /bin/ro

vnddirs="bin etc sbin usr"
vnddirs="root bin etc sbin usr"
dev=svnd0

for i in $vnddirs; do
Expand Down
6 changes: 3 additions & 3 deletions cfgflashrd
Expand Up @@ -4,7 +4,7 @@
#
# Chris Cappuccio <chris@nmedia.net>

vnddirs="bin etc sbin usr" # must match vnddirs= in stand/rc and fstab
vnddirs="root bin etc sbin usr" # must match vnddirs= in flashrd and stand/rc
rootdevice=svnd2
device=svnd3

Expand Down Expand Up @@ -96,7 +96,7 @@ if [ -z "$dest" -a -z "$novnd" ]; then
exit 1
fi

if [ ! -z "$novnd" -a ! -f "$dest" ]; then
if [ -z "$novnd" -a ! -f "$dest" ]; then
echo % image $dest not found
exit 1
fi
Expand Down Expand Up @@ -404,7 +404,7 @@ c 1 umount $tmpmnt
#
# done with flash img vnd

c 0 vnuncfgroot
vnuncfgroot

rmdir $tmpmnt $tmpmntvnd
rm -f $tmppass
Expand Down
26 changes: 26 additions & 0 deletions etc/rc.shutdown
@@ -0,0 +1,26 @@
# $OpenBSD: rc.shutdown,v 1.7 2006/06/22 00:41:59 deraadt Exp $
#
# If it exists, this script is run at system-shutdown by reboot(8),
# halt(8). If the architecture supports keyboard requested halting,
# it is also run by init(8) when such an event happens.
#

powerdown=NO # set to YES for powerdown

# Uncomment tardirs if you want to compact dirs on shutdown
#
#tardirs="var"

if [ ! -z "$tardirs" ]; then

for i in $tardirs; do
echo tardirs: compacting $i
tar cf /flash/$i.tar -C /$i .
done

fi

#
# Your shell code goes here
#

14 changes: 7 additions & 7 deletions flashrd
Expand Up @@ -6,18 +6,18 @@

date=`date +%Y%m%d`
arch=`uname -m`
vers=20090727
vers=20090902

export device=svnd3 # least likely to conflict ?
export rootdevice=svnd2 # used to mount flash vnd for writing of stuff inside
export blocks=6080 # blocks to reserve for kernel ramdisk
export szezroot=szez.$arch-$date # 6080 flash root
export dest=flashimg.$arch-$date # final product
export count=1024 # image block count
export count=950 # image block count
export bsize=1m # image block size

export vnddirs="bin etc sbin usr" # must match vnddirs= in stand/rc and fstab
export vndsize="auto 102400 auto auto" # min partition sizes (or auto) (in 512 byte sectors)
export vnddirs="root bin etc sbin usr" # must match vnddirs= in stand/rc and fstab
export vndsize="102400 auto 102400 auto auto" # min partition sizes (or auto) (in 512 byte sectors)

export tardirs="var" # must match tardirs= in stand/rc and rc.conf.local
set -A tarsize 65536 # mfs sizes for tar dirs (in 512 byte sectors)
Expand Down Expand Up @@ -124,7 +124,7 @@ c 0 ./mkboot

export tmpmnt=`mktemp -d /tmp/flashrd.XXXXXXXX`

c 0 vncfgroot $dest
vncfgroot $dest

c 1 mount /dev/"$rootdevice"a $tmpmnt

Expand Down Expand Up @@ -229,7 +229,7 @@ fi

c 3 mount /dev/$device$etcpart $tmpmntvnd

c 4 cp etc/rc.local etc/rc.conf.local $tmpmntvnd/
c 4 cp etc/rc.local etc/rc.conf.local etc/rc.shutdown $tmpmntvnd/

c 4 mv $tmpfstab $tmpmntvnd/fstab

Expand Down Expand Up @@ -259,7 +259,7 @@ c 1 umount $tmpmnt
#
# done with flash img vnd

c 0 vnuncfgroot
vnuncfgroot

rmdir $tmpmntvnd $tmpmnt

Expand Down
2 changes: 1 addition & 1 deletion growimg
Expand Up @@ -159,7 +159,7 @@ NewLabel=`mktemp growimg.XXXXXXXX`
OldDir=`mktemp -d olddir.XXXXX`
NewDir=`mktemp -d newdir.XXXXX`

if ! mount /dev/"$device2"a $OldDir; then
if ! mount -o rdonly /dev/"$device2"a $OldDir; then
echo mount old image failed
vnconfig -u $device2
rm -f $NewImg $NewLabel
Expand Down
2 changes: 1 addition & 1 deletion mkboot
Expand Up @@ -64,7 +64,7 @@ if [ -z "$novnd" ]; then
echo
fi

c 0 vncfgroot $dest
vncfgroot $dest

c 1 "fdisk -yi $rootdevice >/dev/null 2>&1"

Expand Down
11 changes: 8 additions & 3 deletions mkkern
Expand Up @@ -74,9 +74,14 @@ fi

###
#
# modify GENERIC
# remove option POOL_DEBUG from /usr/src/sys/conf/GENERIC (slower allocation!)
# modify /usr/src/sys/arch/`uname -m`/conf/GENERIC

egrep -v ^config < $kernsrc/conf/GENERIC >$kernsrc/conf/FLASHRD
grep -v POOL_DEBUG /usr/src/sys/conf/GENERIC > /usr/src/sys/conf/FLASHRD
# if you want POOL_DEBUG, do this instead:
#cp /usr/src/sys/conf/GENERIC /usr/src/sys/conf/FLASHRD

egrep -v ^config $kernsrc/conf/GENERIC | sed -e 's/GENERIC/FLASHRD/' > $kernsrc/conf/FLASHRD

cat >> $kernsrc/conf/FLASHRD <<-EOF
option RAMDISK_HOOKS
Expand All @@ -85,7 +90,7 @@ cat >> $kernsrc/conf/FLASHRD <<-EOF
pseudo-device rd 1
EOF

sed -e 's/GENERIC/FLASHRD/' < $kernsrc/conf/GENERIC.MP > $kernsrc/conf/FLASHRD.MP
sed -e 's/GENERIC/FLASHRD/' $kernsrc/conf/GENERIC.MP > $kernsrc/conf/FLASHRD.MP

###
#
Expand Down
2 changes: 1 addition & 1 deletion stand/rc
Expand Up @@ -20,7 +20,7 @@
# this bootstrap could do quite a bit more to check vnd images for validity
# and swap to /flash/old as necessary or convenient
#
vnddirs="bin etc sbin usr" # svnd0a, svnd0d, svnd0e, svnd0f
vnddirs="root bin etc sbin usr" # svnd0a, svnd0d, svnd0e, svnd0f, svnd0g
set -A part a d e f g h i j k l m n o p
vnd=svnd0
disk=wd0a
Expand Down

0 comments on commit 7758210

Please sign in to comment.