Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 901091 - sys-boot/grub - SIGILL : GRUB Illegal Instruction on sparc64
Summary: sys-boot/grub - SIGILL : GRUB Illegal Instruction on sparc64
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc64 Linux
: Normal blocker (vote)
Assignee: Sparc Porters
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-13 22:23 UTC by Dennis Clarke
Modified: 2023-04-03 17:11 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Clarke 2023-03-13 22:23:36 UTC
SUMMARY : 

After carefully following the Handbook instructions for installation
onto an old Sun Microsystems Netra sparcv9 server I was unable to boot.

Some details : 

I went through all the usual motions for the installation and even did
a full buildworld of everything "-e" just to see how things compile.

No problems there.

When the time came to emerge the GRUB boot loader I saw : 

chroot# grub-install --target=sparc64-ieee1275 --recheck --force --skip-fs-probe /dev/sda1 
Installing for sparc64-ieee1275 platform.
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
Installation finished. No error reported.
chroot# 

Looking in the /dev/sda1 filesystem for /boot I see : 

chroot# ls -lap /boot/grub
total 13
drwxr-xr-x 6 root root 1024 Mar 13 20:12 ./
drwxr-xr-x 4 root root 1024 Mar 13 20:12 ../
drwxr-xr-x 2 root root 1024 Mar 13 20:12 fonts/
-rw-r--r-- 1 root root 1024 Mar 13 20:12 grubenv
drwxr-xr-x 2 root root 1024 Mar 13 20:12 locale/
drwxr-xr-x 2 root root 7168 Mar 13 20:12 sparc64-ieee1275/
drwxr-xr-x 3 root root 1024 Mar 13 20:12 themes/

Next step was : 

chroot# grub-mkconfig -o /boot/grub/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.88-gentoo-sparc64
Found initrd image: /boot/initramfs-5.15.88-gentoo-sparc64.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done


That results in a grub.cfg with defaults : 

chroot# ls -lap /boot/grub
total 19
drwxr-xr-x 6 root root 1024 Mar 13 20:13 ./
drwxr-xr-x 4 root root 1024 Mar 13 20:12 ../
drwxr-xr-x 2 root root 1024 Mar 13 20:12 fonts/
-rw------- 1 root root 5487 Mar 13 20:13 grub.cfg
-rw-r--r-- 1 root root 1024 Mar 13 20:12 grubenv
drwxr-xr-x 2 root root 1024 Mar 13 20:12 locale/
drwxr-xr-x 2 root root 7168 Mar 13 20:12 sparc64-ieee1275/
drwxr-xr-x 3 root root 1024 Mar 13 20:12 themes/
chroot# 


I did a backup of that grub.cfg and made very slight changes
such that timeout was 60 secs in order to give me some time
if I wanted to add anything to the kernel command line. 

I did add in "console=ttyS0,9600 verbose net.ifnames=0" to the
kernel command line in the grub.cfg and nothing else.

reboot was a fail due to SIGILL : GRUB Illegal Instruction

Nothing else is seen other than the firmware "ok" prompt.


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional
Comment 1 Dennis Clarke 2023-03-16 01:30:19 UTC
A few basic details : 

sphinx# uname -a 
Linux sphinx 5.15.88-gentoo-sparc64 #1 Sun Mar 12 18:36:19 GMT 2023 sparc64 sun4u TI UltraSparc IIi (Sabre) GNU/Linux
sphinx# 

sphinx# cat /proc/cpuinfo 
cpu             : TI UltraSparc IIi (Sabre)
fpu             : UltraSparc IIi integrated FPU
pmu             : ultra12
prom            : OBP 3.10.27 2000/06/22 16:45
type            : sun4u
ncpus probed    : 1
ncpus active    : 1
D$ parity tl1   : 0
I$ parity tl1   : 0
Cpu0ClkTck      : 000000001a3a1f5e
cpucaps         : flush,stbar,swap,muldiv,v9,mul32,div32,v8plus,vis
MMU Type        : Spitfire
MMU PGSZs       : 8K,64K,512K,4MB
sphinx# 
sphinx# qlist -IRv | grep 'grub'
sys-boot/grub-2.06-r4::gentoo

This machine is ye olde Sun Netra T1-105 that was internally named the
"flapjack" unit. It is 1U and very low power consumption with dual
internal SCSI3 disks as well as a maximum of 1G of ECC memory. It has an
external SCSI3 connector at the rear as well as dual 100Mbit hme "happy
meal" RJ45 ethernet ports. There is also a single PCI slot available.
There are two serial ports at the rear which we simply call tty0 and 
tty1. The tty0 is by default the serial console to the "lom" Lights Out
Management software and the unit does do a fairly detailed hardware POST
process and then will provide the classic "ok" prompt.  One may easily
adjust the firmware variables as well as traverse the entire device tree
information.

I will try to document the crazy hackary I had to go through in order to
get a bootable machine. I strongly suggest that this process is not to
be considered reasonable. Getting this to work at all took some very
silly Monty Python like gymnastics.

Firstly I am certain that the GRUB2 install process is quite broken on
this architecture and likely the fix will be annoying to even begin. I
therefore took the approach where I used a Debian-ports sparc64 netinst
image to boot the sparc64 Sun Netra machine I am experimenting with. It
is not exactly a perfect process but the Debian sparc64 port does indeed
install GRUB2 it works. What I find curious is the the GRUB2 boot loader
in the Gentoo ISO9660 installation image works just fine.

