[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] Add support for GPT partitioned disks on sparc/sparc64



Reviewed and applied after some minor cosmetic changes.

Thanks,
Adrian

On 03/05/2018 10:09 PM, Frank Scheiner wrote:
> The following patch adds support for GPT partitioned disks on sparc(64)
> to d-i/grub-installer. The installation method is chosen based on the
> detected subarch currently. It auto-selects the partition for /boot
> as target for grub-install on systems without GPT support and the
> actual disk device on systems with GPT support. The grub-install
> arguments are configured respectively.
> 
> The current implementation is very simple and based on the assumption
> that we will always have a partition containing "/boot" and that we
> either need to use this partition or the disk containing this partition
> as target for `grub-install` (depending on used partitioning). For
> partitioning it either expects GPT or assumes a Sun disklabel.
> 
> No user-interaction is provided during the GRUB installation step, so it
> might fail in complex situations. I.e. it worked for me when using empty
> disks without already installed other OSes. But although the
> installation on a disk with Sun disklabel and Solaris 10 installed and
> enough free space at the end of the disk worked as far as I can tell,
> booting from the disk did not start GRUB but the Solaris 10 boot loader.
> And booting from the actual "/boot" partition of the installed Debian
> didn't work as expected:
> 
> ```
> {0} ok boot disk0:d
> Boot device: /pci@0/pci@0/pci@2/scsi@0/disk@0:d  File and args: 
> GRUB ERROR: Last Trap: Fast Instruction Access MMU Miss
> ```
> 
> In the absence of a T4 or other GPT capable system I cannot test booting
> from a GPT partioned disk. But I can provide the modified parts of the
> Debian installer as tarball for easy application during a Debian
> installation if someone volunteers for testing.
> 
> Cheers,
> Frank
> 
> ---
>  debian/changelog |  7 +++++++
>  grub-installer   | 31 +++++++++++++++++++++++++++++--
>  2 files changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/debian/changelog b/debian/changelog
> index b5856a3..2c44fdf 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,3 +1,10 @@
> +grub-installer (1.154) UNRELEASED; urgency=medium
> +
> +  [ Frank Scheiner ]
> +  * Add support for GPT partitioned disks on sparc/sparc64.
> +
> + -- Frank Scheiner <frank.scheiner@web.de>  Mon, 05 Mar 2018 19:03:48 +0100
> +
>  grub-installer (1.153) unstable; urgency=medium
>  
>    [ Updated translations ]
> diff --git a/grub-installer b/grub-installer
> index f9f0761..c06639f 100755
> --- a/grub-installer
> +++ b/grub-installer
> @@ -39,6 +39,7 @@ debug () {
>  
>  ARCH="$(archdetect)"
>  info "architecture: $ARCH"
> +SUBARCH=${ARCH#*/}
>  
>  # Ensure proc is mounted in all the $chroot calls;
>  # needed for RAID+LVM for example
> @@ -626,7 +627,7 @@ if db_get cdrom-detect/hybrid; then
>  	hybrid="$RET"
>  fi
>  case $ARCH:$grub_package in
> -    *:grub|*:grub-pc|sparc/*:grub-ieee1275|sparc64/*:grub-ieee1275)
> +    *:grub|*:grub-pc)
>  	if [ "$(device_to_disk "$cdsrc")" = "$default_bootdev" ] || \
>  	   ([ -n "$hdsrc" ] && [ "$(device_to_disk "$hdsrc")" = "$default_bootdev" ]) || \
>  	   ([ "$default_bootdev" = '(hd0)' ] && \
> @@ -645,6 +646,23 @@ case $ARCH:$grub_package in
>  		fi
>  	fi
>  	;;
> +    sparc/*:grub-ieee1275|sparc64/*:grub-ieee1275)
> +	bootfs=$(findfs /boot)
> +	[ "$bootfs" ] || bootfs="$(findfs /)"
> +	# see: https://github.com/esnowberg/grub2-sparc/wiki
> +	case $SUBARCH in
> +	    *_gpt)
> +		# For GPT partitioning grub-install should use the device as target
> +		disk=$(device_to_disk "$bootfs")
> +		db_set grub-installer/bootdev "$disk"
> +		;;
> +	    *)
> +		# For Sun disklabel grub-install should use the boot partition as target
> +		db_set grub-installer/bootdev "$bootfs"
> +		;;
> +	esac
> +	state=3
> +	;;
>      powerpc/chrp*:grub-ieee1275|ppc64/chrp*:grub-ieee1275|ppc64el/*:grub-ieee1275)
>  	# Hack to pick the right boot device.  This should really be done in
>  	# grub-install instead, and will need to be done there in order to
> @@ -852,7 +870,16 @@ EOF
>  			;;
>  		    sparc/*|sparc64/*)
>  			# see: https://github.com/esnowberg/grub2-sparc/wiki
> -			grub_install_params="$grub_install_params --skip-fs-probe"
> +			case $SUBARCH in
> +			    *_gpt)
> +				# no additional parameters for installations on GPT partitioned
> +				# disks
> +				:
> +				;;
> +			    *)
> +				grub_install_params="$grub_install_params --skip-fs-probe"
> +				;;
> +			esac
>  			;;
>  		esac
>  
> 

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Attachment: pEpkey.asc
Description: application/pgp-keys


Reply to: