summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pc-sysinstall
diff options
context:
space:
mode:
authorjpaetzel <jpaetzel@FreeBSD.org>2012-05-04 15:36:51 +0000
committerjpaetzel <jpaetzel@FreeBSD.org>2012-05-04 15:36:51 +0000
commitd62d5e3c11401bb0cd88e259f245580f3cd5821c (patch)
treeeb003783ee51f59a2243e366d7ed3a84f1445679 /usr.sbin/pc-sysinstall
parent322588cef7d4caaa6619a0560c0c83a195d35ce9 (diff)
downloadFreeBSD-src-d62d5e3c11401bb0cd88e259f245580f3cd5821c.zip
FreeBSD-src-d62d5e3c11401bb0cd88e259f245580f3cd5821c.tar.gz
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 MFC after: 3 days Sponsored by: iXsystems
Diffstat (limited to 'usr.sbin/pc-sysinstall')
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh38
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-disk.sh41
2 files changed, 76 insertions, 3 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh b/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
index 35d0f50..e76721c 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
@@ -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
diff --git a/usr.sbin/pc-sysinstall/backend/functions-disk.sh b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
index 03064d5..2dd2532 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-disk.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
@@ -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
OpenPOWER on IntegriCloud