On Tue, 5 Apr 2016 12:07+0200, [email protected] wrote:

> Trond Endrestøl píše v út 05. 04. 2016 v 11:30 +0200:
> 
>       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)?
>       
>       uname -a
>       FreeBSD  10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 
> 02:10:02 UTC 2016     
> [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64
>       
>       gpart create -s gpt ada0
>       ada0 created
>       
>       gpart add -a 4K -s 800K -t efi ada0
>       ada0p1 added
>       
>       gpart add -a 4K -s 4G -t freebsd-swap ada0
>       ada0p2 added
>       
>       gpart add -a 4K -t freebsd-zfs ada0
>       ada0p3 added
>       
>       gpart show -p ada0
>       =>      34  41942973    ada0  GPT  (20G)
>               34         6          - free -  (3.0K)
>               40      1600  ada0p1  efi  (800K)
>             1640   8388608  ada0p2  freebsd-swap  (4.0G)
>          8390248  33552752  ada0p3  freebsd-zfs  (16G)
>         41943000         7          - free -  (3.5K)
>       
>       gpart bootcode -b /boot/pmbr -p /boot/boot1.efifat -i 1 ada0
>       gpart: /boot/boot1.efifat: file too big (524288 limit)
>       
>       gpart bootcode -b /boot/pmbr ada0
>       bootcode written to ada0
>       
>       gpart bootcode -p /boot/boot1.efifat -i 1 ada0
>       <no output>
>       
>       System is bootable.

> Try "dd if=/boot/boot1.efifat of=/dev/ada0p1" instead.

I'm aware of dd(1), but I feel gpart(8) should be able to handle this 
task, which it sort of does, if you do the -b and the -p parts as 
separate invocations as demonstrated above.

gpart(8) should take the current boot firmware into consideration.

If the boot firmware is BIOS, then a limit of 512K (524288 bytes) is 
fine as that's the current limit for the bootcode in /boot/pmbr.

If the boot firmware is (U)EFI, then gpart(8) should allow a -p image 
of a size less than or equal to the partition's size, while 
simultaneously writing the PMBR.

I.e., contrary to the current documentation for gpart(8)'s bootcode 
subcommand:

  The size of the file must be smaller than the size of the partition.

-- 
+-------------------------------+------------------------------------+
| Vennlig hilsen,               | Best regards,                      |
| Trond Endrestøl,              | Trond Endrestøl,                   |
| IT-ansvarlig,                 | System administrator,              |
| Fagskolen Innlandet,          | Gjøvik Technical College, Norway,  |
| tlf. mob.   952 62 567,       | Cellular...: +47 952 62 567,       |
| sentralbord 61 14 54 00.      | Switchboard: +47 61 14 54 00.      |
+-------------------------------+------------------------------------+
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[email protected]"

Reply via email to