Feature #77385

Include efirt.ko in base system

Added by Mathieu Simon about 2 years ago. Updated almost 2 years ago.

No priority
Alexander Motin
Target version:
Estimated time:
Reason for Closing:
Reason for Blocked:
Needs QA:
Needs Doc:
Needs Merging:
Needs Automation:
Support Suite Ticket:
Hardware Configuration:


When I had to restore a FreeNAS config I moved over to a system running better in pure UEFI mode than CSM and unfortunately FreeNAS doesn't yet ship with efirt.ko in /boot/kernel.

FreeNAS contains efibootmgr which allows to create, modify and set order of boot variables and I had to update the boot configuration as the motherboard vendor wasn't looking for efi/boot/BOOTx64.efi. (Somewhat similar as i.e. in #18243 and #16280)

I've discovered this kernel module is present in FreeBSD 11.2 and 12.0 releases. Just for testing I've copied 11.2-RELEASE's efirt.ko from the installer ISO and kldload'ed it on FreeNAS 11.2 where I was afterwards abled to use efibootmgr (and efivar) so far no breakage found.

What might be the advantage:
  • One can use efibootmgr from a working FreeNAS box instead of going into UEFI, or using eitehr (a sometimes restricted/broken) EFI shell shipped with the motherboard or loading a third-part Tianocore EDK shell from a drive.
  • We provide the same functionality / behave the same as vanilla FreeBSD 11.2-RELEASE and newer
  • Future integration of EFI support into the appliance OS might become possible as CSM becomes more an afterthought in homeuser and server boards and UEFI boot becomes the assumed default by vendors (including it's new quirks...)

I'm not familiar yet with FreeNAS's build system, but where would I have to look into what modules are enabled and which are not? If possible I might come up with a merge requast or a patch for a config file.



#1 Updated by Mathieu Simon about 2 years ago

  • Description updated (diff)

#2 Updated by Dru Lavigne about 2 years ago

  • Category changed from Build system to OS
  • Assignee changed from Release Council to Alexander Motin

#3 Updated by Alexander Motin about 2 years ago

  • Tracker changed from Idea to Feature
  • Status changed from New Idea to Ready for Testing
  • Target version set to 11.3-BETA1
  • Idea Status deleted (New)
  • Severity set to Low
  • Needs QA set to Yes
  • Needs Doc set to Yes
  • Needs Merging set to Yes
  • Needs Automation set to No
  • Support Suite Ticket set to n/a

I've added efirt kernel module to FreeNAS 11.3-nightly (449063b). Should be in next build. Please try whether it work.

In 12 we may move it into the kernel statically, same as FreeBSD does there.

#4 Updated by Mathieu Simon almost 2 years ago

Hi Alex

I've spotted the related commit on Github, thanks.

I have a SuperMicro A1SAi-2750F where I can verify it, I should be able to test drive it with a nightly build on coming weekend. This particular board doesn't have a somewhat broken UEFI as it properly detect the EFI loader of FreeNAS on the boot drive without configuring explicit boot variables. However my "production" system using the AsRock C2750D4I exactly as mentioned in issue #16280 where using efibootmgr would definitely improve things.

#5 Updated by Mathieu Simon almost 2 years ago

The nightlies took up your update, here are my results:

# loading efirt works
root@nas-backup01[~]# kldload efirt

# dmesg output looking sane
root@nas-backup-01[~]# dmesg | tail -4
  TSC: P-state invariant, performance statistics
efirtc0: <EFI Realtime Clock> on motherboard
efirtc0: registered as a time-of-day clock, resolution 1.000000s
padlock0: No ACE support.

# Reading current UEFI boot entries
root@backup-nas01[~]# mkdir /mnt/EFI
root@backup-nas01[~]# mount -t msdosfs /dev/ada3p1 /mnt/EFI
root@backup-nas01[~]# efibootmgr -v
BootCurrent: 0000
Timeout : 1 seconds
BootOrder : 0000, 0003, 0004
Boot0000* FreeNAS HD(1,GPT,9b79131f-[...],0x82000)/File(\efi\boot\BOOTx64.efi)
                      ada3p1:/efi/boot/BOOTx64.efi (null)
Boot0004* UEFI: Built-in EFI Shell  VenMedia(5023b95c-db26-429b-a648-bd47664c8012)
Boot0003* UEFI: KINGSTON SV300S37A120G PciRoot(0x0)/Pci(0x18,0x0)/Sata(0x0,0xffff,0x0)/HD(1,GPT,9b79131f-[...],0x28,0x82000)

# Creating a boot entry:
root@backup-nas01[~]# efibootmgr -c -l /mnt/EFI/efi/boot/BOOTx64.efi -L FreeNAS-Test
BootCurrent: 0000
Timeout : 1 seconds
BootOrder : 0001, 0000, 0003, 0004
Boot0001  FreeNAS-Test
Boot0000* FreeNAS
Boot0004* UEFI: Built-in EFI Shell
Boot0003* UEFI: KINGSTON SV300S37A120G

# Rebooting and manually selecting FreeNAS-Test as boot entry -> works
root@backup-nas01[~]# efibootmgr
BootCurrent: 0001

# Deleting the test entry
root@backup-nas01[~]# efibootmgr --delete 0001
Removing boot variable 'Boot0001'
Removing 0x1 from BootOrder

Yup, looks good for what I can tell. I know the installer part is missing (as it does in FreeBSD), but that ok for now.

Feel free to close this ticket, or if you'd like to see additional testing, let me know.

#6 Updated by Dru Lavigne almost 2 years ago

  • Subject changed from Include efirt.ko in builds to Include efirt.ko in base system
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#7 Updated by Dru Lavigne almost 2 years ago

  • Status changed from Ready for Testing to Done
  • Needs QA changed from Yes to No

#8 Updated by Dru Lavigne almost 2 years ago

  • Target version changed from 11.3-BETA1 to 11.3-ALPHA1

Also available in: Atom PDF