efi boot question

Daniel Braniss danny at cs.huji.ac.il
Fri May 1 16:45:47 UTC 2020



> On 1 May 2020, at 18:34, Warner Losh <imp at bsdimp.com> wrote:
> 
> 
> 
> On Fri, May 1, 2020 at 3:54 AM Daniel Braniss <danny at cs.huji.ac.il <mailto:danny at cs.huji.ac.il>> wrote:
> 
> 
> > On 1 May 2020, at 11:42, Trond Endrestøl <trond.endrestol at ximalas.info <mailto:trond.endrestol at ximalas.info>> wrote:
> > 
> > On Fri, 1 May 2020 11:16+0300, Daniel Braniss wrote:
> > 
> >> hi,
> >> I have none efi boot that:
> >>      - the bios is set to do network boot/pxe
> >>      - if the dhcpd.conf is configured with filename set to pxeboot, it loads as diskless, 
> >>        or if set to “pmbr” then goes and boots off the hard disk.
> >>      (this is faster than changing the bios boot order)
> >> 
> >> 
> >> so now i'm experimenting with efi boot, 
> >> the GPT is:
> >> 
> >> =>         40      5857345456  mfid0  GPT  (2.7T)
> >>              40      409600                1  efi (200M)
> >>      409640     8388608               2  freebsd-ufs  ( 4.0G)
> >>    8798248   100663296             3  freebsd-swap  (48G)
> >> 109461544  5747883952            4  freebsd-zfs     (2.7T)
> >> 
> >> but am at loss figuring out what boot file to download.
> >> any insight is appreciated,
> > 
> > You can try this:
> > 
> > gpart bootcode -p /boot/boot1.efifat -i 1 mfid0
> > 
> > This will populate /dev/mdid0p1 with a FAT filesystem containing 
> > /boot/boot1.efi, saved as efi/boot/BOOTx64.efi. You may later replace 
> > the latter file with /boot/loader.efi. You will also find 
> > efi/boot/startup.nsh which simple instructs the boot firmware to load 
> > and run BOOTx64.efi.
> > 
> > I haven't worked out how you can grow the small 800K FAT filesystem to 
> > take advantage of your 200M partition. And indeed, we will need an ESP 
> > of more than 800K in the near future.
> > 
> > This fstab entry might be handy:
> > 
> > # Device      Mountpoint      FStype  Options                         Dump    Pass#
> > /dev/mfid0p1  /esp            msdosfs rw,-l,-m=664,-M=775,noauto      0       0
> > 
> > -- 
> > Trond.
> 
> 
> the fat partition is fine, has all that is needed, but
> I need the right bootblock instead of pmbr, and there are many  *efi* in /boot and I don’t
> know which one to use :-(
> 
> You don't need boot blocks in UEFI.
> 
> Create the FAT partition, use newfs_msdos to initialize it. mount it and create a top-level directory named EFI.
> 
> There are several options from here:
> 
> (1) use the 'old style' of putting boot1.efi or loader.efi into EFI/BOOT/BOOTX64.EFI. If you have a really simple setup, this is likely the easiest. It usually works (though there are exceptions for some crazy BIOSes). This works because the UEFI BIOS looks for removable devices with a ESP that has /EFI/BOOT/BOOTxxx.EFI (where xxx varies on architecture, for AMD64 its X64). It loads this. Both boot1.efi and loader.efi know what to do from here if your root filesystem is on the same disk as the ESP. boot1.efi searches a little harder for things, while loader.efi is more disciplined in what it searches for to allow for predictable behavior. This option works great for a FreeBSD only machine.
> 
> (2) Use the new style. mount the esp somewhere, say /boot/efi. Put loader.efi into /boot/efi/EFI/FreeBSD and use the following command:
> efibootmgr --create --loader /boot/efi/efi/freebsd/loader.efi --kernel /boot/kernel/kernel --label "FreeBSD Rocks" --activate --verbose
> 
> which creates and activates a UEFI boot variable, that tells it to load loader.efi first and have it load the default kernel and to label it "FreeBSD Rocks".
> 
> This also works well for FreeBSD only machines and gives you more control if you are doing things like having redundant partitions and you want to nail down exactly the right one. This also works for people that want to have multiple versions of FreeBSD on the machine (though 11 and older works less well than 12 and newer).
> 
> (3) There are a number of 3rd party chain loaders rEFInd is likely the most popular. I don't use those, so I can't comment on them further. These work well when you have multiple OSes that each have their own fussy notion of the proper early boot setup.
> 
> Warner

my problem is that the bios is set to network boot/pxe. In such case
the dhcp responds with ‘filename’. With no efi partition, just freebsd-boot, setting file to pmbr - which get loaded via tftp , it works fine, it boots from the
disk ’s freebd-ufs partition - if there are several, setting bootme does the trick.

my problem is that using pmbr it failed when the partition is efi (fat and all the files are there) with no boot found - or something similar.
so im wondering if there is some other file tat can be loaded via tftp that will load the right stuff from the efi/fat partition.

danny



More information about the freebsd-hackers mailing list