Skip to content

Commit

Permalink
20101001 release:
Browse files Browse the repository at this point in the history
Add -mp, -sp and -tz options to cfgflashrd (to set mp, sp as primary kernel, and to set time zone).
Add NKPTP=8 to kernel config to accommodate kernel+ramdisk up to 32MB (problem and resolution gleaned from flashboot README).
Strip isadma and related devices from the kernel to accommodate kernel+ramdisk that uses the full first 16MB of memory.
  • Loading branch information
yellowman committed Jun 2, 2012
1 parent 5674382 commit 48d962c
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 4 deletions.
64 changes: 61 additions & 3 deletions cfgflashrd
Expand Up @@ -52,6 +52,30 @@ if [ "$1" == "-com0" ]; then
shift
fi

if [ "$1" == "-sp" ]; then
bsdassp=1
shift
fi

if [ "$1" == "-mp" ]; then
bsdasmp=1
shift
fi

if [ "$1" == "-tz" ]; then
shift
if [ -z "$1" ]; then
echo "% tzfile not specified"
exit 1
fi
tzfile="$1"
shift
if [ ! -f /usr/share/zoneinfo/$tzfile -a ! -f $tzfile ]; then
echo "tzfile /usr/share/zoneinfo/$tzfile (and $tzfile) not found"
exit 1
fi
fi

