EFI drivers forward to TrueOS in HBSD


#1

My ESP is on /dev/ada0p6 and mounted on /boot/efi then I’ve copied EFI drivers BOOTx64.EFI, boot1.efi, loader.efi from /boot to /boot/efi/efi/hbsd and I have HBSD installed on /dev/ada0p1, but BOOTx64.EFI and boot1.efi are forwarded to TrueOS-STABLE as fallback, also loader.efi doesn’t mount any partitions and always frozen inside single user.
Newnix has told to me in Telegram, which these EFI drivers are needed to be configured using EFI shells, to ask them to mount /dev/ada0p1 for HBSD. How to do so and what other configs to do?


#2

Any tip in handbook? https://hardenedbsd.org/~shawn/hbsd_handbook/book.html


#3

I’ve also researched for https://FreeBSD.org/cgi/man.cgi?query=uefi and https://www.freebsd.org/cgi/man.cgi?query=gptboot, now I have ideas to config this.:grin:


#4

That handbook is useless to my issue, I mean all the BSD-based EFI drivers always show no UFS partitions, then I can never properly boot HBSD. Note that my /boot/loader.conf and /boot/loader.rc are empty.


#5

These guides are for NetBSD, but have a look and see if any of them can give you some hints.

http://daemonforums.org/showthread.php?p=64539#post64539


#6

I forgot this one…
https://wiki.netbsd.org/Installation_on_UEFI_systems/
If the HBSD installer is also being worked on, maybe it already supports something along the lines in the wiki article above :thinking:


#7

My own HBSD EFI config script below,

mkdir -pv /boot/efi
mount -t msdosfs /dev/ada0p6 /boot/efi
nano /boot/loader.conf

menu=Boot normally:rndseed /etc/entropy-file;boot ufs:ada0p1
menu=Boot single user:rndseed /etc/entropy-file;boot ufs:ada0p1 -s
menu=Disable ACPI:rndseed /etc/entropy-file;boot ufs:ada0p1 -2
menu=Disable ACPI and SMP:rndseed /etc/entropy-file;boot ufs:ada0p1 -12
menu=Drop to boot prompt:prompt
default=1
timeout=15 #HBSD installer at least times out 10 seconds
clear=1

nano /boot/loader.rc

include /boot/loader.conf
include /boot/loader.4th
start

gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 21 ada0
gpart set -a bootme -i 1 ada0
gpart set -a bootonce -i 1 ada0

Based on this from the original NetBSD script,

mount -t msdos /dev/wd0a /media
mkdir -p /media/EFI/boot
cp /usr/mdec/*.efi /media/EFI/boot
nano /media/EFI/boot/boot.cfg

menu=Boot normally:rndseed /etc/entropy-file;boot hd0b:netbsd
menu=Boot single user:rndseed /etc/entropy-file;boot hd0b:netbsd -s
menu=Disable ACPI:rndseed /etc/entropy-file;boot hd0b:netbsd -2
menu=Disable ACPI and SMP:rndseed /etc/entropy-file;boot hd0b:netbsd -12
menu=Drop to boot prompt:prompt
default=1
timeout=5
clear=1

installboot -v /dev/rwd0b /mnt/usr/mdec/bootxx_ffsv2

But, my EFI/boot1.efi and EFI/loader_4th.efi still probe no UFS partitions and always forward to TrueOS somewhy.


#8

Useless to me where HBSD is FreeBSD-based instead of NetBSD. The bsdinstall interfaces are totally different to any others.


#9

Could rEFInd be a temporary solution for you?
http://www.rodsbooks.com/refind/

See here for a walk through…


#10

No but what I need is to make rEFInd to probe my UFS partitions using my drivers from https://efi.akeo.ie. And rEFInd is my long-term EFI manager, not temp.


#11
/usr/sbin/efibootmgr
/usr/sbin/efidp
/usr/sbin/efivar
/usr/sbin/uefisign

Which commands from these are needed to finish configuring my EFI drivers?
I’m now trying to config using efidp and efivar commands.:thinking:


#12

Sorry :cry: …no clue.
Just trying to give some ideas, never digged into this myself. I use Grub and it has always worked OOTB. As for NetBSD, my system is booting in legacy mode.


#13

HBSD also has GRUB then I install and probe it,
sudo pkg install -y grub2-efi && sudo grub-install --efi-directory=/boot/efi --target=x86_64-efi --bootloader-id=hbsd --force && sudo grub-mkconfig -o /boot/grub/grub.cfg
HBSD GRUB has now been already present on my rEFInd but it reports kernel panic.:thinking:!



#14

For sure you know about https://groups.google.com/a/hardenedbsd.org/forum/m/#!forum/users


#15

This has been solved using other EFI drivers, now the system boots normally to the multi-user session. :smiley:


#16

Nice :smiley:
Out of curiosity… what drivers did you use?


#17

Either boot1.efi, loader_lua.efi, loader_simple.efi, but needs to manually mount my root using any of ufs:gpt/hbsd or ufs:ada0p1, so Intel graphics driver still always doesn’t work.
Others just still forward to TrueOS.


#18

Thanks for sharing!
You never know when/if needed :wink:


#19

You could start by posting the grub.cfg entry for your HBSD system, grub-install has never really worked with anything but Linux and Windows, and always required making a custom entry ;), which will vary depending on your partition layout, root file system, encryption, etc… non-encrypted ufs2 is usually easy to get booting with Grub or SysLinux on FreeBSD, hope this applies to HBSD too.

Also, gptboot(8) is meant for BIOS, not UEFI :wink: