From owner-svn-src-stable@FreeBSD.ORG Mon May 14 15:18:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E43A1065670; Mon, 14 May 2012 15:18:48 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06F008FC08; Mon, 14 May 2012 15:18:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4EFIlt1038911; Mon, 14 May 2012 15:18:47 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4EFIlhs038908; Mon, 14 May 2012 15:18:47 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201205141518.q4EFIlhs038908@svn.freebsd.org> From: Josh Paetzel Date: Mon, 14 May 2012 15:18:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235447 - stable/9/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2012 15:18:48 -0000 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