# ========== Copyright Header Begin ==========================================
# Hypervisor Software File: mkflash.sh
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
# - Do no alter or remove copyright notices
# - Redistribution and use of this software in source and binary forms, with
# or without modification, are permitted provided that the following
# - Redistribution of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# - Redistribution in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of Sun Microsystems, Inc. or the names of contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# This software is provided "AS IS," without a warranty of any kind.
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
# MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
# ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
# DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
# OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
# FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
# DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
# ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
# SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
# You acknowledge that this software is not designed, licensed or
# intended for use in the design, construction, operation or maintenance of
# ========== Copyright Header End ============================================
# id: @(#)mkflash.sh 1.18 01/12/21
# purpose: Builds the final script for the OS-level Flash PROM Update Utility
# copyright: Copyright 1995-2001 Sun Microsystems, Inc.
echo "$*" 2>&1 > /dev
/tty
say
"mkflash <in: drvr name 32b> <in: update prog name> <out: filename>"
say
" <in: drvr name 64b> [ OPS ] [ SUN4U ]"
say
$1: No such
file or directory
PATH
=/usr
/bin
:/usr
/sbin
:/sbin
# Note that there will normally be 4 args, as shown in usage(). However,
# for Ops, a 5th arg may be passed in which, if it is "OPS", will cause
# the final script to be created such that a final reboot is not issued.
# Also the SUN4U flag may be provided, which causes the kernel nvram driver
# to be added as "eeprom" (sun4s doesn't have an eeprom node and so by
# default the eeprom driver does not get added).
DRV
=/kernel
/drv
/$DRVRNAME
if [ $ARG5 = SUN4U
-0 $ARG6 = SUN4U
]
EDRV
=/kernel
/drv
/$EDRVRNAM
# Copyright 1995-2000 Sun Microsystems, Inc.
echo \`gettext \$textdom \\
"Flash Update 2.4: Program and system initialization in progress..."\`
if [ $ARG5 = OPS
-0 $ARG6 = OPS
]
echo "This version of the flash update utility is intended for"
echo "use within Sun Microsystems' Operations groups only. It"
echo "is not intended for use by other groups within Sun or by"
echo "customers external to Sun."
PATH=/usr/bin:/usr/sbin:/sbin
TMP=/tmp/flash-update.\$\$
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
# backup driver location is for OPS, since their systems usually run
# as clients, and thus don't have a /usr/kernel/drv.
ALTDRVPATH=/platform/sun4u/kernel/drv
echo \`gettext \$textdom "\$XDRV does not exist or is not writable:"\`
echo \`gettext \$textdom "Driver is now located at \$ALTDRVPATH ."\`
DRV=\$ALTDRVPATH/$DRVRNAME
EDRV=\$ALTDRVPATH/$EDRVRNAM
echo \`gettext \$textdom "Could not find a writable driver location;"\`
echo \`gettext \$textdom " \$XDRV"\`
echo \`gettext \$textdom " \$ALTDRVPATH"\`
echo \`gettext \$textdom "\(Be sure the program is run as root.\)"\`
echo \`gettext \$textdom "The flash PROM update was not successful."\`
rem_drv $DRVRNAME > /dev/null 2>&1
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
rem_drv $EDRVRNAM > /dev/null 2>&1
DRV32_UU=\$TMP/flashprom32.uu
DRV64_UU=\$TMP/flashprom64.uu
$RMF \$DRV32_UU \$TMP/flashprom64.Z
$RMF \$DRV64_UU \$TMP/flashprom32.Z
compress -cf $INPDRVR32 |
uuencode flashprom32.Z \
compress -cf $INPDRVR64 |
uuencode flashprom64.Z \
rem_drv $DRVRNAME > /dev/null 2>&1
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
rem_drv $EDRVRNAM > /dev/null 2>&1
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
if [ -d /kernel/drv/sparcv9 ]
$RMF /kernel/drv/sparcv9/$DRVRNAME
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
$RMF /kernel/drv/sparcv9/$EDRVRNAM
cd \$TMP; uudecode \$DRV32_UU ; uncompress flashprom32.Z
cd \$TMP; uudecode \$DRV64_UU ; uncompress flashprom64.Z
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
cp -p \$TMP/flashprom32 \$EDRV
mv -f \$TMP/flashprom32 \$DRV
if [ -d /kernel/drv/sparcv9 ]
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
cp -p \$TMP/flashprom64 /kernel/drv/sparcv9/$EDRVRNAM
mv -f \$TMP/flashprom64 /kernel/drv/sparcv9/$DRVRNAME
$RMF \$DRV32_UU \$TMP/flashprom32.Z \$DRV64_UU \$TMP/flashprom64.Z
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
printf "rm -f /dev/flashprom:%s\n", \\\$2;
printf "ln -s %s:%s /dev/flashprom:%s\n", \\\$1, \\\$2, \\\$2;
printf "rm -f /dev/eeprom\n";
printf "ln -s %s:%s /dev/eeprom\n", \\\$1, \\\$2;
find ../devices -name "flashprom@*:\$1" -exec echo {} \; \
|awk -F: -f \$AWKSCR | /bin/sh
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
find ../devices -name "eeprom@*:\$1" -exec echo {} \; \
|awk -F: -f \$AWKSCRE | /bin/sh
if [ $ARG5 = SUN4U -0 $ARG6 = SUN4U ]
PRG_UU=\$TMP/flash-update.uu
$RMF \$PRG_UU \$TMP/flash-update.Z
$RMF \
$PRG_UU \
$TMP/flash-update.Z
compress -cf $PROGRAM |
uuencode flash-update.Z \
cd \$TMP; uudecode \$PRG_UU ; uncompress flash-update.Z ; \
$RMF \$PRG_UU \$TMP/flash-update.Z
# Exit status to indicate that the user chose to exit without doing the
# update - this is necessary so that a reboot is not issued.
if [ $ARG5 = OPS
-0 $ARG6 = OPS
]
#******ifthen-else-fi intentionally not indented******
# For Ops, always exit such that a reboot is never issued.
echo \`gettext \$textdom \\
"Please wait while the system is rebooted..."\`