changeset 10661:789e162d8de6

6777211 SPARC systems need ITU lovin'
author xun ni - Sun Microsystems - Beijing China <Xun.Ni@Sun.COM>
date Mon, 28 Sep 2009 10:21:13 +0800
parents 8ff949139766
children fd0d1bbdb9a0
files usr/src/cmd/boot/scripts/root_archive.ksh usr/src/cmd/itutools/itu.ksh usr/src/cmd/itutools/mkbootmedia.ksh usr/src/cmd/itutools/pkg2du.ksh usr/src/cmd/itutools/updatemedia.ksh
diffstat 5 files changed, 279 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/boot/scripts/root_archive.ksh	Mon Sep 28 10:26:43 2009 +0800
+++ b/usr/src/cmd/boot/scripts/root_archive.ksh	Mon Sep 28 10:21:13 2009 +0800
@@ -735,7 +735,9 @@
 			find kernel/misc/sparcv9/ctf kernel/fs/sparcv9/dcfs \
 			    kernel/misc/ctf kernel/fs/dcfs \
 			    etc/system etc/name_to_major etc/path_to_inst \
-			    etc/name_to_sysnum | cpio -pdum $DST 2> /dev/null
+			    etc/name_to_sysnum  etc/driver_aliases \
+			    etc/driver_classes etc/minor_perm | \
+			    cpio -pdum $DST 2> /dev/null
 		fi
 	)
 }
--- a/usr/src/cmd/itutools/itu.ksh	Mon Sep 28 10:26:43 2009 +0800
+++ b/usr/src/cmd/itutools/itu.ksh	Mon Sep 28 10:21:13 2009 +0800
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
@@ -39,7 +39,6 @@
 readonly PATCHADD=/usr/sbin/patchadd
 readonly PKGTRANS=/usr/bin/pkgtrans
 readonly PKGADD=/usr/sbin/pkgadd
-readonly ROOT_ARCHIVE=/usr/sbin/root_archive
 readonly LOFIADM=/usr/sbin/lofiadm
 readonly MKDIR=/usr/bin/mkdir
 readonly RM=/usr/bin/rm
@@ -57,9 +56,21 @@
 readonly SED=/usr/bin/sed
 readonly CAT=/usr/bin/cat
 readonly FIND=/usr/bin/find
+readonly UNAME=/usr/bin/uname
+readonly MACH=`$UNAME -p`
 
+ROOT_ARCHIVE=/usr/sbin/root_archive
+BOOTBLOCK=
+MINIROOT=
 # Relative to a Solaris media root.
