Re: changing ext. USB disk to UEFI boot

From: Matthias Apitz <guru_at_unixarea.de>
Date: Thu, 04 Apr 2024 16:34:13 UTC
El día jueves, abril 04, 2024 a las 02:40:54p. m. +0200, Matthias Apitz escribió:

> First, I will do one last test and copy also /boot/boot1.efi into the
> efi partition as /EFI/BOOT/BOOT1.efi because the man page of
> boot1.efi(8) says that some system can not use loader.efi(8) directly.

This didn't helped either.

At the end I did with the new USB disk:

# gpart delete -i 1 da0
# gpart destroy da0
# gpart create -s gpt da0
# gpart add -t efi -s 260M -l freebsd-efi da0
# gpart add -t freebsd-ufs -l extrootfs -s 256g da0
# newfs_msdos -F 32 -c 1 /dev/da0p1
# mount -t msdosfs /dev/da0p1 /mnt
# mkdir -p /mnt/EFI/BOOT
# cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi
# umount /mnt

# newfs -U -L FreeBSD /dev/da0p2
# mount /dev/da0p2 /mnt
# mkdir /mnt/boot
# cp -Rp /boot/* /mnt/boot
# umount /mnt

With this the USB disk was presented in the laptop as boot device
and also the FreeBSD boot menue came up. I've still to fill
the /dev/da0p2 with the system.

I wanted to do this with:

# mount /dev/da0p2 /mnt
# cd /mnt
# dump -0Lauf - /dev/da1p2  | restore -rf -

but this take 24++ hours. So I will do in with:

# cd /usr/src
# make installworld  DESTDIR=/mnt
# make installkernel DESTDIR=/mnt
# make distrib-dirs  DESTDIR=/mnt
# make distribution  DESTDIR=/mnt
# ....

The produced layout is now:

# gpart list da0
Geom name: da0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 1953458135
first: 40
entries: 128
scheme: GPT
Providers:
1. Name: da0p1
   Mediasize: 272629760 (260M)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,GPT,d7321d02-f295-11ee-ab68-9cd21e857279,0x28,0x82000)
   rawuuid: d7321d02-f295-11ee-ab68-9cd21e857279
   rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
   label: freebsd-efi
   length: 272629760
   offset: 20480
   type: efi
   index: 1
   end: 532519
   start: 40
2. Name: da0p2
   Mediasize: 274877906944 (256G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(2,GPT,ed085ae9-f295-11ee-ab68-9cd21e857279,0x82028,0x20000000)
   rawuuid: ed085ae9-f295-11ee-ab68-9cd21e857279
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: extrootfs
   length: 274877906944
   offset: 272650240
   type: freebsd-ufs
   index: 2
   end: 537403431
   start: 532520
Consumers:
1. Name: da0
   Mediasize: 1000170586112 (931G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2

Thanks for all hints

	matthias
-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub