svn commit: r235447 - stable/9/usr.sbin/pc-sysinstall/backend
Josh Paetzel
jpaetzel at FreeBSD.org
Mon May 14 15:18:48 UTC 2012
Author: jpaetzel
Date: Mon May 14 15:18:47 2012
New Revision: 235447
URL: http://svn.freebsd.org/changeset/base/235447
Log:
MFC: 235006
Add powerpc / powerpc64 support to pc-sysinstall. This patch will
autodetect if on powerpc and use the APM gpart GEOM class
automaticaly. At this time support for full disk installation is
the only supported scheme.
Submitted by: kmoore
Obtained from: PC-BSD
Sponsored by: iXsystems
Modified:
stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh
Directory Properties:
stable/9/usr.sbin/pc-sysinstall/ (props changed)
Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==============================================================================
--- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon May 14 15:15:13 2012 (r235446)
+++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon May 14 15:18:47 2012 (r235447)
@@ -177,6 +177,8 @@ setup_gpart_partitions()
# Lets read in the config file now and setup our partitions
if [ "${_pType}" = "gpt" ] ; then
CURPART="2"
+ elif [ "${_pType}" = "apm" ] ; then
+ CURPART="3"
else
PARTLETTER="a"
CURPART="1"
@@ -255,6 +257,9 @@ setup_gpart_partitions()
if [ "${CURPART}" = "2" -a "$_pType" = "gpt" ] ; then
export FOUNDROOT="0"
fi
+ if [ "${CURPART}" = "3" -a "$_pType" = "apm" ] ; then
+ export FOUNDROOT="0"
+ fi
if [ "${CURPART}" = "1" -a "$_pType" = "mbr" ] ; then
export FOUNDROOT="0"
fi
@@ -269,6 +274,9 @@ setup_gpart_partitions()
if [ "${CURPART}" != "2" -a "${_pType}" = "gpt" ] ; then
exit_err "/boot partition must be first partition"
fi
+ if [ "${CURPART}" != "3" -a "${_pType}" = "apm" ] ; then
+ exit_err "/boot partition must be first partition"
+ fi
if [ "${CURPART}" != "1" -a "${_pType}" = "mbr" ] ; then
exit_err "/boot partition must be first partition"
fi
@@ -288,6 +296,8 @@ setup_gpart_partitions()
# Get any extra options for this fs / line
if [ "${_pType}" = "gpt" ] ; then
get_fs_line_xvars "${_pDisk}p${CURPART}" "${STRING}"
+ elif [ "${_pType}" = "apm" ] ; then
+ get_fs_line_xvars "${_pDisk}s${CURPART}" "${STRING}"
else
get_fs_line_xvars "${_wSlice}${PARTLETTER}" "${STRING}"
fi
@@ -298,6 +308,8 @@ setup_gpart_partitions()
if [ $? -eq 0 -a "$FS" = "ZFS" ] ; then
if [ "${_pType}" = "gpt" -o "${_pType}" = "gptslice" ] ; then
XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}p${CURPART}")
+ elif [ "${_pType}" = "apm" ] ; then
+ XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}s${CURPART}")
else
XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_wSlice}${PARTLETTER}")
fi
@@ -323,6 +335,9 @@ setup_gpart_partitions()
elif [ "${_pType}" = "gptslice" ]; then
sleep 2
rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}"
+ elif [ "${_pType}" = "apm" ]; then
+ sleep 2
+ rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}"
else
sleep 2
rc_halt "gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}"
@@ -352,6 +367,18 @@ setup_gpart_partitions()
if [ -n "${ENCPASS}" ] ; then
echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}p${CURPART}-encpass
fi
+ elif [ "${_pType}" = "apm" ] ; then
+ _dFile="`echo $_pDisk | sed 's|/|-|g'`"
+ echo "${FS}#${MNT}#${ENC}#${PLABEL}#GPT#${XTRAOPTS}" >${PARTDIR}/${_dFile}s${CURPART}
+
+ # Clear out any headers
+ sleep 2
+ dd if=/dev/zero of=${_pDisk}s${CURPART} count=2048 2>/dev/null
+
+ # If we have a enc password, save it as well
+ if [ -n "${ENCPASS}" ] ; then
+ echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}s${CURPART}-encpass
+ fi
else
# MBR Partition or GPT slice
_dFile="`echo $_wSlice | sed 's|/|-|g'`"
@@ -368,9 +395,10 @@ setup_gpart_partitions()
# Increment our parts counter
- if [ "$_pType" = "gpt" ] ; then
+ if [ "$_pType" = "gpt" -o "$_pType" = "apm" ] ; then
CURPART=$((CURPART+1))
- # If this is a gpt partition, we can continue and skip the MBR part letter stuff
+ # If this is a gpt/apm partition,
+ # we can continue and skip the MBR part letter stuff
continue
else
CURPART=$((CURPART+1))
@@ -437,6 +465,9 @@ populate_disk_label()
if [ "$type" = "mbr" ] ; then
wrkslice="${diskid}s${slicenum}"
fi
+ if [ "$type" = "apm" ] ; then
+ wrkslice="${diskid}s${slicenum}"
+ fi
if [ "$type" = "gpt" -o "$type" = "gptslice" ] ; then
wrkslice="${diskid}p${slicenum}"
fi
@@ -474,6 +505,9 @@ setup_disk_label()
if [ "$type" = "gpt" -a ! -e "${disk}p${pnum}" ] ; then
exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!"
fi
+ if [ "$type" = "apm" -a ! -e "${disk}s${pnum}" ] ; then
+ exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!"
+ fi
if [ "$type" = "gptslice" -a ! -e "${disk}p${pnum}" ] ; then
exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!"
fi
Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==============================================================================
--- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon May 14 15:15:13 2012 (r235446)
+++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon May 14 15:18:47 2012 (r235447)
@@ -464,6 +464,12 @@ setup_disk_slice()
# Found our flag to commit this disk setup / lets do sanity check and do it
if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ]
then
+ # Make sure we are only installing ppc to full disk
+ if [ `uname -m` = "powerpc" -o `uname -m` = "powerpc64" ]; then
+ if [ "$PTYPE" != "all" ] ; then
+ exit_err "powerpc can only be installed to a full disk"
+ fi
+ fi
case ${PTYPE} in
all)
@@ -488,6 +494,12 @@ setup_disk_slice()
tmpSLICE="${DISK}p1"
fi
+ if [ `uname -m` = "powerpc" -o `uname -m` = "powerpc64" ]
+ then
+ PSCHEME="APM"
+ tmpSLICE="${DISK}s1"
+ fi
+
run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}"
;;
@@ -597,6 +609,30 @@ clear_backup_gpt_table()
rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=`diskinfo ${1} | awk '{print int($3 / (1024*1024)) - 4;}'`"
} ;
+# Function which runs gpart and creates a single large APM partition scheme
+init_apm_full_disk()
+{
+ _intDISK=$1
+
+ # Set our sysctl so we can overwrite any geom using drives
+ sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
+
+ # Stop any journaling
+ stop_gjournal "${_intDISK}"
+
+ # Remove any existing partitions
+ delete_all_gpart "${_intDISK}"
+
+ sleep 2
+
+ echo_log "Running gpart on ${_intDISK}"
+ rc_halt "gpart create -s APM ${_intDISK}"
+ rc_halt "gpart add -s 800k -t freebsd-boot ${_intDISK}"
+
+ echo_log "Stamping boot sector on ${_intDISK}"
+ rc_halt "gpart bootcode -p /boot/boot1.hfs -i 1 ${_intDISK}"
+
+}
# Function which runs gpart and creates a single large GPT partition scheme
init_gpt_full_disk()
@@ -670,7 +706,10 @@ run_gpart_full()
BOOT=$2
SCHEME=$3
- if [ "$SCHEME" = "MBR" ] ; then
+ if [ "$SCHEME" = "APM" ] ; then
+ init_apm_full_disk "$DISK"
+ slice=`echo "${DISK}:1:apm" | sed 's|/|-|g'`
+ elif [ "$SCHEME" = "MBR" ] ; then
init_mbr_full_disk "$DISK" "$BOOT"
slice=`echo "${DISK}:1:mbr" | sed 's|/|-|g'`
else
More information about the svn-src-stable-9
mailing list