NetBSD-Users archive

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

Re: GRUB2 chainloading GPT NetBSD partition



kre%munnari.OZ.AU@localhost (Robert Elz) writes:

>    Date:        Tue, 8 Jul 2025 21:03:45 -0000 (UTC)
>    From:        mlelstv%serpens.de@localhost (Michael van Elst)
>    Message-ID:  <104k13h$k7p$1%serpens.de@localhost>

>  | % strings /usr/mdec/bootxx_ffsv2 |grep -i slice
>  | no slice

>Hmm .. I did a recursive grep on src/sys and didn't find that, but
>I was probably looking for SLICE (upper case) which is what the
>reported message was.   That's bizarre, why would be use "slice" there?

>  | bootxx_ffsv2 looks for a MBR with a NetBSD partition (type 169),
>  | it will only look for a GPT if it gets started with $GPT_MAGIC
>  | in %eax (from a hybrid MBR).

>That's horrid, and needs fixing, it should be possible to boot from
>GPT if the MBR is a PMBR as well.   I don't know x86 assembler well
>enough to fix that, but it looks as if checking for the PMBR magic
>in the same sequence that the checks for various FAT types (if that
>is being compiled in), and the NetBSD MBR type, should allow it to
>work, if there's enough space to shovel in whatever else is needed.

"Enough space" in the PBR is probably the problem here. Another
might be the following magic:

boot_gpt:
        /* DS:SI has a pointer to the hybrid MBR handover structure */
        movl    (GPT_ENTRY_OFF+GPT_ENT_LBA_OFF+0)(%si), %ebp
        movl    (GPT_ENTRY_OFF+GPT_ENT_LBA_OFF+4)(%si), %edi

That probably doesn't exist. If I understand grub, it's also
passing a 0 value in %si in this case, which only comes out
if it had loaded the relevant GPT entry into the beginning
of the data segment.



Home | Main Index | Thread Index | Old Index