A gpart(8) mystery on 10.3-RELEASE

Warren Block wblock at wonkity.com
Tue Apr 5 19:50:13 UTC 2016


On Tue, 5 Apr 2016, Boris Samorodov wrote:

> 05.04.16 12:30, Trond Endrestøl пишет:
>
>> What am I doing wrong? Can't gpart(8) write both the pmbr and the efi
>> image as a single command? Is it an off-by-one error in gpart(8)?
>>
>> gpart bootcode -b /boot/pmbr -p /boot/boot1.efifat -i 1 ada0
>> gpart: /boot/boot1.efifat: file too big (524288 limit)
>
> Do you try to get only UEFI boot? Then do not use "-b" option. It is
> needed for BIOS boot.
>
> Do you need to get a system with both UEFI and BIOS boot? Then use two
> different partitions for UEFI and BIOS booting schemes.
>
>> gpart bootcode -b /boot/pmbr ada0
>> bootcode written to ada0
>
> This is needed only for BIOS boot and together with "-p /boot/gptboot"
> option.

Well... bootcode -b only writes to the PMBR and does not take a 
partition number with -i.  So the short form version I use could be 
refused by a very strict option parser, requiring two separate steps:

   gpart bootcode -b /boot/pmbr ada0
   gpart bootcode -p /boot/gptboot -i1 ada0

The way it parses options when working on EFI partitions might be more 
strict.

Actually, the more I think about it, using bootcode -p to write the 
entire EFI partition seems dangerous.  Unless it is surprisingly smart, 
it will wipe out any existing stuff on that EFI partition, which could 
be any number of important things put there by other utilities or 
operating systems, including device drivers.

The safer way is to mount that partition and copy the boot1.efi file to 
it.


More information about the freebsd-stable mailing list