Date: Tue, 8 Nov 2011 23:44:26 +0000 (UTC) From: Josh Paetzel <jpaetzel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r227368 - head/usr.sbin/pc-sysinstall/backend Message-ID: <201111082344.pA8NiQxn054736@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jpaetzel Date: Tue Nov 8 23:44:26 2011 New Revision: 227368 URL: http://svn.freebsd.org/changeset/base/227368 Log: Welcome the initial patches for OSX bootcamp support!!! This should let you select the ada0p3 hybrid MBR/GPT partition, and do an installation to it. Approved by: kib (mentor) Obtained from: kris@pcbsd.org MFC after: 3 days Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-disk.sh head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Tue Nov 8 23:19:22 2011 (r227367) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Tue Nov 8 23:44:26 2011 (r227368) @@ -179,7 +179,9 @@ setup_gpart_partitions() else PARTLETTER="a" CURPART="1" - rc_halt "gpart create -s BSD ${_wSlice}" + if [ "${_pType}" = "mbr" ] ; then + rc_halt "gpart create -s BSD ${_wSlice}" + fi fi while read line @@ -255,6 +257,9 @@ setup_gpart_partitions() if [ "${CURPART}" = "1" -a "$_pType" = "mbr" ] ; then export FOUNDROOT="0" fi + if [ "${CURPART}" = "1" -a "$_pType" = "gptslice" ] ; then + export FOUNDROOT="0" + fi fi check_for_mount "${MNT}" "/boot" @@ -266,6 +271,9 @@ setup_gpart_partitions() if [ "${CURPART}" != "1" -a "${_pType}" = "mbr" ] ; then exit_err "/boot partition must be first partition" fi + if [ "${CURPART}" != "1" -a "${_pType}" = "gptslice" ] ; then + exit_err "/boot partition must be first partition" + fi if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ] ; then exit_err "/boot partition must be formatted with UFS" @@ -287,7 +295,7 @@ setup_gpart_partitions() # Check if using zfs mirror echo ${XTRAOPTS} | grep -q "mirror" 2>/dev/null if [ $? -eq 0 -a "$FS" = "ZFS" ] ; then - if [ "${_pType}" = "gpt" ] ; then + if [ "${_pType}" = "gpt" -o "${_pType}" = "gptslice" ] ; then XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}p${CURPART}") else XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_wSlice}") @@ -305,11 +313,17 @@ setup_gpart_partitions() if [ "${_pType}" = "gpt" ] ; then if [ "$CURPART" = "2" ] ; then # If this is GPT, make sure first partition is aligned to 4k + sleep 2 rc_halt "gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}" else + sleep 2 rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}" fi + elif [ "${_pType}" = "gptslice" ]; then + sleep 2 + rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}" else + sleep 2 rc_halt "gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}" fi @@ -338,7 +352,7 @@ setup_gpart_partitions() echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}p${CURPART}-encpass fi else - # MBR Partition + # MBR Partition or GPT slice _dFile="`echo $_wSlice | sed 's|/|-|g'`" echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE}" >${PARTDIR}/${_dFile}${PARTLETTER} # Clear out any headers @@ -422,7 +436,7 @@ populate_disk_label() if [ "$type" = "mbr" ] ; then wrkslice="${diskid}s${slicenum}" fi - if [ "$type" = "gpt" ] ; then + if [ "$type" = "gpt" -o "$type" = "gptslice" ] ; then wrkslice="${diskid}p${slicenum}" fi @@ -459,6 +473,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" = "gptslice" -a ! -e "${disk}p${pnum}" ] ; then + exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" + fi done # Setup some files which we'll be referring to Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Tue Nov 8 23:19:22 2011 (r227367) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Tue Nov 8 23:44:26 2011 (r227368) @@ -496,6 +496,13 @@ setup_disk_slice() run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" ;; + p1|p2|p3|p4|p5|p6|p7|p8|p9|p10|p11|p12|p13|p14|p15|p16|p17|p18|p19|p20) + tmpSLICE="${DISK}${PTYPE}" + # Get the number of the gpt partition we are working on + s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" + run_gpart_gpt_part "${DISK}" "${BMANAGER}" "${s}" + ;; + free) tmpSLICE="${DISK}s${LASTSLICE}" run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" @@ -704,6 +711,58 @@ run_gpart_full() fi }; +# Function which runs gpart on a specified gpt partition +run_gpart_gpt_part() +{ + DISK=$1 + + # Set the slice we will use later + slice="${1}p${3}" + + # Set our sysctl so we can overwrite any geom using drives + sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} + + # Get the number of the slice we are working on + slicenum="$3" + + # Stop any journaling + stop_gjournal "${slice}" + + # Make sure we have disabled swap on this drive + if [ -e "${slice}b" ] + then + swapoff ${slice}b >/dev/null 2>/dev/null + swapoff ${slice}b.eli >/dev/null 2>/dev/null + fi + + # Modify partition type + echo_log "Running gpart modify on ${DISK}" + rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}" + sleep 2 + + # Clean up old partition + echo_log "Cleaning up $slice" + rc_halt "dd if=/dev/zero of=${DISK}p${slicenum} count=1024" + + sleep 4 + + # Init the MBR partition + rc_halt "gpart create -s BSD ${DISK}p${slicenum}" + + # Set the slice to the format we'll be using for gpart later + slice=`echo "${1}:${3}:gptslice" | sed 's|/|-|g'` + + # Lets save our slice, so we know what to look for in the config file later on + if [ -z "$WORKINGSLICES" ] + then + WORKINGSLICES="${slice}" + export WORKINGSLICES + else + WORKINGSLICES="${WORKINGSLICES} ${slice}" + export WORKINGSLICES + fi +}; + # Function which runs gpart on a specified s1-4 slice run_gpart_slice() { Modified: head/usr.sbin/pc-sysinstall/backend/parseconfig.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Tue Nov 8 23:19:22 2011 (r227367) +++ head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Tue Nov 8 23:44:26 2011 (r227368) @@ -70,7 +70,6 @@ check_value installMode "fresh upgrade e check_value installType "PCBSD FreeBSD" check_value installMedium "dvd usb ftp rsync image local" check_value packageType "uzip tar rsync split" -if_check_value_exists partition "all s1 s2 s3 s4 free image" if_check_value_exists mirrorbal "load prefer round-robin split" # We passed all sanity checks! Yay, lets start the install
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111082344.pA8NiQxn054736>