Trivially solved - Dual booting Windows 10 and FREEBSD 12.1-R on an ASUS UEFI laptop

Per Hedeland per at hedeland.org
Tue May 12 13:55:41 UTC 2020


On 2020-05-12 14:17, salvatorembartolotta at libero.it wrote:
>
>> Il 12 maggio 2020 alle 9.06 Salvatore Bartolotta via freebsd-questions <freebsd-questions at freebsd.org> ha scritto:
>>
>>
>>> Il 12 maggio 2020 alle 0.17 Per Hedeland <per at hedeland.org> ha scritto:
>>>
>>> On 2020-05-11 20:02, Salvatore Bartolotta via freebsd-questions wrote:> Good afternoon (in the U.S.A.),
>>>> I installed 12.1-R on an Asus laptop - well, almost. The partition editor, apparently, didn't see the 260MB EFI partition and wanted to create a _second_ EFI partition, in the middle of the
disk,right before the rootfs (monted on /), what made little sense to me. I said "no", making the system, for the time being, unbootable. The installation completed except for that step.
>>> I noticed that too, and did the same, but it didn't result in anunbootable system since I had the EFI partition already set up from anearlier install (which I don't recall wanting to create an
EFIpartition, but I may be wrong about that)...
>>>> nvd0 GPT layout:nvd0p1 260 MB EFI partitionnvd0p2 16MB M$ reserved partitionnvd0p3 256GB M$ system and data partitionnvd0p4 512KB freebsd-bootnvd0p5 2GB rootfs, mounted on /)nvd0p6 80 GB swap (on
a 32GB RAM system, maybe overkill)nvd0p7 26GB varfs, mounted on /varnvd0p8 14GB tmpfs, mounted on /tmp, may be ovewrkill as wellnvd0p9 134GB usrfs, mounted on /usr....nvd0lastpartition 650MB M$
Recovery partition
>>>> I hope there is some simple way to complete this FreeBSD installation, by adding the appropriate booting code to the _existing_ EFI partition.
>>> It seems you also have a Windows installation - do you want to be ableto dual-boot? Otherwise I think you can find the info you need in theuefi(8) man page. AFAIR it pretty much amounts to
"somehow"mount_msdosfs-mounting the EFI partition and copying /boot/boot1.efifrom the FreeBSD installation to /EFI/BOOT/BOOTX64.EFI(case-independent I believe, I actually have
/EFI/Boot/bootx64.efi).Should be doable from either of the  or  (if present)choices in the installer.
>>> --Per Hedeland
>>
>>
>> Good night,
>>
>> I'd like to be able to dual-boot for the time being - multi-boot, at the end of the day.  The live CD is certainly my friend, I am just not sure how I am supposed to do it. Should I install some
UEFI shell/utility/... in the EFI nvd0p1 partition in order to manage the FreeBSD and Windows booting code, then install/point to the actual FreeBSD (and Windows) booting code (not /boot/boot1.efi, I
suppose) ? Has anybody done anything like that?

This is kind of moot considering what you write below, but since I
already had written it when I saw your message, I guess I'll post it
anyway - maybe it's useful to someone else.

I do have a Windows/FreeBSD dual-boot setup on my laptop, and for any
dual/multi-booting, I believe(d) you need a 3rd-party boot manager -
and the subject is perhaps a bit too much to go into the details of
here, but googling will find quite a few recipes. Most of them seem to
be using either grub or rEFInd, I ended up using the latter and doing
most of the setup from the Windows side.

Googling now, I found a good summary (though not a recipe) at
https://forums.freebsd.org/threads/dual-booting-windows-10-alongside-freebsd-11-0-release.59427/#post-341619
(it actually says that you *may* *not* need a 3rd-party boot manager...).

Anyway, this is the contents of my EFI partition, originally created by the
Windows installation:

$ ls /mnt/EFI
Boot            Microsoft
$ ls /mnt/EFI/Boot
bootx64-freebsd.efi     bootx64.efi             refind.conf
bootx64-windows-10.efi  icons                   refind.conf.ORIG
$ tail /mnt/EFI/Boot/refind.conf

menuentry "FreeBSD" {
    loader \EFI\Boot\bootx64-freebsd.efi
    icon \EFI\Boot\icons\os_freebsd.png
}

menuentry "Windows 10" {
    loader \EFI\Boot\bootx64-windows-10.efi
    icon \EFI\Boot\icons\os_win.png
}

Here bootx64.efi is rEFInd, bootx64-freebsd.efi is a copy of
/boot/boot1.efi from FreeBSD, and bootx64-windows-10.efi is (of course) the
Windows loader, originally named bootx64.efi. AFAIR, this setup was all
done from the FreeBSD Live CD.

There was a bit more to getting it to work though - I had to create a boot
entry for rEFInd (and occasionally have to re-create it), unclear why,
using a Windows tool called EasyUEFI - there may be others.

>> In the past, I had used some pay$$ware on BIOS (not EFI) machines, sure, but I'd like to be able to do everything - except for the necessary evil, the M$ Windows OS and some of its $program$ -
open-source minded.

The rEFInd boot manager is open source, as is grub of course - EasyUEFI is
not AFAIK, but at least the version I used was free as in beer.

> Good morning,
>
> the solution seems to be trivial:
>
> 1) Boot from FreeBSD live CD
> 2) Mount_msdosfs the GPT EFI partition (e.g. on /mnt)
> 3) copy (cp -i) /boot/boo1.efi from the live CD to the EFI partition, to e.g. /mnt/EFI/Boot
> 4) Reboot the machine, access UEFI and create the FreeBSD entry - e.g. path /EFI/Boot/boot1.efi
>
> YMMV and at boot time, pressing the appropriate key (e.g. Esc) lets you select which OS to boot.
>
> Googling has brought me a number of long and complicated discussions and recipes on various system configurations and some confusion as well; reading _1_ minute the relevant UEFI(8) man page has
brought me the solution (!).  Shame on me...
>
> Maybe someone with docs commit access could put or rather rewrite this "solution"  somewhere in the documentation (/FAQs?/handbook?/...), with some frills added (/grub/... configuration?).

Great that you found such a straightforward solution! I suspect the
complexity of the solution to a great degree depends on the quality of
the "UEFI firmware", as discussed in the forum post I linked to
above. At least with my laptop (Lenovo ideapad 320), I don't see any
"builtin" opportunity to "access UEFI and create the FreeBSD entry", I
had to use the EasyUEFI tool for that.

And while I probably could have managed with *only* creating a
"FreeBSD entry" instead of using rEFInd as boot manager, it's kind of
nice to always get presented with a selection (with a timeout for the
reply) and not having to remember to (on my laptop) repeatedly hit F12
in order to enter the "firmware boot manager" - but of course that's a
matter of taste and usage patterns.

--Per


More information about the freebsd-questions mailing list