xref: /titanic_41/usr/src/psm/stand/bootblks/ufs/i386/installboot.sh (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
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 (the "License").
7# You may not use this file except in compliance with the License.
8#
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.
13#
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]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27PATH=/usr/bin
28
29away() {
30	echo $2 1>&2
31	exit $1
32}
33
34Error="Error: `basename $0` is obsolete. Use installgrub(1M)"
35Usage="Usage: `basename $0` --force_realmode pboot bootblk raw-device"
36
37test $# -ne 4 && away 1 "$Error"
38test $1 != "--force_realmode" && away 1 "$Error"
39shift 1
40
41PBOOT=$1
42BOOTBLK=$2
43DEVICE=$3
44test ! -f $PBOOT && away 1 "$PBOOT: File not found"
45test ! -f $BOOTBLK && away 1 "$BOOTBLK: File not found"
46test ! -c $DEVICE && away 1 "$DEVICE: Not a character device"
47test ! -w $DEVICE && away 1 "$DEVICE: Not writeable"
48
49# pboot at block 0, label at blocks 1 and 2, bootblk from block 3 on
50stderr=`dd if=$PBOOT of=$DEVICE bs=1b count=1 conv=sync 2>&1`
51err=$? ; test $err -ne 0 && away $err "$stderr"
52stderr=`dd if=$BOOTBLK of=$DEVICE bs=1b oseek=3 conv=sync 2>&1`
53err=$? ; test $err -ne 0 && away $err "$stderr"
54exit 0
55