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]
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
32 while getopts b
:r
:e
: a
; do
38 ?
) printf "Usage: %s: [ -b bb_len ] [ -r rd_len ] boot_fcode ramdisk_fcode bootblk\n" $0
42 shift $
(($OPTIND - 1))
45 # check boot code and ramdisk code for size overflow
47 rdoff
=$
(($bblen - $rdlen))
49 bbsize
=$
(ls -l $1 |
awk -e '{ print $5 }')
50 if [ $bbsize -gt $rdoff ]; then
51 printf "$1 must be smaller than $rdoff\n"
55 rdsize
=$
(ls -l $2 |
awk -e '{ print $5 }')
56 if [ $rdsize -gt $rdlen ]; then
57 printf "$1 must be smaller than $rdlen\n"
66 dd if=$1 of
=$3 conv
=notrunc bs
=1
67 dd if=$2 of
=$3 conv
=notrunc bs
=1 oseek
=$rdoff
70 # extended bootblk for zfs debug
72 if [ $totlen -gt $bblen ]; then
73 extsize
=$
(ls -l $extra |
awk -e '{ print $5 }')
74 if [ $extsize -gt 16384 ]; then
75 printf "$1 must be smaller than 16k\n"
78 dd if=$extra of
=$3 conv
=notrunc bs
=1 oseek
=$bblen