Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Dec 2014 15:32:19 +0100
From:      Julien Meister <julien.meister2@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   FreeBSD 10.1-STABLE: UEFI booting from USB flash drive + FBSD system on HDD
Message-ID:  <CAMFERy=nxhJejCSvyCuO5Rbvb2kUaXPDfUa13%2B_Bod=__7-Zug@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello everybody,

I've been trying to make UEFI booting work on my Thinkpad T420. My goal is
(as I had previously done with BIOS) to boot FreeBSD from a USB flash drive
with my laptop hard drive encrypted.

The T420 is able to boot using UEFI if the /boot partition is on the same
disk as the other partitions. So installing FreeBSD on a USB flash drive OR
on the HDD works fine with UEFI. (I haven't tested encryption yet)

However, when trying to boot from USB and then access the ROOT partition on
the HDD (which will be the case later when my HDD will be encrypted), I get
the following panic:

*>> FreeBSD EFI boot block*
*Loader path: /boot/loader.efi*
*File /boot/loader.efi not found*
*panic: Load failed*

=3D> USB flash drive contains: EFI partition + /boot
=3D> HDD contains the rest (which will be encrypted)

Here are the commands I used (without encryption for the moment):

*# gpart destroy -F ada0*
*# gpart destroy -F da0*

*# gpart create -s gpt ada0*
*# gpart create -s gpt da0*

Create the EFI and /boot partition on the USB flash drive:
*# gpart add -t efi -a 4K -l bootefi -s 800K da0*
*# gpart add -t freebsd-ufs -l usbboot -s 768M da0*

Prepare the EFI partition:
*# dd if=3D/boot/boot1.efifat of=3D/dev/gpt/bootefi*

Partition the HDD. For this example, I will only use one big / partition.
*# gpart add -t freebsd-ufs -a 4K -l gprootfs ada0*

Newfs and mount everything:
*# newfs /dev/gpt/usbboot*
*# newfs /dev/gpt/gprootfs*

*# mkdir /tmp/mnt*
*# mount /dev/gpt/gprootfs /tmp/mnt*
*# mkdir /tmp/mnt/boot*
*# mount /dev/gpt/usbboot /tmp/mnt/boot*

Install FreeBSD:
*# sh*
*# for file in kernel.txz base.txz lib32.txz; do *
*untar --unlink -xpvJf ${file} -C /tmp/mnt done*

chroot into the new system and create /etc/fstab and /boot/loader.conf

*#chroot /tmp/mnt*
=3D> Edit /boot/loader.conf
*#echo 'vfs.root.mountfrom=3D"ufs:/dev/gpt/gprootfs"' > boot/loader.conf*

=3D> Edit /etc/fstab
*#echo '/dev/gpt/gprootfs / ufs rw 1 1' > etc/fstab*

Unmount everything and reboot
*#exit*
*#cd /*

=3D> Unmount usb flash drive
*#umount /tmp/mnt/boot *

=3D> Unmount hdd
*#umount /tmp/mnt*

*#reboot*

And I get a panic (as shown above)
*>> FreeBSD EFI boot block*
*Loader path: /boot/loader.efi*
*File /boot/loader.efi not found*
*panic: Load failed*

Any idea on how to make this work with UEFI? From what I understood, EFI
tries to boot on the first ufs partition found. It should be therefore
[FILE]da0p2[/FILE] ... but it isn't.

Thank you very much
=E2=80=8B
Julien



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMFERy=nxhJejCSvyCuO5Rbvb2kUaXPDfUa13%2B_Bod=__7-Zug>