In order to protect the work done within the Gentoo installation process
I removed all SCSI disks from the machine and then attached an external
Sun SCSI diskpack unit set to SCSI id 6.  The old Sun firmware on this
machine will generally consider SCSI id 6 to be a CDROM device and for
the sake of historical muttering the SCSI id 4 is usually a tape drive.
All of that stuff can be seen in the Sun firmware with the forth command
thus : 

    ok devalias

One may simply type "boot cdrom" and the SCSI id6 device will be a CDROM
for all intents and purposes. That allows me to install the Debian port
onto one of the internal SCSI disks.  I did precisely that and only a
very minimal Debian install was done. The GRUB2 boot loader that ended
up being installed worked just fine and dandy. At this point I place
the Debian bootable disk into SCSI slot 1 ( SCSI id 1 ) and the Gentoo
disk into SCSI slot 0.

Here is where things get silly.

The Debian install process results in a workable GRUB2 bootloader that
targets the file systems and Linux kernel from within the Debian disk :

setparams 'Debian GNU/Linux, with Linux 6.0.0-5-sparc64 (recovery mode)'

    load_video
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_sun
    insmod ext2
    set root='hd0,sun1'
    if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//pci@1f\,0/pci@1\,1/scsi@2/disk@0\,0,sun1' --hint-bios=hd0,sun1 --hint-efi=hd0,sun1 --hint-baremetal=ahci0,sun1  171ef9bc-83cc-47c2-90ae-b15f61d05424
    else
        search --no-floppy --fs-uuid --set=root 171ef9bc-83cc-47c2-90ae-b15f61d05424
    fi
    echo        'Loading Linux 6.0.0-5-sparc64 ...'
    linux        /vmlinux-6.0.0-5-sparc64 root=UUID=d3ac9fca-e995-4d12-8a2b-e66b5d7fdfdf ro verbose net.ifnames=0
    echo        'Loading initial ramdisk ...'
    initrd        /initrd.img-6.0.0-5-sparc64


The device path listed above is correct for the disk in slot 0 of the
machine and that is perfect. However the UUID data and the Linux kernel
versions do not match. Trying to deal with a hex editor and mangling at
the Debian GRUB2 boot loader seemed the wrong way to go here. Therefore
I wrecked havoc with the Gentoo filesystem UUID's as well as some hack
symlinks in the /dev/sda1 "/boot" file system : 

    * * *  D A T A    F O R    D E B I A N   D I S K  * * *
# blkid | grep 'sda'
/dev/sda4: LABEL="root" UUID="d3ac9fca-e995-4d12-8a2b-e66b5d7fdfdf" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="089fb0b4-9493-4327-b505-a2462de07fa8" TYPE="swap"
/dev/sda3: LABEL="boot" UUID="171ef9bc-83cc-47c2-90ae-b15f61d05424" BLOCK_SIZE="4096" TYPE="ext2" PTTYPE="sun"
/dev/sda1: LABEL="boot" UUID="171ef9bc-83cc-47c2-90ae-b15f61d05424" BLOCK_SIZE="4096" TYPE="ext2" PTTYPE="sun"
# 

The above UUID numbers perfectly match the Debian GRUB2 data.

    * * *  D A T A    F O R    G E N T O O    D I S K  * * *
/dev/sda4: UUID="fe6f0b82-d9fa-48b2-be07-d0f59a3bb2d9" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="4f46eb82-7723-4368-bfa7-38fa70467aec" TYPE="swap"
/dev/sda1: UUID="8256ea80-3c0b-45f2-a797-065efa5f8c65" BLOCK_SIZE="1024" TYPE="ext4"
/dev/sda3: PTTYPE="sun"

At this point I perform a fsck on all the reasonable file systems and
then modify the UUID numbers for the Gentoo disk ( note prompt "cdrom" ): 

cdrom# e2fsck -f /dev/sda4
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda4: 440279/16331272 files (0.5% non-contiguous), 4566353/16330072 blocks

cdrom# e2fsck -f /dev/sda1
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda1: 311/524288 files (1.3% non-contiguous), 176575/2097152 blocks
cdrom# 

    * * *    M O D I F Y    T H E    B O O T   U U I D    * * *
cdrom# blkid | grep 'sda1'
/dev/sda1: UUID="8256ea80-3c0b-45f2-a797-065efa5f8c65" BLOCK_SIZE="1024" TYPE="ext4"
cdrom# 
cdrom# tune2fs /dev/sda1 -U 171ef9bc-83cc-47c2-90ae-b15f61d05424
tune2fs 1.46.5 (30-Dec-2021)
Setting the UUID on this filesystem could take some time.
Proceed anyway (or wait 5 seconds to proceed) ? (y,N) y
cdrom# 
cdrom# blkid | grep 'sda1'
/dev/sda1: UUID="171ef9bc-83cc-47c2-90ae-b15f61d05424" BLOCK_SIZE="1024" TYPE="ext4"
cdrom# 

    * * *    M O D I F Y    T H E    R O O T   U U I D    * * *
cdrom# blkid | grep 'sda4'
/dev/sda4: UUID="fe6f0b82-d9fa-48b2-be07-d0f59a3bb2d9" BLOCK_SIZE="4096" TYPE="ext4"
cdrom# 
cdrom# tune2fs /dev/sda4 -U d3ac9fca-e995-4d12-8a2b-e66b5d7fdfdf
tune2fs 1.46.5 (30-Dec-2021)
Setting the UUID on this filesystem could take some time.
Proceed anyway (or wait 5 seconds to proceed) ? (y,N) y
cdrom# blkid | grep 'sda4'
/dev/sda4: UUID="d3ac9fca-e995-4d12-8a2b-e66b5d7fdfdf" BLOCK_SIZE="4096" TYPE="ext4"
cdrom# 

   * * *    W R E C K    T H E    D E B I A N    D A T A    * * *
# tune2fs /dev/sdb1 -U deadbeef-0000-dead-beef-badcaffee000
tune2fs 1.46.5 (30-Dec-2021)
# tune2fs /dev/sdb4 -U feeddead-beef-0000-dead-badcaffee001
tune2fs 1.46.5 (30-Dec-2021)
Setting the UUID on this filesystem could take some time.
Proceed anyway (or wait 5 seconds to proceed) ? (y,N) y
# 

    * * *    H A C K    S Y M L I N K S    I N    B O O T    * * *
sphinx# ls -l /boot 
total 12736
-rw-r--r-- 1 root root 2235708 Mar 12 23:51 System.map-5.15.88-gentoo-sparc64
drwxr-xr-x 6 root root    1024 Mar 13 20:46 grub
-rw-r--r-- 1 root root 4311788 Mar 13 09:48 initramfs-5.15.88-gentoo-sparc64.img
lrwxrwxrwx 1 root root      36 Mar 15 01:36 initrd.img-6.0.0-5-sparc64 -> initramfs-5.15.88-gentoo-sparc64.img
drwx------ 2 root root   12288 Feb 25 16:32 lost+found
lrwxrwxrwx 1 root root      30 Mar 15 01:37 vmlinux-6.0.0-5-sparc64 -> vmlinuz-5.15.88-gentoo-sparc64
-rwxr-xr-x 1 root root 7634448 Mar 12 23:55 vmlinuz-5.15.88-gentoo-sparc64
sphinx# 

At this point the boot loader on the Debian disk will target the file
systems on the Gentoo disk and load the kernel compiled by the Gentoo
install process.

Suffice it to say that this works. The boot process is somewhat of a
hack and to be fair it seems confused about floppy devices and even
seems to search for a IDE cdrom that does not exist. Regardless the
correct filesystems are found and the Gentoo machine boots. A small
surprise was that the /boot filesystem does not get mounted even when
the correct UUID data exists in /etc/fstab : 

sphinx# grep -v '^#' /etc/fstab | grep -v '^$' 
UUID=171ef9bc-83cc-47c2-90ae-b15f61d05424       /boot   ext4    noauto,noatime 12
UUID=4f46eb82-7723-4368-bfa7-38fa70467aec       none    swap    sw      0      0
UUID=d3ac9fca-e995-4d12-8a2b-e66b5d7fdfdf       /       ext4    strictatime,errors=remount-ro   0       1
sphinx# 

A better procedure is certainly needed. 


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional
Comment 2 Mike Gilbert gentoo-dev 2023-03-16 18:25:12 UTC
Please provide emerge --info.
Comment 3 Dennis Clarke 2023-03-17 03:44:07 UTC
Does this help ? 

sphinx# 
sphinx# uname -a 
Linux sphinx 5.15.88-gentoo-sparc64 #1 Sun Mar 12 18:36:19 GMT 2023 sparc64 sun4u TI UltraSparc IIi (Sabre) GNU/Linux
sphinx# 
sphinx# emerge --info
Portage 3.0.44 (python 3.10.9-final-0, default/linux/sparc/17.0/64ul, gcc-12, glibc-2.36-r5, 5.15.88-gentoo-sparc64 sparc64)
=================================================================
System uname: Linux-5.15.88-gentoo-sparc64-sparc64-sun4u-with-glibc2.36
KiB Mem:     1029352 total,    265264 free
KiB Swap:    4194296 total,   4185784 free
Timestamp of repository gentoo: Sat, 04 Mar 2023 05:30:01 +0000
Head commit of repository gentoo: 163534fad9403927e25a55c5473a06a118ce0087
sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.39 p5) 2.39.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-lang/perl:             5.36.0-r1::gentoo
dev-lang/python:           3.10.9-r1::gentoo, 3.11.2_p1::gentoo
dev-util/meson:            1.0.0::gentoo
sys-apps/baselayout:       2.9::gentoo
sys-apps/openrc:           0.45.2-r2::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             12.2.1_p20230121-r1::gentoo
sys-devel/gcc-config:      2.8::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24

ACCEPT_KEYWORDS="sparc"
ACCEPT_LICENSE="* -@EULA"
CBUILD="sparc64-unknown-linux-gnu"
CFLAGS="-m64 -g -O0 -mno-app-regs -mcpu=ultrasparc -mtune=ultrasparc -mno-vis"
CHOST="sparc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-m64 -g -O0 -mno-app-regs -mcpu=ultrasparc -mtune=ultrasparc -mno-vis"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-m64 -g -O0 -mno-app-regs -mcpu=ultrasparc -mtune=ultrasparc -mno-vis"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news nostrip parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-m64 -g -O0 -mno-app-regs -mcpu=ultrasparc -mtune=ultrasparc -mno-vis"
GENTOO_MIRRORS="https://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--no-keep-memory"
LEX="flex"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl big-endian bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc llvm-libunwind ncurses nls nptl openmp pam pcre readline sparc split-usr ssl test-rust unicode xattr zlib" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="ieee1275" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="fbdev mga r128 radeon dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

sphinx#
Comment 4 Dennis Clarke 2023-03-20 20:28:07 UTC
As a further experiment with this Frankensteein Debian-Gentoo bootable
disk idea I removed the disks from the system and once again booted the
Debian netinst image.  Then did a very baseline minimal install to a
disk in SCSI slot 0 and that resulted in a working GRUB2 on that disk.

The firmware says : 

     Unit 0   Disk     FUJITSU MAX3147NCSUN146G1503

That has an ext2 '/boot' and also an ext4 filesystem for root.

Then I shutdown the system to the firmware prompt and perform a typical
"reset-all".  I once again put the bootable Gentoo SPARC64 install iso
image into an external SCSI disk pack with SCSI id 6.  This allows me to
boot the Gentoo installer image and get a nice shell prompt and then I
can mount the filesystems from both the Debian install target and the
Gentoo target disk.

The trivial steps I then take are to just copy over the vmlinuz and the
initramfs files from the Gentoo "/boot" filesystem onto the Debian disk
and drop them right into "/boot" for the Debian disk.

Then edit the /boot/grub/grub.cfg file such that we target only the
Gentoo files for the initramfs stage. Once again I may need to hack the
filesystem UUID data.

menuentry 'Gentoo Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-05a368b5-c75a-4208-8221-e5431f5708b5' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_sun
        insmod ext2
        set root='hd0,sun1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//pci@1f\,0/pci@1\,1/scsi@2/disk@0\,0,sun1' --hint-bios=hd0,sun1 --hint-efi=hd0,sun1 --hint-baremetal=ahci0,sun1  350972a0-ecc0-427e-9867-641d2f35a6b1
        else
          search --no-floppy --fs-uuid --set=root 350972a0-ecc0-427e-9867-641d2f35a6b1
        fi
        echo    'Gentoo Linux 5.15.88 ...'
        linux   /vmlinuz-5.15.88-gentoo-sparc64 root=UUID=05a368b5-c75a-4208-8221-e5431f5708b5 ro verbose net.ifnames=0
        echo    'Gentoo initrd ...'
        initrd  /initramfs-5.15.88-gentoo-sparc64.img
}

After the shutdown and reset-all I can then boot disk0 and see : 


                            GNU GRUB  version 2.06-7

 +----------------------------------------------------------------------------+
 |*Gentoo Linux                                                               | 
 | Advanced options for Debian GNU/Linux                                      |

Sure enough the Gentoo Linux menu is the one I hacked.

Just hit enter and smile :

Gentoo Linux 5.15.88 ...
Gentoo initrd ...

PROMLIB: Sun IEEE Boot Prom 'OBP 3.10.27 2000/06/22 16:45'
PROMLIB: Root node compatible: sun4u
Linux version 5.15.88-gentoo-sparc64 (root@(none)) (sparc64-unknown-linux-gnu-gcc (Gentoo 12.2.1_p20230121-r1 p10) 12.2.1 20230121, GNU ld (Gentoo 2.39 p5) 2.39.0) #1 Sun Mar 12 18:36:19 GMT 2023
printk: bootconsole [earlyprom0] enabled
ARCH: SUN4U
Ethernet address: 08:00:20:c2:46:48
MM: PAGE_OFFSET is 0xfffff80000000000 (max_phys_bits == 40)
MM: VMALLOC [0x0000000100000000 --> 0x0000060000000000]
MM: VMEMMAP [0x0000060000000000 --> 0x00000c0000000000]
Kernel: Using 2 locked TLB entries for main kernel image.
Remapping the kernel... 
done.
OF stdout device is: /pci@1f,0/pci@1,1/ebus@1/su@14,3803f8
PROM: Built device tree with 93180 bytes of memory.
Top of RAM: 0x3fec2000, Total RAM: 0x3febc000
Memory hole size: 0MB
Allocated 16384 bytes for kernel page tables.
Zone ranges:
  Normal   [mem 0x0000000000000000-0x000000003fec1fff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000000000-0x000000003fdfdfff]
  node   0: [mem 0x000000003fe00000-0x000000003fea5fff]
  node   0: [mem 0x000000003feaa000-0x000000003fec1fff]
Initmem setup node 0 [mem 0x0000000000000000-0x000000003fec1fff]
On node 0, zone Normal: 1 pages in unavailable ranges
On node 0, zone Normal: 2 pages in unavailable ranges
On node 0, zone Normal: 159 pages in unavailable ranges
Booting Linux...
CPU CAPS: [flush,stbar,swap,muldiv,v9,mul32,div32,v8plus]
CPU CAPS: [vis]
Built 1 zonelists, mobility grouping on.  Total pages: 129887
Kernel command line: BOOT_IMAGE=/vmlinuz-5.15.88-gentoo-sparc64 root=UUID=05a368b5-c75a-4208-8221-e5431f5708b5 ro verbose net.ifnames=0
Unknown kernel command line parameters "verbose BOOT_IMAGE=/vmlinuz-5.15.88-gentoo-sparc64", will be passed to user space.
Dentry cache hash table entries: 131072 (order: 7, 1048576 bytes, linear)
Inode-cache hash table entries: 65536 (order: 6, 524288 bytes, linear)
Sorting __ex_table...
mem auto-init: stack:all(zero), heap alloc:off, heap free:off
Memory: 1025032K/1047280K available (4599K kernel code, 1167K rwdata, 1432K rodata, 216K init, 407K bss, 22248K reserved, 0K cma-reserved)
NR_IRQS: 2048, nr_irqs: 2048, preallocated irqs: 1
clocksource: tick: mask: 0xffffffffffffffff max_cycles: 0x657b3e3225, max_idle_ns: 440795205870 ns
clocksource: mult[245cbac] shift[24]
clockevent: mult[70a4f590] shift[32]
Console: colour dummy device 80x25
printk: console [tty0] enabled
printk: bootconsole [earlyprom0] disabled
PROMLIB: Sun IEEE Boot Prom 'OBP 3.10.27 2000/06/22 16:45'
PROMLIB: Root node compatible: sun4u
Linux version 5.15.88-gentoo-sparc64 (root@(none)) (sparc64-unknown-linux-gnu-gcc (Gentoo 12.2.1_p20230121-r1 p10) 12.2.1 20230121, GNU ld (Gentoo 2.39 p5) 2.39.0) #1 Sun Mar 12 18:36:19 GMT 2023
printk: bootconsole [earlyprom0] enabled
ARCH: SUN4U
Ethernet address: 08:00:20:c2:46:48
MM: PAGE_OFFSET is 0xfffff80000000000 (max_phys_bits == 40)
MM: VMALLOC [0x0000000100000000 --> 0x0000060000000000]
MM: VMEMMAP [0x0000060000000000 --> 0x00000c0000000000]
Kernel: Using 2 locked TLB entries for main kernel image.
Remapping the kernel... 
done.
OF stdout device is: /pci@1f,0/pci@1,1/ebus@1/su@14,3803f8
PROM: Built device tree with 93180 bytes of memory.
Top of RAM: 0x3fec2000, Total RAM: 0x3febc000
Memory hole size: 0MB
Allocated 16384 bytes for kernel page tables.
Zone ranges:
  Normal   [mem 0x0000000000000000-0x000000003fec1fff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000000000-0x000000003fdfdfff]
  node   0: [mem 0x000000003fe00000-0x000000003fea5fff]
  node   0: [mem 0x000000003feaa000-0x000000003fec1fff]