-readonly ELTORITO=boot/grub/stage2_eltorito
+if [ "$MACH" = "sparc" ]; then
+	BOOTBLOCK=boot/hsfs.bootblock
+	MINIROOT=$MEDIA_ROOT/boot/sparc.miniroot
+else
+	# x86/x64
+	BOOTBLOCK=boot/grub/stage2_eltorito
+	MINIROOT=$MEDIA_ROOT/boot/x86.miniroot
+fi
 
 readonly TMP_DIR=${TMPDIR:-/tmp}/${PROG##*/}.$$
 readonly LOGFILE=${TMPDIR:-/tmp}/${PROG##*/}-log.$$
@@ -408,10 +419,15 @@
 	MINIROOT=$MEDIA_ROOT/boot/x86.miniroot
 	if [[ ! -f "$MINIROOT" ]]
 	then
-		gettext "Can't find $MINIROOT.\n"
-		return 1
+		return 0 
 	fi
-	return 0
+	MINIROOT=$MEDIA_ROOT/boot/sparc.miniroot
+	if [[ ! -f "$MINIROOT" ]]
+	then
+		return 0 
+	fi
+	gettext "Can't find $MEDIA_ROOT/boot/x86.miniroot or $MEDIA_ROOT/boot/sparc.miniroot.\n"
+	return 1 
 }
 
 
@@ -453,10 +469,22 @@
 	# Note: the "-log-file >(cat -u >&2)" and "2>/dev/null" below is a
 	#	trick to filter out mkisofs's warning message about being
 	#	non-conforming to ISO-9660.
+	# We do some funky architecture-specific stuff here so that we can
+	# actually create a bootable media image for UltraSPARC systems
+
+	sparc_ISOARGS="-B ... -joliet-long -U"
+	i386_ISOARGS="-d -N -r -relaxed-filenames"
+	if [[ "$MACH" = "i386" ]]
+	then
+		ISOARGS=$i386_ISOARGS
+	else
+		ISOARGS=$sparc_ISOARGS
+	fi
+	
 	$MKISOFS -o "$ISO" \
-		-relaxed-filenames \
 		-allow-leading-dots \
-		-N -l -d -D -r \
+		$ISOARGS \
+		-l -ldots \
 		-R -J \
 		-V "$ISOLABEL" \
 		$vflag \
@@ -498,38 +526,47 @@
 		;;
 	esac
 
-	# Verify the El Torito file exists under media root.  And if so,
+	# Verify the boot block exists under media root. If it does,	
 	# verify it's writable since it will be modified with some boot
 	# information by mkisofs' -boot-info-table option.
-	if [[ ! -f "$dir/$ELTORITO" ]]
+	if [[ ! -f "$dir/$BOOTBLOCK" ]]
 	then
-		gettext "Can't find $dir/$ELTORITO.\n"
+		gettext "Can't find $dir/$BOOTBLOCK.\n"
 		return 1
-	elif [[ ! -w "$dir/$ELTORITO" ]]
+	elif [[ ! -w "$dir/$BOOTBLOCK" ]]	
 	then
-		gettext "$dir/$ELTORITO is not writable.\n"
+		gettext "$dir/$BOOTBLOCK is not writable.\n"	
 		return 1
 	fi
 
 	gettext "Creating bootable ISO image ..."
 
-	# Since mkisofs below will modify the file $ELTORITO in-place, save
+	# Since mkisofs below will modify the file $BOOTBLOCK in-place, save
 	# a copy of it first.
-	saved=$TMP_DIR/${ELTORITO##*/}
-	$CP -f "$dir/$ELTORITO" "$saved" || return
+	saved=$TMP_DIR/${BOOTBLOCK##*/}
+	$CP -f "$dir/$BOOTBLOCK" "$saved" || return
 
 	# Note: the "-log-file >(cat -u >&2)" and "2>/dev/null" below is a
 	#	trick to filter out mkisofs's warning message about being
 	#	non-conforming to ISO-9660.
+	# We do some funky architecture-specific stuff here so that we can
+	# actually create a bootable media image for UltraSPARC systems
+	sparc_ISOARGS="-G $BOOTBLOCK -B ... -joliet-long -U"
+	i386_ISOARGS="-b boot/grub/stage2_eltorito -boot-info-table "
+	i386_ISOARGS="$i386_ISOARGS -boot-load-size 4 -c .catalog -d -N "
+	i386_ISOARGS="$i386_ISOARGS -no-emul-boot -r -relaxed-filenames"
+	if [[ "$MACH" = "i386" ]]
+	then
+		ISOARGS=$i386_ISOARGS
+	else
+		ISOARGS=$sparc_ISOARGS
+	fi
+
+	cd $dir
 	$MKISOFS -o "$ISO" \
-		-b "$ELTORITO" \
-		-c .catalog \
-		-no-emul-boot \
-		-boot-load-size 4 \
-		-boot-info-table \
-		-relaxed-filenames \
 		-allow-leading-dots \
-		-N -l -d -D -r \
+		$ISOARGS \
+		-l -ldots \
 		-R -J \
 		-V "$ISOLABEL" \
 		$vflag \
@@ -552,9 +589,23 @@
 	typeset distdir tmpdudir pkgs obj statusfile
 
 	# Create DU directory first.
-	distdir=$DU_OUTDIR/DU/sol_$VERSION/i86pc
+	distdir=$DU_OUTDIR/DU/sol_$VERSION/$MACH
 	$MKDIR -p "$distdir/Tools" "$distdir/Product"
 
+	echo "start create DU with MACH $MACH"
+
+	# If we're running this script on sun4[vu], then create a symlink
+	# to the other UltraSPARC architecture
+	if [[ "$MACH" != "i386" ]]
+	then
+		cd $DU_OUTDIR/DU/sol_$VERSION
+		$LN -s sparc sun4v
+		$LN -s sparc sun4u
+	else
+		cd $DU_OUTDIR/DU/sol_$VERSION
+		$LN -s i386 i86pc
+	fi		
+
 	# Unfortunately pkgtrans insists that all packages must be in
 	# <device1> (see pkgtrans(1)).  The packages can't have any path
 	# components.  So we'll create a temporary directory first and then
@@ -615,19 +666,61 @@
 basedir=/
 toolsdir=`dirname $0`
 tmpfile=/tmp/`basename $0`.$$
+gzip=/usr/bin/gzip
 while getopts "R:" arg
 do
         case "$arg" in
                 R) basedir=$OPTARG;;
         esac
 done
-/usr/bin/gzip -c -d "$toolsdir/../Product/pkgs.gz" > $tmpfile &&
+
+# /etc/driver_aliases ,/etc/driver_classes
+# /etc/name_to_major /etc/minor_perm
+# The four file can't append due to ACL defect.
+# workaround this by mv and cp
+
+/usr/bin/touch /etc/driver_aliases
+if [ $? -ne 0 ] ; then
+        /bin/cp /etc/driver_aliases /tmp/driver_aliases
+        /bin/mv /etc/driver_aliases /tmp/driver_aliases.bak
+        /bin/mv /tmp/driver_aliases /etc
+fi
+/usr/bin/touch /etc/driver_classes
+if [ $? -ne 0 ] ; then
+        /bin/cp /etc/driver_classes /tmp/driver_classes
+        /bin/mv /etc/driver_classes /tmp/driver_classes.bak
+        /bin/mv /tmp/driver_classes /etc
+fi
+/usr/bin/touch /etc/name_to_major
+if [ $? -ne 0 ] ; then
+        /bin/cp /etc/name_to_major /tmp/name_to_major
+        /bin/mv /etc/name_to_major /tmp/name_to_major.bak
+        /bin/mv /tmp/name_to_major /etc
+fi
+/usr/bin/touch /etc/minor_perm
+if [ $? -ne 0 ] ; then
+        /bin/cp /etc/minor_perm /tmp/minor_perm
+        /bin/mv /etc/minor_perm /tmp/minor_perm.bak
+        /bin/mv /tmp/minor_perm /etc
+fi     
+
+# Make sure that we've got our own copy of /usr/bin/gzip
+# in the tools directory 
+
+if [ ! -f $gzip ] ; then
+        gzip=$toolsdir/gzip
+        /usr/bin/chmod a+x "$toolsdir/gzip" 2>/dev/null
+fi
+
+$gzip -c -d "$toolsdir/../Product/pkgs.gz" > $tmpfile &&
 	/usr/sbin/pkgadd -R "$basedir" -d "$tmpfile" -a "$toolsdir/admin" all
 status=$?
 rm -f "$tmpfile"
 exit $status
 EOF
 	$CHMOD a+rx "$distdir/Tools/install.sh"
+
+	$CP -f /usr/bin/gzip "$distdir/Tools" 2>/dev/null
 }
 
 
@@ -642,11 +735,13 @@
 	# We need to use the unpackmedia option to correctly apply patches
 	gettext "Unpacking media ... "
 	$ROOT_ARCHIVE unpackmedia "$MEDIA_ROOT" "$UNPACKED_ROOT" > /dev/null 2>&1 
-	if [ $? != 0 -a ! -d $MEDIA_ROOT/Solaris_10 ]; then
-		# we _do_ care, because we're not patching a Solaris 10
-		# update media instance
-		gettext "There was an error unpacking the media from $MEDIA_ROOT\n"
-		exit 1
+	if [ $? != 0 ]; then
+		if [ -d $MEDIA_ROOT/Solaris_10 -a -d $MEDIA_ROOT/Solaris_11 ]; then
+			# we _do_ care, because we're not patching a Solaris
+			# update media instance
+			gettext "There was an error unpacking the media from $MEDIA_ROOT\n"
+			exit 1
+		fi
 	fi
 }
 
