[PATCH] Add support for GPT partitioned disks on sparc/sparc64
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 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 -- 1.9.1
[PATCH] Add specific recipes for GPT partitioning on sparc/sparc64
The following patch will add d-i/partman-auto recipes for sparc/sparc64 on sun4u and sun4v based systems with GPT support. They are based on the default recipes (below ./recipes) and the recipes for sparc (below ./recipes-sparc). In contrast to the default of a 1 MB sized BIOS_GRUB partition after 1 MB of empty space from the beginning of the device these use a 10 MB sized partition. Eric mentions a slightly smaller size on [1] though I actually don't know what minimum space is needed there. [1]: https://github.com/esnowberg/grub2-sparc/wiki An alternative would be to just include the: ``` 10 10 10 free $iflabel{ gpt } $reusemethod{ } method{ biosgrub } . ``` ...part on top of the recipes for sparc - if the assumption is correct that "$iflabel{ gpt }" line will only make this part effective on GPT partitioned disks. The patch to d-i/grub-installer follows. Cheers, Frank --- debian/changelog | 7 ++ recipes-sparc-sun4u_gpt| 1 + recipes-sparc-sun4v_gpt| 1 + recipes-sparc64-sun4u_gpt/_numbers | 3 +++ recipes-sparc64-sun4u_gpt/atomic | 26 +++ recipes-sparc64-sun4u_gpt/home | 35 ++ recipes-sparc64-sun4u_gpt/multi| 51 ++ recipes-sparc64-sun4v_gpt | 1 + 8 files changed, 125 insertions(+) create mode 12 recipes-sparc-sun4u_gpt create mode 12 recipes-sparc-sun4v_gpt create mode 100644 recipes-sparc64-sun4u_gpt/_numbers create mode 100644 recipes-sparc64-sun4u_gpt/atomic create mode 100644 recipes-sparc64-sun4u_gpt/home create mode 100644 recipes-sparc64-sun4u_gpt/multi create mode 12 recipes-sparc64-sun4v_gpt diff --git a/debian/changelog b/debian/changelog index c5d2208..0ea969f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +partman-auto (145) UNRELEASED; urgency=medium + + [ Frank Scheiner ] + * Add specific recipes for GPT partitioning on sparc/sparc64. + + -- Frank Scheiner Mon, 05 Mar 2018 19:39:43 +0100 + partman-auto (144) unstable; urgency=medium [ Updated translations ] diff --git a/recipes-sparc-sun4u_gpt b/recipes-sparc-sun4u_gpt new file mode 12 index 000..ed2fff1 --- /dev/null +++ b/recipes-sparc-sun4u_gpt @@ -0,0 +1 @@ +recipes-sparc64-sun4v_gpt \ No newline at end of file diff --git a/recipes-sparc-sun4v_gpt b/recipes-sparc-sun4v_gpt new file mode 12 index 000..ed2fff1 --- /dev/null +++ b/recipes-sparc-sun4v_gpt @@ -0,0 +1 @@ +recipes-sparc64-sun4v_gpt \ No newline at end of file diff --git a/recipes-sparc64-sun4u_gpt/_numbers b/recipes-sparc64-sun4u_gpt/_numbers new file mode 100644 index 000..341b03f --- /dev/null +++ b/recipes-sparc64-sun4u_gpt/_numbers @@ -0,0 +1,3 @@ +30 atomic +50 home +80 multi diff --git a/recipes-sparc64-sun4u_gpt/atomic b/recipes-sparc64-sun4u_gpt/atomic new file mode 100644 index 000..84563a4 --- /dev/null +++ b/recipes-sparc64-sun4u_gpt/atomic @@ -0,0 +1,26 @@ +partman-auto/text/atomic_scheme :: + +10 10 10 free + $iflabel{ gpt } + $reusemethod{ } + method{ biosgrub } . + +50 500 100 ext2 + method{ format } + format{ } + use_filesystem{ } + filesystem{ ext2 } + mountpoint{ /boot } . + +800 1 -1 $default_filesystem + $lvmok{ } + method{ format } + format{ } + use_filesystem{ } + $default_filesystem{ } + mountpoint{ / } . + +100% 512 300% linux-swap + $lvmok{ } + method{ swap } + format{ } . diff --git a/recipes-sparc64-sun4u_gpt/home b/recipes-sparc64-sun4u_gpt/home new file mode 100644 index 000..7cca0b2 --- /dev/null +++ b/recipes-sparc64-sun4u_gpt/home @@ -0,0 +1,35 @@ +partman-auto/text/home_scheme :: + +10 10 10 free + $iflabel{ gpt } + $reusemethod{ } + method{ biosgrub } . + +50 500 100 ext2 + method{ format } + format{ } + use_filesystem{ } + filesystem{ ext2 } + mountpoint{ /boot } . + +1500 6000 3 $default_filesystem + $lvmok{ } + method{ format } + format{ } + use_filesystem{ } + $default_filesystem{ } + mountpoint{ / } . + +100% 512 300% linux-swap + $lvmok{ } + method{ swap } + format{ } . + +1000 1 -1 $default_filesystem + $lvmok{ } + method{ format } + format{ } + use_filesystem{ } + $default_filesystem{ } + mountpoint{ /home } . + diff --git a/recipes-sparc64-sun4u_gpt/multi b/recipes-sparc64-sun4u_gpt/multi new file mode 100644 index 000..43cb060 --- /dev/null +++ b/recipes-sparc64-sun4u_gpt/multi @@ -0,0 +1,51 @@ +partman-auto/text/multi_scheme :: + +10 10 10 free + $iflabel{ gpt } + $reusemethod{ } + method{ biosgrub } . + +30 500 100 ext2 + method{ format } + format{ } + use_filesystem{ } + filesystem{ ext2 } + mountpoint{ /boot } . + +2000 3500 25000 $default_filesystem + $lvmok{ } +
Re: Re: GRUB testers on SPARC needed
On Mon, Mar 05, 2018 at 11:45:16AM +0100, John Paul Adrian Glaubitz wrote: > > At least with the stretch installer there is no problem with using a MBR > > partitioning > > on the am64 arch. You maybe can't select it, but if you generate a MBR > > partitioning using > > the shell inside the installer this will work. > > Ok, after a quick look it seems that this particular configuration is actually > supported by the grub-installer: > > > https://anonscm.debian.org/git/d-i/grub-installer.git/tree/grub-installer#n338 > > On EFI systems, it will test whether /var/lib/partman/ignore_uefi exists > which I > assume is written by partman if it finds an MBR partition table on an EFI > system. Thanks for this information. > > Also IMHO this (EFI partition on MBR) is usefull to work, as the server > > BIOSses here are all able > > to boot from an USB stick which usually have MBR partitioning. > > This is for installed systems, not for installer images. Yes, exactly: Booting the installed system via UEFI from usb stick. The netboot installer has no partitioning - so no issue with installer images, at least not in my case. > > As the servers used here all have an internal USB slot thats my favorite > > setup at the moments. > > Why not use a remote KVM? ;) Because netbooting rocks - or what are I'm missing ? ;-) Probably we are getting to OT now... Greetings Hermann -- Netzwerkadministration/Zentrale Dienste, Interdiziplinaeres Zentrum fuer wissenschaftliches Rechnen der Universitaet Heidelberg IWR; INF 205; 69120 Heidelberg; Tel: (06221)54-14405 Fax: -14427 Email: hermann.la...@iwr.uni-heidelberg.de
Re: Re: GRUB testers on SPARC needed
On Sat, Mar 03, 2018 at 01:09:40AM +0100, John Paul Adrian Glaubitz wrote: > On 03/02/2018 10:27 PM, Frank Scheiner wrote: > >> On x86, it will automatically use GPT if the machine is booted in EFI > >> mode. ... ... > >> I know you try to make the most compatible design to fit all use cases, > >> but I don’t think we should support such edge cases when debian-installer > >> doesn’t > >> support it on other platforms. ... > Maybe it's a good idea to perform some tests with such setups on x86 (e.g. > having MBR partitioning and then booting the machine in EFI mode and keeping > the MBR setup) and observe what debian-installer does. At least with the stretch installer there is no problem with using a MBR partitioning on the am64 arch. You maybe can't select it, but if you generate a MBR partitioning using the shell inside the installer this will work. Also IMHO this (EFI partition on MBR) is usefull to work, as the server BIOSses here are all able to boot from an USB stick which usually have MBR partitioning. As the servers used here all have an internal USB slot thats my favorite setup at the moments. Just 2cents and thank for all your work, greetings Hermann -- Netzwerkadministration/Zentrale Dienste, Interdiziplinaeres Zentrum fuer wissenschaftliches Rechnen der Universitaet Heidelberg IWR; INF 205; 69120 Heidelberg; Tel: (06221)54-14405 Fax: -14427 Email: hermann.la...@iwr.uni-heidelberg.de
Re: GRUB testers on SPARC needed
On 03/05/2018 11:32 AM, Hermann Lauer wrote: At least with the stretch installer there is no problem with using a MBR partitioning on the am64 arch. You maybe can't select it, but if you generate a MBR partitioning using the shell inside the installer this will work. Ok, after a quick look it seems that this particular configuration is actually supported by the grub-installer: https://anonscm.debian.org/git/d-i/grub-installer.git/tree/grub-installer#n338 On EFI systems, it will test whether /var/lib/partman/ignore_uefi exists which I assume is written by partman if it finds an MBR partition table on an EFI system. We can most certainly add support for that later on sparc*. I just want to get a simple GRUB installation on a clean system working and we're almost there regarding that. Also IMHO this (EFI partition on MBR) is usefull to work, as the server BIOSses here are all able to boot from an USB stick which usually have MBR partitioning. This is for installed systems, not for installer images. As the servers used here all have an internal USB slot thats my favorite setup at the moments. Why not use a remote KVM? ;) Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913