Initmem setup node 0 [mem 0x0000000000000000-0x000000003fec1fff]
On node 0, zone Normal: 1 pages in unavailable ranges
On node 0, zone Normal: 2 pages in unavailable ranges
On node 0, zone Normal: 159 pages in unavailable ranges
Booting Linux...
CPU CAPS: [flush,stbar,swap,muldiv,v9,mul32,div32,v8plus]
CPU CAPS: [vis]
Built 1 zonelists, mobility grouping on.  Total pages: 129887
Kernel command line: BOOT_IMAGE=/vmlinuz-5.15.88-gentoo-sparc64 root=UUID=05a368b5-c75a-4208-8221-e5431f5708b5 ro verbose net.ifnames=0
Unknown kernel command line parameters "verbose BOOT_IMAGE=/vmlinuz-5.15.88-gentoo-sparc64", will be passed to user space.
Dentry cache hash table entries: 131072 (order: 7, 1048576 bytes, linear)
Inode-cache hash table entries: 65536 (order: 6, 524288 bytes, linear)
Sorting __ex_table...
mem auto-init: stack:all(zero), heap alloc:off, heap free:off
Memory: 1025032K/1047280K available (4599K kernel code, 1167K rwdata, 1432K rodata, 216K init, 407K bss, 22248K reserved, 0K cma-reserved)
NR_IRQS: 2048, nr_irqs: 2048, preallocated irqs: 1
clocksource: tick: mask: 0xffffffffffffffff max_cycles: 0x657b3e3225, max_idle_ns: 440795205870 ns
clocksource: mult[245cbac] shift[24]
clockevent: mult[70a4f590] shift[32]
Console: colour dummy device 80x25
printk: console [tty0] enabled
printk: bootconsole [earlyprom0] disabled
Calibrating delay using timer specific routine.. 885.70 BogoMIPS (lpj=442852)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 16384 bytes, linear)
Mountpoint-cache hash table entries: 2048 (order: 1, 16384 bytes, linear)
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
futex hash table entries: 256 (order: -1, 6144 bytes, linear)
NET: Registered PF_NETLINK/PF_ROUTE protocol family
IRQ pre handler NOT supported.
audit: initializing netlink subsys (disabled)
pci@1f,0: PCI IO [io  0x1fe02000000-0x1fe02ffffff] offset 1fe02000000
pci@1f,0: PCI MEM [mem 0x1ff00000000-0x1ffffffffff] offset 1ff00000000
pci@1f,0: SABRE PCI Bus Module ver[0:0]
PCI: Scanning PBM /pci@1f,0
sabre f00694e0: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io  0x1fe02000000-0x1fe02ffffff] (bus address [0x0000-0xffffff])
pci_bus 0000:00: root bus resource [mem 0x1ff00000000-0x1ffffffffff] (bus address [0x00000000-0xffffffff])
pci_bus 0000:00: root bus resource [bus 00-03]
pci 0000:00:01.1: [108e:5000] type 01 class 0x060400
pci_bus 0000:01: extended config space not accessible
pci 0000:01:01.0: [108e:1000] type 00 class 0x068000
pci 0000:01:01.1: [108e:1001] type 00 class 0x020000
pci 0000:01:01.1: reg 0x10: [mem 0x1ffe0000000-0x1ffe000701f]
pci 0000:01:02.0: [1000:000f] type 00 class 0x010000
pci 0000:01:02.0: reg 0x10: [io  0x1fe02c00000-0x1fe02c000ff]
pci 0000:01:02.0: reg 0x14: [mem 0x1ffe0008000-0x1ffe00080ff]
pci 0000:01:02.0: reg 0x18: [mem 0x1ffe000a000-0x1ffe000afff]
pci 0000:01:03.1: [108e:1001] type 00 class 0x020000
pci 0000:01:03.1: reg 0x10: [mem 0x1ffe0010000-0x1ffe001701f]
pci 0000:00:01.0: [108e:5000] type 01 class 0x060400
pci_bus 0000:02: extended config space not accessible
pci 0000:02:01.0: [1011:0022] type 01 class 0x060400
pci_bus 0000:03: extended config space not accessible
pci 0000:02:01.0: PCI bridge to [bus 03]
pci 0000:02:01.0:   bridge window [io  0x1fe02001000-0x1fe02001fff]
pci 0000:03:0e.0: [1095:0646] type 00 class 0x01018f
pci 0000:03:0e.0: reg 0x10: [io  0x1fe02001000-0x1fe02001007]
pci 0000:03:0e.0: reg 0x14: [io  0x1fe02001008-0x1fe0200100b]
pci 0000:03:0e.0: reg 0x18: [io  0x1fe02001010-0x1fe02001017]
pci 0000:03:0e.0: reg 0x1c: [io  0x1fe02001018-0x1fe0200101b]
pci 0000:03:0e.0: reg 0x20: [io  0x1fe02001020-0x1fe0200102f]
audit: type=2000 audit(0.087:1): state=initialized audit_enabled=0 res=1
HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
HugeTLB registered 8.00 MiB page size, pre-allocated 0 pages
HugeTLB registered 256 MiB page size, pre-allocated 0 pages
HugeTLB registered 2.00 GiB page size, pre-allocated 0 pages
vgaarb: loaded
SCSI subsystem initialized
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
/pci@1f,0/pci@1,1/ebus@1/eeprom@14,0: Mostek regs at 0x1fff1000000
AUXIO: Found device at /pci@1f,0/pci@1,1/ebus@1/auxio@14,726000
clocksource: Switched to clocksource tick
NET: Registered PF_INET protocol family
IP idents hash table entries: 16384 (order: 4, 131072 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 8192 bytes, linear)
Table-perturb hash table entries: 65536 (order: 5, 262144 bytes, linear)
TCP established hash table entries: 8192 (order: 3, 65536 bytes, linear)
TCP bind hash table entries: 8192 (order: 3, 65536 bytes, linear)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 1, 16384 bytes, linear)
UDP-Lite hash table entries: 512 (order: 1, 16384 bytes, linear)
NET: Registered PF_UNIX/PF_LOCAL protocol family
PCI: CLS 64 bytes, default 64
power: Control reg at 1fff1724000
Trying to unpack rootfs image as initramfs...
workingset: timestamp_bits=62 max_order=17 bucket_order=0
squashfs: version 4.0 (2009/01/31) Phillip Lougher
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
io scheduler mq-deadline registered
io scheduler kyber registered
f006b9fc: ttyS0 at MMIO 0x1fff13803f8 (irq = 5, base_baud = 115387) is a 16550A
Console: ttyS0 (SU)
Freeing initrd memory: 4208K
printk: console [ttyS0] enabled
f006d240: ttyS1 at MMIO 0x1fff13602f8 (irq = 6, base_baud = 115387) is a 16550A
brd: module loaded
loop: module loaded
sym53c8xx 0000:01:02.0: enabling device (0146 -> 0147)
sym0: <875> rev 0x3 at pci 0000:01:02.0 irq 13
sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3
megasas: 07.717.02.00-rc1
Fusion MPT base driver 3.04.20
Copyright (c) 1999-2008 LSI Corporation
Fusion MPT SPI Host driver 3.04.20
Fusion MPT FC Host driver 3.04.20
Fusion MPT SAS Host driver 3.04.20
Fusion MPT misc device (ioctl) driver 3.04.20
mptctl: Registered with Fusion MPT base driver
mptctl: /dev/mptctl @ (major,minor=10,220)
mousedev: PS/2 mouse device common for all mice
rtc-m48t59 rtc-m48t59.0: registered as rtc0
rtc-m48t59 rtc-m48t59.0: hctosys: unable to read the hardware clock
NET: Registered PF_PACKET protocol family
scsi 0:0:0:0: Direct-Access     FUJITSU  MAX3147NCSUN146G 1503 PQ: 0 ANSI: 4
scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
scsi target0:0:0: Beginning Domain Validation
scsi target0:0:0: FAST-20 WIDE SCSI 40.0 MB/s ST (50 ns, offset 16)
scsi target0:0:0: Domain Validation skipping write tests
scsi target0:0:0: Ending Domain Validation
scsi 0:0:6:0: Direct-Access     SEAGATE  ST336704LSUN36G  032C PQ: 0 ANSI: 3
scsi target0:0:6: tagged command queuing enabled, command queue depth 16.
scsi target0:0:6: Beginning Domain Validation
scsi target0:0:6: FAST-20 WIDE SCSI 40.0 MB/s ST (50 ns, offset 16)
scsi target0:0:6: Domain Validation skipping write tests
scsi target0:0:6: Ending Domain Validation
sd 0:0:0:0: Power-on or device reset occurred
sd 0:0:6:0: Power-on or device reset occurred
sd 0:0:6:0: [sdb] 71132959 512-byte logical blocks: (36.4 GB/33.9 GiB)
sd 0:0:0:0: [sda] 286739329 512-byte logical blocks: (147 GB/137 GiB)
sd 0:0:6:0: [sdb] Write Protect is off
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:6:0: [sdb] Write cache: disabled, read cache: enabled, supports DPO and FUA
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 sda4
 sdb: sdb1