@@ -664,16 +759,19 @@
 	# and this will cause problems on re-packing. So we sneakily
 	# use the version that we've just unpacked
 	if [ -d $MEDIA_ROOT/Solaris_10 ]; then
-		ROOT_ARCHIVE=$MEDIA_ROOT/boot/solaris/bin/root_archive
+		ROOT_ARCHIVE=$UNPACKED_ROOT/boot/solaris/bin/root_archive
 	fi
 
 	$ROOT_ARCHIVE packmedia "$MEDIA_ROOT" "$UNPACKED_ROOT" > /dev/null 2>&1
-	if [ $? != 0 -a ! -d $MEDIA_ROOT/Solaris_10 ]; then
-		# we _do_ care, because we're not patching a Solaris 10
-		# update media instance
-		gettext "There was an error unpacking the media from $MEDIA_ROOT\n"
-		exit 1
+	if [ $? != 0 ]; then
+		if [ -d $MEDIA_ROOT/Solaris_10 -a -d $MEDIA_ROOT/Solaris_11 ]; then
+			# we _do_ care, because we're not patching a Solaris 
+			# update media instance
+			gettext "There was an error packing the media from $MEDIA_ROOT\n"
+			exit 1
+		fi
 	fi
+	gettext "Done.\n"
 }
 
 
