diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-04-03 21:41:27 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-04-03 21:41:27 +0000 |
commit | 0b2c1320b9c0b2f5967392a4f6e517d719dc0630 (patch) | |
tree | b06bfebc98b04914de144715722e2494a7dbe50f | |
parent | 3a2a23b7d72c6c02033ffbf400d78e3bb8b7193e (diff) |
Use hw.product sysctl to tell whether we are installing on a Gdium Liberty
system, or something else.
Derive the fdisk instructions in `use the whole disk for OpenBSD' from this
knowledge, and set up a 32MB ext2fs partition on Gdium, and the 1MB elsewhere
(as was already been done).
On Gdium, format this partition in fancy mode (-O 1) and 4KB blocks, so that
PMON has a chance to load files larger than 4MB (such as bsd.rd)
without failing in a pathetic way, and also copy the kernel image to the ext2fs
partition after the installation has completed.
Note that, apart from creating a larger ext2fs partition on Gdium, there should
be no need for this.
Unfortunately, since regular PMON does not have ext2fs code, Lemote wrote its
own code to access ext2 filesystems. Saying that this code is full of
shortcomings and bugs would be an understatement. What is worse is that this
code has been written by people with no knowledge (or even insight) of how
error conditions ought to be handled, and their ext2fs code will happily
abort a read upon error with no error; if one does not compare the final
read size to the file size obtained by stat(), there is no way to figure out
that the read has been aborted. Of course since regular (upstream) PMON code
is written correctly, it does not expect this, so it is easy to end up with
PMON not loading a kernel image completely, yet proceeding happily to transfer
control to this broken image.
I guess the morale behind this is that system software is too difficult to get
done correctly, to be done by hardware people.
-rw-r--r-- | distrib/loongson/ramdisk/install.md | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/distrib/loongson/ramdisk/install.md b/distrib/loongson/ramdisk/install.md index 76da80873f2..434bbf2b0e9 100644 --- a/distrib/loongson/ramdisk/install.md +++ b/distrib/loongson/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.4 2010/02/19 07:37:17 otto Exp $ +# $OpenBSD: install.md,v 1.5 2010/04/03 21:41:26 miod Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -36,7 +36,9 @@ md_installboot() { local _disk=$1 if mount -t ext2fs /dev/${_disk}i /mnt2 ; then - if mkdir -p /mnt2/boot && cp /usr/mdec/boot /mnt2/boot; then + if mkdir -p /mnt2/boot && cp /usr/mdec/boot /mnt2/boot && + [[ $(sysctl -n hw.product) != Gdium ]] || + cp /mnt/bsd /mnt2/boot/bsd; then umount /mnt2 return fi @@ -48,7 +50,7 @@ md_installboot() { } md_prep_fdisk() { - local _disk=$1 _q _d + local _disk=$1 _q _d _s _o while :; do _d=whole @@ -64,16 +66,35 @@ md_prep_fdisk() { ask "Use (W)hole disk$_q or (E)dit the MBR?" "$_d" case $resp in w*|W*) - echo -n "Creating a 1MB ext2 partition and an OpenBSD partition for rest of $_disk..." + if [ $(sysctl -n hw.product) = Gdium ]; then + _s=32 + _o="-O 1 -b 4096" + else + _s=1 + _o="" + fi + echo -n "Creating a ${_s}MB ext2 partition and an OpenBSD partition for rest of $_disk..." fdisk -e $_disk <<__EOT >/dev/null -reinit +re +e 0 + + +1 +$(expr $_s \* 2048) +e 3 +0 +e 3 +A6 + +$(expr $_s \* 2048 + 1) +* update write quit __EOT echo "done." disklabel $_disk 2>/dev/null | grep -q "^ i:" || disklabel -w -d $_disk - newfs -qt ext2fs ${_disk}i + newfs -qt ext2fs $_o ${_disk}i break ;; e*|E*) # Manually configure the MBR. |