6699 be_get_boot_args interface implementation in libbe (loader project)
[unleashed.git] / usr / src / psm / stand / bootblks / ufs / i386 / installboot.sh
blob38ff766f286c6241d0c043acb66e1729d7ab885f
1 #!/bin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
27 PATH=/usr/bin
29 away() {
30 echo $2 1>&2
31 exit $1
34 Error="Error: `basename $0` is obsolete. Use installgrub(1M)"
35 Usage="Usage: `basename $0` --force_realmode pboot bootblk raw-device"
37 test $# -ne 4 && away 1 "$Error"
38 test $1 != "--force_realmode" && away 1 "$Error"
39 shift 1
41 PBOOT=$1
42 BOOTBLK=$2
43 DEVICE=$3
44 test ! -f $PBOOT && away 1 "$PBOOT: File not found"
45 test ! -f $BOOTBLK && away 1 "$BOOTBLK: File not found"
46 test ! -c $DEVICE && away 1 "$DEVICE: Not a character device"
47 test ! -w $DEVICE && away 1 "$DEVICE: Not writeable"
49 # pboot at block 0, label at blocks 1 and 2, bootblk from block 3 on
50 stderr=`dd if=$PBOOT of=$DEVICE bs=1b count=1 conv=sync 2>&1`
51 err=$? ; test $err -ne 0 && away $err "$stderr"
52 stderr=`dd if=$BOOTBLK of=$DEVICE bs=1b oseek=3 conv=sync 2>&1`
53 err=$? ; test $err -ne 0 && away $err "$stderr"
54 exit 0