@@ -705,7 +803,7 @@
 	#
 	echo;
 	gettext "Installing package(s) onto miniroot.\n"
-	icmd=$DU_OUTDIR/DU/sol_$VERSION/i86pc/Tools/install.sh
+	icmd=$DU_OUTDIR/DU/sol_$VERSION/$MACH/Tools/install.sh
 	if [[ ! -f "$icmd" ]]
 	then
 		# This shouldn't happen, but just in case.
@@ -753,11 +851,23 @@
 
 	$RM -rf "$tmpdir"
 
-	distdir=$ITUDIR/$ITU_COUNTDIR/DU/sol_$VERSION/i86pc
+	distdir=$ITUDIR/$ITU_COUNTDIR/DU/sol_$VERSION/$MACH
 	(( ITU_COUNTDIR += 1 ))
 
 	$MKDIR -p "$distdir/Tools" "$distdir/Product" "$tmpdir" || return
 
+	# If we're running this script on sun4[vu], then create a symlink
+	# to the other UltraSPARC architecture
+	if [[ "$MACH" != "i386" ]]
+	then
+		cd $ITUDIR/$ITU_COUNTDIR/DU/sol_$VERSION
+		$LN -s sparc sun4v
+		$LN -s sparc sun4u
+	else
+		cd $ITUDIR/$ITU_COUNTDIR/DU/sol_$VERSION
+		$LN -s i386 i86pc
+	fi	
+
 	#
 	# Add packages onto media root
 	#
@@ -817,6 +927,7 @@
 basedir=/
 toolsdir=`dirname $0`
 tmpdir=/tmp/`basename $0`.$$
+gzip=/usr/bin/gzip
 trap "/bin/rm -rf $tmpdir" 0
 while getopts "R:" arg
 do
@@ -828,13 +939,24 @@
 tmpfile=$tmpdir/patches
 patchdir=$tmpdir/patchdir
 /bin/mkdir "$patchdir" || exit
-/usr/bin/gzip -c -d "$toolsdir/../Product/patches.gz" > $tmpfile || exit
+
+# Make sure that we've got our own copy of /usr/bin/gzip
+# in the tools directory 
+
+if [ ! -f $gzip ] ; then
+        gzip=$toolsdir/gzip
+        /usr/bin/chmod a+x "$toolsdir/gzip" 2>/dev/null
+fi
+
+$gzip -c -d "$toolsdir/../Product/patches.gz" > $tmpfile || exit
 cd "$patchdir"
 /bin/cpio -idum < "$tmpfile" || exit
 patchadd -R "$basedir" -nu *
 EOF
 	$CHMOD a+rx "$distdir/Tools/install.sh"
 
+	$CP -f /usr/bin/gzip "$distdir/Tools" 2>/dev/null
+
 	#
 	# Patch the miniroot
 	#
@@ -905,7 +1027,7 @@
 	if [[ -n "$ISO" ]]
 	then
 		check_iso || return
