On Tue, May 16, 2023 at 10:07:20AM -0700, Chris Cappuccio wrote:
> I don't quite understand the case this patch solves, because my installs to
> fresh media always get EFI/GPT. It doesn't default to MBR. However, if
> there is a case where it tries to use MBR, that isn't going to work so well.

If efi(4) attaches, the installer defaults to EFI/GPT:
        Use (W)hole disk MBR, whole disk (G)PT, or (E)dit? [gpt]

That is what you see and why you chose "gpt", right?
It will lead to a disk containing an EFI System Partition.

My diff is only concerns chosing "edit" at this question, for example
when you want to leave free space on the disk.

"edit" drops into manual mode aka. 'fdisk -e', after instructing users
how to create a bootable disk.  If the chosen disk has a valid GPT:

        Use (W)hole disk MBR, whole disk (G)PT, or (E)dit? [gpt] edit

        You will now create two GPT partitions. The first must have an id
        of 'EF' and be large enough to contain the OpenBSD boot programs,
        at least 532480 blocks. The second must have an id of 'A6' and will
        contain your OpenBSD data. Neither may overlap other partitions.
        Inside the fdisk command, the 'manual' command describes the fdisk
        commands in detail.

        Enter 'help' for information
        sd0: 1>


In all other cases, incl. a zeroed disk on an EFI system:

        Use (W)hole disk MBR, whole disk (G)PT, or (E)dit? [gpt] edit

        You will now create a single MBR partition to contain your OpenBSD 
data. This
        partition must have an id of 'A6'; must *NOT* overlap other partitions; 
and
        must be marked as the only active partition.  Inside the fdisk command, 
the
        'manual' command describes all the fdisk commands in detail.

        Enter 'help' for information
        sd0: 1>


So it tells users to do MBR, even when they boot using EFI, possibly on
a new machine that only support UEFI and not BIOS/compat mode/whatever.

Users follow instructions, one scenario could be entering 'help',
learning about and using 'reinit' to initialise the partition table
(it will do MBR), 'print' to confirm that it indeed create a single
partition of type A6, then 'write' and 'quit' to continue.

The installer happily finishes a default install, sd0i may be be some FFS,
but not ax MSDOS EFI System Partition.

> MBR boot is totally unsupported on modern Intel. Starting with 10th gen
> Intel processors, Intel only supplies graphics code for EFI mode.
> 
> With some 10th gen chipsets, like W480, the BIOS still gives you can option to
> boot MBR with zero graphics. For the BIOS on 11th gen chipsets like the W580,
> there is no MBR boot capability at all, for whatever reason.
> 

I noticed this when installing on a 12th gen Intel T14 gen 3, where I
don't see any BIOS mode whatsoever, hence my surprise being instructed
to go with MBR instead of GPT when I chose "edit" to create an OpenBSD
parition that does not span the whole disk (nothing else done manually).

Thus I propose switching the installer's decision about which instructions
to print from looking at on-disk data to checking whether efi(4) attached;
the very same check that is used to default "Use (W)hole ...?" to "gpt"
instead of "whole".

Does that make any more sense?

Am I missing something gravely here?


Index: distrib/amd64/common/install.md
===================================================================
RCS file: /cvs/src/distrib/amd64/common/install.md,v
retrieving revision 1.60
diff -u -p -r1.60 install.md
--- distrib/amd64/common/install.md     26 Apr 2023 22:45:32 -0000      1.60
+++ distrib/amd64/common/install.md     16 May 2023 20:24:25 -0000
@@ -86,7 +86,7 @@ md_prep_fdisk() {
                        echo "done."
                        return ;;
                [eE]*)
-                       if disk_has $_disk gpt; then
+                       if [[ $MDEFI == y ]]; then
                                # Manually configure the GPT.
                                cat <<__EOT
 

Reply via email to