summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pc-sysinstall/backend/functions-disk.sh
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/backend/functions-disk.sh
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/backend/functions-disk.sh')
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-disk.sh41
1 files changed, 40 insertions, 1 deletions
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