-		${ISOLABEL:=DU sol_$VERSION}		# default ISO label
+		${ISOLABEL:=DU sol_$VERSION} 2>/dev/null 		# default ISO label
 	fi
 	check_dudir || return		# should be called after check_iso
 
@@ -920,6 +1042,12 @@
 	then
 		$RM -rf "$DU_OUTDIR/DU"
 		[[ -n "$ISO" ]] && rm -f "$ISO"
+	else
+		if [[ "$MACH" != "i386" ]]
+		then
+			echo "This DU must be written as either an ISO (hsfs)"
+			echo "or a *ufs* filesystem. DO NOT USE pcfs!"
+		fi
 	fi
 	return $i
 }
@@ -1012,6 +1140,7 @@
 	print
 	repack_media || return
 	create_bootable_iso "$MEDIA_ROOT"
+	gettext "$MEDIA_ROOT has been successfully patched\n"
 }
 
 
--- a/usr/src/cmd/itutools/mkbootmedia.ksh	Mon Sep 28 10:26:43 2009 +0800
+++ b/usr/src/cmd/itutools/mkbootmedia.ksh	Mon Sep 28 10:21:13 2009 +0800
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
@@ -31,9 +31,14 @@
 readonly PROG=$0
 MKISOFS=/usr/bin/mkisofs
 ELTORITO=boot/grub/stage2_eltorito	# relative to $MEDIA_ROOT
+SPARCBOOT=boot/hsfs.bootblock
+CAT=/usr/bin/cat
 CP=/usr/bin/cp
 RM=/usr/bin/rm
-
+UNAME=/usr/bin/uname
+MACH=`$UNAME -p`
+BOOTBLOCK=
+GREP=/usr/bin/grep
 
 # for gettext
 TEXTDOMAIN=SUNW_OST_OSCMD
@@ -106,10 +111,11 @@
 	exit 1
 fi
 
-# We will have the El Torito file modified with some boot information
-# (-boot-info-table option) so it needs to be writable.
-if [[ ! -w "$MEDIA_ROOT/$ELTORITO" ]]
-then
+# If we're on an x86/x64 system, we need to have the El Torito file
+# modified with some boot information (-boot-info-table option).
+# If the image isn't writable, we can't continue
+# UltraSPARC systems (sun4u, sun4v etc) don't use El Torito
+if [[ "$MACH" = "i386" && ! -w "$MEDIA_ROOT/$ELTORITO" ]]; then
 	gettext "$MEDIA_ROOT/$ELTORITO is not writable.\n"
 	exit 1
 fi
@@ -140,26 +146,47 @@
 # Since mkisofs below will modify the file $ELTORITO in-place, save a copy
 # of it first.  Use trap to restore it when this script exits (including
 # when user hits control-C).
