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