vncfgroot() {
[ -z "$novnd" ] && c 0 vnconfig $rootdevice $1
}
Expand Down Expand Up @@ -88,10 +112,12 @@ vnuncfgroot() {

if [ -z "$dest" -a -z "$novnd" ]; then
cat <<-EOF
% cfgflashrd [-disk "dev" | -image "filename"] [-rdroot "filename"] [-com0 "speed"]
% cfgflashrd [-disk "dev" | -image "filename"] [-rdroot "filename"] [-com0 "speed"] [-mp] [-tz "tzfile"]
"dev" as in wd2, sd3, etc...
use -rdroot flag if you have built rdrootfs image and want to change disk parameters on it
use -com0 flag if you want to direct console from vga to com0 at "speed" speed
use -mp to set bsd.mp as primary kernel, if exists (shifting bsd to bsd.sp)
use -tz to copy /usr/share/zoneinfo/"tzfile" to destination image /etc/localtime
EOF
exit 1
fi
Expand Down Expand Up @@ -177,7 +203,7 @@ if [ ! -z "$rdfs" ]; then
echo Setting ramdisk root image
elfrdarch=`file ./elfrdsetroot | awk -F, ' { print $2 } '`

for i in bsd bsd.mp; do
for i in bsd bsd.mp bsd.sp; do
if [ -f $tmpmnt/$i ]; then
bsdarch=`file $tmpmnt/$i | awk -F, ' { print $2 } '`
if [ "$bsdarch" != "$elfrdarch" ]; then
Expand All @@ -190,10 +216,28 @@ if [ ! -z "$rdfs" ]; then
done

if [ -z "$cfgbsd" ]; then
echo % neither bsd nor bsd.mp kernel found at flash image. how odd?
echo % none of bsd bsd.mp bsd.sp kernel found at flash image. how odd?
2; 1; 0;
fi

if [ "$bsdassp" == "1" ]; then
if [ -f $tmpmnt/bsd.sp ]; then
mv $tmpmnt/bsd $tmpmnt/bsd.mp
mv $tmpmnt/bsd.sp $tmpmnt/bsd
else
echo "[bsd.sp not found, primary kernel may already be single processor]"
fi
fi

if [ "$bsdasmp" == "1" ]; then
if [ -f $tmpmnt/bsd.mp ]; then
mv $tmpmnt/bsd $tmpmnt/bsd.sp
mv $tmpmnt/bsd.mp $tmpmnt/bsd
else
echo "[bsd.mp not found, primary kernel may already by multi-processor]"
fi
fi

rm -f $temp
fi

Expand Down Expand Up @@ -386,6 +430,20 @@ else
echo Failed to configure nameservers, you must manually configure /etc/resolv.conf
fi

###
#
# tzfile

if [ ! -z "$tzfile" ]; then
if [ -f /usr/share/zoneinfo/$tzfile ]; then
cp /usr/share/zoneinfo/$tzfile $tmpmntvnd/localtime
else
if [ -f $tzfile ]; then
cp $tzfile $tmpmntvnd/localtime
fi
fi
fi

###
#
# this is the end
Expand Down
41 changes: 41 additions & 0 deletions config.strip
@@ -0,0 +1,41 @@
#
# Lines in this file are matched and removed using sed from the architecture-
# dependent GENERIC kernel config. This list is valid for i386 and amd64
# as of OpenBSD 4.8. It has not been tested on earlier kernels.
#
# The purpose of this list is to remove isadma and devices which depend
# on isadma. You may find other reasons to strip features or devices
# from your GENERIC kernel config (and thus add those patterns here.)
#
isadma.*at isa.*
bha.*at isa.*
scsibus.*at bha.*
aha.*at isa.*
scsibus.*at aha.*
uha.*at isa.*
uha.*at eisa.*
scsibus.*at uha.*
wds.*at isa.*
scsibus.*at wds.*
fdc.*at isa.*
fd.*at fdc.*
ef.*at isa.*
pss.*at isa.*
sp.*at pss.*
eso.*at pci.*
sb.*at isa.*
ess.*at isa.*
wss.*at isa.*
pas.*at isa.*
gus.*at isa.*
ym.*at isa.*
midi.*at sb.*
midi.*at ym.*
audio.*at sb.*
audio.*at gus.*
audio.*at pas.*
audio.*at sp.*
audio.*at ess.*
audio.*at wss.*
audio.*at ym.*
audio.*at eso.*
2 changes: 1 addition & 1 deletion flashrd
Expand Up @@ -6,7 +6,7 @@

date=`date +%Y%m%d`
arch=`uname -m`
vers=20100402
vers=20101001

export device=svnd3 # least likely to conflict ?
export rootdevice=svnd2 # used to mount flash vnd for writing of stuff inside
Expand Down
4 changes: 4 additions & 0 deletions growimg
Expand Up @@ -172,6 +172,10 @@ egrep -v "^total sectors:|^bytes/sector:|^sectors/track:|^sectors/cylinder:|^tra

apart=$((totalsize - sectorstrack))

# This probably isn't important as of OpenBSD 4.8 because disklabel
# now ignores geometry specified by -R command. Flag for removal
# after further analysis. XXX
#
cat <<-__New >>$NewLabel
total sectors: $totalsize
bytes/sector: $bytessec
Expand Down
8 changes: 8 additions & 0 deletions mkboot
Expand Up @@ -60,6 +60,10 @@ if [ -z "$novnd" ]; then
totalsize=$((cylinders * trackscylinder * sectorstrack))
sectorscylinder=$((totalsize / cylinders))
else
# This probably isn't important as of OpenBSD 4.8 because disklabel
# now ignores geometry specified by -R command. Flag for removal
# after further analysis. XXX
#
# Disk specified, use default kernel geometry
c 0 "fdisk -f $distloc/usr/mdec/mbr -yi $rootdevice >/dev/null 2>&1"
c 0 disklabel $rootdevice > $tmplabel
Expand All @@ -77,6 +81,10 @@ echo "Using disk geometry $cylinders/$trackscylinder/$sectorstrack ($totalmbytes
# Main partition comprises the total disk, minus first sector
asize=$((totalsize - sectorstrack))

# This probably isn't important as of OpenBSD 4.8 because disklabel
# now ignores geometry specified by -R command. Flag for removal
# after further analysis. XXX
#
# Remove most disklabel info, write disk geometry, partitions
egrep -v "^type:|^boundstart:|^boundend:|^total sectors:|^bytes/sector:|^sectors/track:|^sectors/cylinder:|^tracks/cylinder:|^cylinders:|^ .:|^#|^. partitions:|^.. partitions:|^$" < $tmplabel > ${tmplabel}.new
cat >> ${tmplabel}.new <<-EOF
Expand Down
4 changes: 4 additions & 0 deletions mkdist
Expand Up @@ -170,6 +170,10 @@ c 1 "disklabel $device > $tmplabel"

egrep -v "^boundstart:|^boundend:|^total sectors:|^bytes/sector:|^sectors/track:|^sectors/cylinder:|^tracks/cylinder:|^cylinders:|^ .:|^#|^. partitions:|^.. partitions:|^$" < $tmplabel > ${tmplabel}.new

# This probably isn't important as of OpenBSD 4.8 because disklabel
# now ignores geometry specified by -R command. Flag for removal
# after further analysis. XXX
#
bytessec=512
sectorstrack=100
sectorscylinder=100
Expand Down
15 changes: 15 additions & 0 deletions mkkern
Expand Up @@ -86,12 +86,27 @@ egrep -v ^config $kernsrc/conf/GENERIC | sed -e 's/GENERIC/FLASHRD/' > $kernsrc/
cat >> $kernsrc/conf/FLASHRD <<-EOF
option RAMDISK_HOOKS
option MINIROOTSIZE=$blocks
option NKPTP=8
config bsd root on rd0a swap on rd0b and wd0b and sd0b
pseudo-device rd 1
EOF

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

if [ -f config.strip ]; then
while read line; do

line=${line%%#*} # strip comments
test -z "$line" && continue

sed -e "s/^$line//" < $kernsrc/conf/FLASHRD > $kernsrc/conf/FLASHRD.tmp
mv $kernsrc/conf/FLASHRD.tmp $kernsrc/conf/FLASHRD
done < config.strip
else
echo "[no config.strip found for kernel config alterations]"
echo "[ramdisk kernel may be too large to boot without disabling isadma for i386/amd64]"
fi

###
#
# compile ELFRDSETROOT first (so we can bail out if it fails without waiting for GENERIC)
Expand Down

0 comments on commit 48d962c

Please sign in to comment.