-ELTORITO_SAVE=/tmp/${ELTORITO##*/}.$$
-$CP "$MEDIA_ROOT/$ELTORITO" "$ELTORITO_SAVE" || exit 1
-trap '"$CP" "$ELTORITO_SAVE" "$MEDIA_ROOT/$ELTORITO" 2>/dev/null;
-	"$RM" -f "$ELTORITO_SAVE"' EXIT
+
+if [[ "$MACH" = "i386" ]]
+then
+	BOOTBLOCK=$MEDIA_ROOT/$ELTORITO
+	ELTORITO_SAVE=/tmp/${ELTORITO##*/}.$$
+	$CP "$MEDIA_ROOT/$ELTORITO" "$ELTORITO_SAVE" || exit 1
+	trap '"$CP" "$ELTORITO_SAVE" "$MEDIA_ROOT/$ELTORITO" 2>/dev/null;
+		"$RM" -f "$ELTORITO_SAVE"' EXIT
+else
+	# sun4u/sun4u1/sun4v et al
+	BOOTBLOCK=$MEDIA_ROOT/$SPARCBOOT
+	SPARCBOOT_SAVE=/tmp/hsfs.bootblock.$$
+	$CP "$MEDIA_ROOT/$SPARCBOOT" "$SPARCBOOT_SAVE" || exit 1
+	trap '"$CP" "$MEDIA_ROOT/$SPARCBOOT" "$SPARCBOOT_SAVE" 2>/dev/null;
+		"$RM" -f $SPARCBOOT_SAVE"' EXIT
+fi
 
 # Call mkisofs to do the actual work.
 # Note: the "-log-file >(cat -u >&2)" and "2>/dev/null" below is a trick
 #	to filter out mkisofs's warning message about being non-conforming
 #	to ISO-9660.
+# We do some funky architecture-specific stuff here so that we can
+# actually create a bootable media image for UltraSPARC systems
+
+sparc_ISOARGS="-G $BOOTBLOCK -B ... -joliet-long -R -U"
+i386_ISOARGS="-b boot/grub/stage2_eltorito -boot-info-table "
+i386_ISOARGS="$i386_ISOARGS -boot-load-size 4 -c .catalog -d -N "
+i386_ISOARGS="$i386_ISOARGS -no-emul-boot -r -relaxed-filenames"
+if [[ "$MACH" = "i386" ]]
+then
+	ISOARGS=$i386_ISOARGS
+else
+	ISOARGS=$sparc_ISOARGS
+fi
+
 $MKISOFS -o "$ISOIMAGE" \
-	-b "$ELTORITO" \
-	-c .catalog \
-	-no-emul-boot \
-	-boot-load-size 4 \
-	-boot-info-table \
-	-relaxed-filenames \
 	-allow-leading-dots \
-	-N -l -d -D -r \
+	$ISOARGS \
+	-l -ldots \
 	-R -J \
-	-V "$LABEL" \
+	-V "$ISOLABEL" \
 	$VERBOSE_FLAG \
-	-log-file >(/bin/cat -u >&2) \
+	-log-file >($CAT -u >&2) \
 	"$MEDIA_ROOT" 2>/dev/null
--- a/usr/src/cmd/itutools/pkg2du.ksh	Mon Sep 28 10:26:43 2009 +0800
+++ b/usr/src/cmd/itutools/pkg2du.ksh	Mon Sep 28 10:21:13 2009 +0800
@@ -21,7 +21,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
@@ -57,6 +57,8 @@
 readonly SED=/usr/bin/sed
 readonly CAT=/usr/bin/cat
 readonly FIND=/usr/bin/find
+readonly UNAME=/usr/bin/uname
+readonly MACH=`$UNAME -p`
 
 # for gettext
 TEXTDOMAIN=SUNW_OST_OSCMD
@@ -144,9 +146,20 @@
 	trap '/bin/rm -rf $statusfile $tmpdudir' EXIT
 
 	# Create DU directory first.
-	distdir=$ROOTDIR/DU/sol_$VERSION/i86pc
+	distdir=$ROOTDIR/DU/sol_$VERSION/$MACH
 	$MKDIR -p "$distdir/Tools" "$distdir/Product"
 
+	# to the other UltraSPARC architecture
+	if [[ "$MACH" != "i386" ]]
+	then
+		cd $ROOTDIR/DU/sol_$VERSION
+		$LN -s sparc sun4v
+		$LN -s sparc sun4u
+	else
+		cd $ROOTDIR/DU/sol_$VERSION
+		$LN -s i386 i86pc
+	fi	
+
 	# Unfortunately pkgtrans insists that all packages must be in
 	# <device1> (see pkgtrans(1)).  The packages can't have any path
 	# components.  So we'll create a temporary directory first and then
@@ -244,14 +257,26 @@
 	# Note: the "-log-file >(cat -u >&2)" and "2>/dev/null" below is a
 	#	trick to filter out mkisofs's warning message about being
 	#	non-conforming to ISO-9660.
+	# We do some funky architecture-specific stuff here so that we can
+	# actually create a bootable media image for UltraSPARC systems
+	
+	ISOARGS_sparc="-B ... -joliet-long -R -U"
+	ISOARGS_i386="-d -N -r -relaxed-filenames"	
+	if [[ "$MACH" = "i386" ]]
+	then
+		ISOARGS=$ISOARGS_i386
+	else
+		ISOARGS=$ISOARGS_sparc
+	fi
+
 	$MKISOFS -o "$ISO" \
-		-relaxed-filenames \
 		-allow-leading-dots \
-		-N -l -d -D -r \
+		$ISOARGS \
+		-ldots -full-iso9660-filenames \
 		-R -J \
-		-V "$LABEL" \
+		-V "$ISOLABEL" \
 		$vflag \
-		-log-file >(/bin/cat -u >&2) \
+		-log-file >($CAT -u >&2) \
 		"$ROOTDIR" 2>/dev/null
 }
 
--- a/usr/src/cmd/itutools/updatemedia.ksh	Mon Sep 28 10:26:43 2009 +0800
+++ b/usr/src/cmd/itutools/updatemedia.ksh	Mon Sep 28 10:21:13 2009 +0800
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
@@ -54,9 +54,10 @@
 readonly FIND=/usr/bin/find
 readonly HEAD=/usr/bin/head
 readonly SORT=/usr/bin/sort
-readonly ROOT_ARCHIVE=/usr/sbin/root_archive
+readonly UNAME=/usr/bin/uname
+readonly MACH=`$UNAME -p`
 
-
+ROOT_ARCHIVE=/usr/sbin/root_archive
 # for gettext
 TEXTDOMAIN=SUNW_OST_OSCMD
 export TEXTDOMAIN
@@ -130,7 +131,7 @@
 	# and this will cause problems on re-packing. So we sneakily
 	# use the version that we've just unpacked
 	if [ -d $MEDIA_ROOT/Solaris_10 ]; then
-		ROOT_ARCHIVE=$MEDIA_ROOT/boot/solaris/bin/root_archive
+		ROOT_ARCHIVE=$UNPACKED_ROOT/boot/solaris/bin/root_archive
 	fi
 
 	$ROOT_ARCHIVE packmedia "$MEDIA_ROOT" "$UNPACKED_ROOT" > /dev/null 2>&1
@@ -202,7 +203,7 @@
 	# Using the Driver Update above install the packages onto the miniroot.
 	echo;
 	gettext "Installing package(s) onto miniroot."
-	icmd=$dudir/DU/sol_$VERSION/i86pc/Tools/install.sh
+	icmd=$dudir/DU/sol_$VERSION/$MACH/Tools/install.sh
 	if [[ ! -f "$icmd" ]]
 	then
 		# This shouldn't happen, but just in case.
@@ -241,11 +242,23 @@
 
 	trap '$RM -rf $tmpdir $statusfile' EXIT
 
-	distdir=$ITUDIR/$COUNTDIR/DU/sol_$VERSION/i86pc
+	distdir=$ITUDIR/$COUNTDIR/DU/sol_$VERSION/$MACH
 	(( COUNTDIR += 1 ))
 
 	$MKDIR -p "$distdir/Tools" "$distdir/Product" "$tmpdir" || return
 
+	# If we're running this script on sun4[vu], then create a symlink
+	# to the other UltraSPARC architecture
+	if [[ "$MACH" != "i386" ]]
+	then
+		cd $ITUDIR/$COUNTDIR/DU/sol_$VERSION/
+		$LN -s sparc sun4v
+		$LN -s sparc sun4u
+	else
+		cd $ITUDIR/$COUNTDIR/DU/sol_$VERSION/
+		$LN -s i386 i86pc
+	fi	
+
 	# Patch the miniroot
 	echo;
 	gettext "Installing patch(es) onto miniroot."
@@ -413,12 +426,19 @@
 VERSION=$(echo $RELEASE | $SED 's/5\./2/')
 
 # If user didn't specify ISO label, use the Solaris_* dir as label.
-${ISOLABEL:=${SOLARIS_DIR##*/}}
+${ISOLABEL:=${SOLARIS_DIR##*/}} 2>/dev/null
 
 # Verify miniroot
-MINIROOT=$MEDIA_ROOT/boot/x86.miniroot
-if [[ ! -f "$MINIROOT" ]]
-then
+
+MINIROOT=
+# Relative to a Solaris media root.
+if [ "$MACH" = "sparc" ]; then
+	MINIROOT=$MEDIA_ROOT/boot/sparc.miniroot
+else
+	# x86/x64
+	MINIROOT=$MEDIA_ROOT/boot/x86.miniroot
+fi
+if [ ! -f $MINIROOT ]; then
 	gettext "No boot/x86.miniroot under media root.\n"
 	exit 1
 fi