diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2010-02-18 20:20:53 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2010-02-18 20:20:53 +0000 |
commit | 733b61d7e2b06c9dbf01ae9040e05ab508662ed6 (patch) | |
tree | ad72982d0a8029ee2564d30a86ad851c26100913 | |
parent | d460d46d2ceb660f5095d4b70ec7a3d3b5b5dcc9 (diff) |
loongson install procedure, using a newly created small ext2 partition (or an
existing one) to install the bootloader on.
-rw-r--r-- | distrib/loongson/ramdisk/install.md | 72 | ||||
-rw-r--r-- | distrib/loongson/ramdisk/list | 7 |
2 files changed, 57 insertions, 22 deletions
diff --git a/distrib/loongson/ramdisk/install.md b/distrib/loongson/ramdisk/install.md index a7fc6ddc90a..c9584ceca92 100644 --- a/distrib/loongson/ramdisk/install.md +++ b/distrib/loongson/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.1 2010/01/31 21:36:01 otto Exp $ +# $OpenBSD: install.md,v 1.2 2010/02/18 20:20:52 otto Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -33,6 +33,18 @@ # 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 + umount /mnt2 + return + fi + fi + + echo "Failed to install bootblocks." + echo "You will not be able to boot OpenBSD from $_disk." + exit } md_prep_fdisk() { @@ -40,9 +52,9 @@ md_prep_fdisk() { while :; do _d=whole - if [[ -n $(fdisk $_disk | grep 'Signature: 0xAA55') ]]; then + if fdisk $_disk | grep -q 'Signature: 0xAA55'; then fdisk $_disk - if [[ -n $(fdisk $_disk | grep '^..: A6 ') ]]; then + if fdisk $_disk | grep -q '^..: A6 '; then _q=", use the (O)penBSD area," _d=OpenBSD fi @@ -52,33 +64,44 @@ md_prep_fdisk() { ask "Use (W)hole disk$_q or (E)dit the MBR?" "$_d" case $resp in w*|W*) - echo "Disabled, you probably do not want that." -# echo -n "Setting OpenBSD MBR partition to whole $_disk..." -# fdisk -e ${_disk} <<__EOT >/dev/null -#reinit -#update -#write -#quit -#__EOT -# echo "done." - return ;; + echo -n "Creating a 1MB ext2 partition and an OpenBSD partition for rest of $_disk..." + fdisk -e $_disk <<__EOT >/dev/null +reinit +update +write +quit +__EOT + echo "done." + disklabel $_disk 2>/dev/null | grep -q "^ i:" || disklabel -w -d $_disk + newfs -t ext2fs ${_disk}i + break ;; e*|E*) # Manually configure the MBR. cat <<__EOT -You will now create a single MBR partition to contain your OpenBSD data. This -partition must have an id of 'A6'; must *NOT* overlap other partitions; and -must be marked as the only active partition. Inside the fdisk command, the -'manual' command describes all the fdisk commands in detail. +You will now create one MBR partition to contain your OpenBSD data +and one MBR partition to contain the program that PMON uses +to boot OpenBSD. Neither partition will overlap any other partition. + +The OpenBSD MBR partition will have an id of 'A6' and the boot MBR +partition will have an id of '83' (Linux files). The boot partition will be +at least 1MB and be the first 'Linux files' partition on the disk. +The installer assumes there is already an ext2 or ext3 filesystem on the +first 'Linux files' partition. $(fdisk ${_disk}) __EOT - fdisk -e ${_disk} - [[ -n $(fdisk $_disk | grep ' A6 ') ]] && return - echo No OpenBSD partition in MBR, try again. ;; - o*|O*) return ;; + fdisk -e $_disk + fdisk $_disk | grep -q '^..: 83 ' || \ + { echo "\nNo Linux files (id 83) partition!\n" ; continue ; } + fdisk $_disk | grep -q "^..: A6 " || \ + { echo "\nNo OpenBSD (id A6) partition!\n" ; continue ; } + disklabel $_disk 2>/dev/null | grep -q "^ i:" || disklabel -w -d $_disk + break ;; + o*|O*) break ;; esac done + } md_prep_disklabel() { @@ -120,6 +143,13 @@ __EOT } md_congrats() { + cat <<__EOT + +Once the machine has rebooted use PMON to boot into OpenBSD, as +described in the INSTALL.$ARCH document. The command to boot the OpenBSD +bootloader will be something like 'boot /dev/fs/ext2@wd0/boot/boot' + +__EOT } md_consoleinfo() { diff --git a/distrib/loongson/ramdisk/list b/distrib/loongson/ramdisk/list index ecdd37be795..41e5b129567 100644 --- a/distrib/loongson/ramdisk/list +++ b/distrib/loongson/ramdisk/list @@ -1,4 +1,4 @@ -# $OpenBSD: list,v 1.3 2010/02/17 18:07:43 miod Exp $ +# $OpenBSD: list,v 1.4 2010/02/18 20:20:52 otto Exp $ SRCDIRS distrib/special SRCDIRS bin sbin usr.bin usr.sbin @@ -45,6 +45,7 @@ LINK instbin sbin/mount_msdos LINK instbin sbin/mount_nfs LINK instbin sbin/mount_udf LINK instbin sbin/newfs +LINK instbin sbin/newfs_ext2fs LINK instbin sbin/newfs_msdos LINK instbin sbin/ping LINK instbin sbin/ping6 @@ -73,6 +74,10 @@ SYMLINK /tmp/resolv.conf.shadow etc/resolv.conf SYMLINK /tmp/hosts etc/hosts TERMCAP vt100,vt220,dumb usr/share/misc/termcap +# files in /usr/mdec +COPY ${DESTDIR}/usr/mdec/boot usr/mdec/boot +COPY ${DESTDIR}/usr/mdec/mbr usr/mdec/mbr + # firmwares that might need loading COPY ${DESTDIR}/etc/firmware/kue etc/firmware/kue COPY ${DESTDIR}/etc/firmware/rum-rt2573 etc/firmware/rum-rt2573 |