sd 0:0:0:0: [sda] Attached SCSI disk
sd 0:0:6:0: [sdb] Attached SCSI disk
This architecture does not have kernel memory protection.
Run /init as init process
>> Genkernel 4.2.6 (2023-03-13 05:52:31 UTC). Linux kernel 5.15.88-gentoo-sparc64 
>> Activating udev ... 
>> Determining root device (trying UUID=05a368b5-c75a-4208-8221-e5431f5708b5) ...
>> Root device detected as /dev/sda4! 
>> Mounting /dev/sda4 as root ... 
>> Using mount -t ext4 -o ro /dev/sda4 /newroot 
>> Restoring console log level (7) ... 
>>      NIT: version 3.05 booting

   OpenRC 0.45.2 is starting up Gentoo Linux (sparc64)

 * /proc is already mounted

etc etc etc ...

I have to call this a Frankenboot hack but it works.

OH, also, the NVRAM battery is dead so it thinks we are in 1970. :)


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional







123456789+123456789+123456789+123456789+123456789+123456789+123456789+12
Comment 5 Mike Gilbert gentoo-dev 2023-03-20 20:36:55 UTC
I'm sorry, but none of the information you have provided thus far helps to identify a bug in Gentoo's GRUB package.

I would suggest you seek support in Gentoo support channels, and return to this bug report if you can narrow down the parameters a bit.
Comment 6 Dennis Clarke 2023-03-20 20:47:03 UTC
(In reply to Mike Gilbert from comment #5)
> I'm sorry, but none of the information you have provided thus far helps to
> identify a bug in Gentoo's GRUB package.
> 
> I would suggest you seek support in Gentoo support channels, and return to
> this bug report if you can narrow down the parameters a bit.

Well quite clearly it does not work.
Comment 7 Mike Gilbert gentoo-dev 2023-03-20 21:07:10 UTC
(In reply to Dennis Clarke from comment #6)
> Well quite clearly it does not work.

I believe that may be due to operator error, but I can't easily tell because of the wall of text you have posted in this bug report.

I would be happy to help you troubleshoot the issue in IRC, but posting more irrelevant information to this bug is not helpful.
Comment 8 Mike Gilbert gentoo-dev 2023-03-21 03:05:43 UTC
Looking at the grub-install command you ran, I am suspicious of the "--skip-fs-probe" option. I see that appears in the handbook, but that doesn't mean it's correct. It seems like a hacky workaround for a problem that somebody ran into and never fixed properly.

Also, is there some reason you cannot use GPT? I believe that is known to work more reliably than embedding grub into the middle of a filesystem.
Comment 9 Dennis Clarke 2023-04-03 16:37:24 UTC
I think it may be time to close this bug report as "works as intended" 
if the user follows the instructions in the Handbook carefully.

Firstly the idea of a GPT table will not work on any hardware made back
before the darkness of Oracle : 

https://wiki.gentoo.org/wiki/Handbook:SPARC/Installation/Disks#Partition_tables

Moving along we need to look closely at :

https://wiki.gentoo.org/wiki/Handbook:SPARC/Installation/Disks#Sun_formatted_partition_scheme

Here we are going to use the old Sun vtoc disk concepts for SPARC. To be
fair the Sun vtoc ( volume table of contents ) uses a four bit offset
into a table of a possible 16 entries. The entire 16 entry table is able
to be seen on Solaris systems that run x86_64 architecture. It is a very
strange mystery that this is not true for SPARC. However the table does
exist and one may create a Sun type partition vtoc on any old Sun SPARC
server and use the table entries from 0 upwards to 7.

Here is the manpage from 1997 on Solaris 8 SPARC : 

$ man prtvtoc
Reformatting page.  Please Wait... done

Maintenance Commands                                  prtvtoc(1M)

NAME
     prtvtoc - report information about a disk geometry and  par-
     titioning

SYNOPSIS
     prtvtoc [ -fhs ]  [ -t vfstab ]  [ -m mnttab ]  device

DESCRIPTION
     The prtvtoc command allows the contents of the VTOC  (volume
     table  of  contents)  to  be viewed. The command can be used
     only by the super-user.

     The device name can be the file name of a raw device in  the
     form  of  /dev/rdsk/c?t?d?s2  or  can  be the file name of a
     block device in the form of /dev/dsk/c?t?d?s2.

OPTIONS
     The following options are supported:

     -f    Report on the disk free space, including the  starting
           block address of the free space, number of blocks, and
           unused partitions.

     -h    Omit the headers from the normal output.

     -s    Omit all headers but the column header from the normal
           output.

     -t vfstab
           Use vfstab as the  list  of  filesystem  defaults,  in
           place of /etc/vfstab.

     -m mnttab
           Use mnttab as the  list  of  mounted  filesystems,  in
           place of /etc/mnttab.

EXAMPLES
     Example 1: The prtvtoc command.

     The command line entry and system response shown  below  are
     for a 424-megabyte hard disk:

     example# prtvtoc /dev/rdsk/c0t3d0s2
     * /dev/rdsk/c0t3d0s2  partition map
     *
     * Dimension:
     *     512 bytes/sector
     *      80 sectors/track
     *       9 tracks/cylinder
     *     720 sectors/cylinder
     *    2500 cylinders
     *    1151 accessible cylinders

SunOS 5.8           Last change: 12 Sep 1997                    1

Maintenance Commands                                  prtvtoc(1M)

     *
     * Flags:
     *   1: unmountable
     *  10: read-only
     *

     The data in the Tag column above indicates the type of  par-
     tition, as follows:

     Name                        Number
     UNASSIGNED                  0x00
     BOOT                        0x01
     ROOT                        0x02
     SWAP                        0x03
     USR                         0x04
     BACKUP                      0x05
     STAND                       0x06
     VAR                         0x07
     HOME                        0x08
     ALTSCTR                      0x09
     CACHE                       0x0a

     The data in the Flags column above indicates how the  parti-
     tion is to be mounted, as follows:

     Name                        Number
     MOUNTABLE, READ AND WRITE   0x00
     NOT MOUNTABLE               0x01
     MOUNTABLE, READ ONLY        0x10

     Example 2: Output for the  -f option.

     The following example shows output for the   -f  option  for
     the same disk as above.

     example# prtvtoc -f /dev/rdsk/c0t3d0s2
     FREE_START=0 FREE_SIZE=0 FREE_COUNT=0 FREE_PART=34

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Availability                | SUNWcsu                     |
    |_____________________________|_____________________________|

SunOS 5.8           Last change: 12 Sep 1997                    2

Maintenance Commands                                  prtvtoc(1M)

SEE ALSO
     devinfo(1M),  fmthard(1M),  format(1M),  mount(1M),   attri-
     butes(5)

WARNINGS
     The mount command does not check the "not mountable" bit.

SunOS 5.8           Last change: 12 Sep 1997                    3

The real world type output looks like this : 

nix# prtvtoc /dev/rdsk/c0t1d0s0
* /dev/rdsk/c0t1d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     107 sectors/track
*      27 tracks/cylinder
*    2889 sectors/cylinder
*   24622 cylinders
*   24620 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
* Unallocated space:
*       First     Sector    Last
*       Sector     Count    Sector 
*    58929822  12197358  71127179
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0   2097414   2097413   /
       1      3    01    2097414   2097414   4194827
       2      5    00          0  71127180  71127179
       3      7    00    4194828   8389656  12584483   /var
       5      8    00   12584484   8389656  20974139   /export/home
       6      4    00   20974140   4194828  25168967   /usr
       7      0    00   25168968  33760854  58929821   /opt
nix# 

Therefore what Linux calls a sun label is in fact a Sun vtoc table list.
The Linux world numbers those entries from 1 upwards. Therefore the
somewhat useless "backup" vtoc slice at vtoc #2 is called the full disk
entry by Gentoo linux. 

    * * * The backup slice does not need to exist * * *

Those entries in the Sun label can be just about anything and that also
means they can overlap. No problem. However unless you really know what
you are doing then do not overlap the table entries. The so called full
disk backup slice is an overlap of the entire disk sector count. Again
I tell you that it does not need to exist at all. It serves no real
purpose other than to allow dd to copy all sectors. It is useless as a
backup tool in any modern world.

A Sun SPARC machine will boot from any disk and from just about anywhere
on that disk. It seems GRUB2 can not do this. 

See : https://wiki.gentoo.org/wiki/Handbook:SPARC/Installation/Disks#Sun_formatted_partition_scheme

There it says :

     Important! SPARC systems using OBP version 3 or older have
     additional restrictions on their partitioning scheme. The
     root partition must be the first partition on the disk, and
     it may be no larger than 2 GiB.

That says all that needs to be said. This has been verified and tested
with a Sun 420R server and the installation and GRUB2 boot loader work
just fine under those restrictions.  Any attempt to boot into a disk at
some other location will fail. For some reason GRUB2 can not locate the
bootable sectors anywhere else other than at sector zero if a given dev.

That is a bug. However it is upstream in GRUB2 and not a Gentoo bug as
the documentation clearly states the bootable "/boot" filesystem with
the GRUB goodness must be at sector zero and no larger than 2GB.

Dennis Clarke
Comment 10 Mike Gilbert gentoo-dev 2023-04-03 17:11:01 UTC
Thanks for that explanation!