*New 12.1 series Release:
2019-11-08: XigmaNAS 12.1.0.4.7091 - released!

*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released


We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

[HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

Only Admin's or Moderators can move thread's to this sub-forum.
Nobody should start a new thread on this sub-forum.
Anybody can reply to a thread on this sub-forum.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
poroshok
NewUser
NewUser
Posts: 3
Joined: 04 Apr 2018 21:49
Status: Offline

[HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

#1

Post by poroshok » 04 Apr 2018 22:16

Recently I've purchased SuperMicro's motherboard A2SDI-4C-HLN4F. I've found out that this motherboard does support only UEFI boot though it has legacy boot option.

More to that: current version of Nas4Free (5321) has no support for installed ethernet card.

What we're going to do is to install Nas4Free inside virtual machine to virtual disk, mix resulting image with some UEFI. And finally build the driver from source.

Prepare VM
Download the FreeBSD 11.1 HDD image for virtual machine. Mount image and boot.

Prepare SSH
It is much more comfortable to interact with VM through ssh. Login as root, set password. Then enable ssh:

Code: Select all

# echo sshd_enable=YES >> /etc/rc.conf
# echo PermitRootLogin yes >> /etc/ssh/sshd_config
# service sshd start
Now you're able to SSH to VM. If not, check your network adapter settings in VM.

Building loader.efi
As far as I understood, loader during boot process extracts mfsroot.gz into memory. However, default loader.efi renders the following error:

Code: Select all

panic: error reading '/mfsroot': cant allocate memory
The answer was found at FreeBSD's bugtracker:
The reason why mem allocation was failing is because default value of EFI_STAGING_SIZE is 48M, and if mfsroot is bigger than that - booting fails.
building a custom loader.efi w/ value for EFI_STAGING_SIZE bigger than mfsroot's size fixed this panic.
That's why we're going to rebuild loader.efi with increased EFI_STAGING_SIZE, suitable for holding mfsroot.gz. Finding out required size is pretty easy: find mfsroot.gz at Nas4Free ISO image and run:

Code: Select all

$ gzip -l ./mfsroot.gz
  compressed uncompressed  ratio uncompressed_name
    24041448    134217728  82.0% ./mfsroot
From the output above we can conclude that EFI_STAGING_SIZE must be greater than 134 MB.

Okay, let's start with installing curl:

Code: Select all

# pkg install curl
Download FreeBSD sources:

Code: Select all

# curl -L https://github.com/freebsd/freebsd/archive/release/11.1.0.tar.gz --output freebsd.tar.gz
# tar -xzf freebsd.tar.gz
# cd freebsd-release-11.1.0
Prepare build environment

Code: Select all

# make kernel-toolchain TARGET=amd64
# make _includes TARGET=amd64
# make buildenv TARGET=amd64 EFI_STAGING_SIZE=192
Last command spawns new shell. Build loader.efi

Code: Select all

# make -C lib/libstand all
# make -C sys/boot/ficl all
# make -C sys/boot/efi/libefi all
# make -C sys/boot/efi/loader all
# exit
# cp /usr/obj/root/freebsd-release-11.1.0/sys/boot/efi/loader/loader.efi /root
loader.efi should be stored in /root after steps above.

Building Intel x553 driver
Download the latest version of driver:

Code: Select all

# curl -L https://downloadmirror.intel.com/14688/eng/ix-3.2.17.tar.gz --output ixgbe.tar.gz
# tar -xzf ixgbe.tar.gz
# cd ix-3.2.17/src
Build it:

Code: Select all

make SYSDIR=/root/freebsd-release-11.1.0/sys TARGET=amd64
chmod +x if_ix.ko
cp if_ix.ko /root
After steps above if_ix.ko should be stored in /root.

Installing Nas4Free to virtual disk
- Turn off virtual machine
- Download Nas4Free ISO image at host machine and mount it to VM
- Create empty virtual disk with approx size of 2 GB. And mount it
- Boot VM from that ISO and perform Embedded GPT install to created disk
- Shutdown VM, unmount ISO. Boot VM to FreeBSD, not the installed Nas4Free

Making image EFI-bootable
Check out disk layout after installing Nas4Free:

Code: Select all

# gpart show
...
=>     40  4194224  ada1  GPT  (2.0G)
       40     1024     1  freebsd-boot  (512K)
     1064     7128        - free -  (3.5M)
     8192  2097152     2  freebsd-ufs  (1.0G)
  2105344  2088920        - free -  (1.0G)
...
We have unused space between two partitions. That's where we're going to place EFI partition.

Code: Select all

# gpart add -t efi -b 1064 -l sysefi ada1
ada1p3 added
Create FAT filesystem on that partition and copy EFI boot loader to that partition:

Code: Select all

# newfs_msdos /dev/gpt/sysefi
...
# mount -t msdosfs /dev/gpt/sysefi /mnt
# mkdir -p /mnt/EFI/BOOT/
# cp /boot/boot1.efi /mnt/EFI/BOOT/bootx64.efi
# umount /mnt
Disk becomes UEFI bootable. Well, almost. Some additional steps are required: we have to copy our built loader.efi to the gptroot partition.

Code: Select all

# mount -t ufs /dev/gpt/gptroot /mnt
# cp /root/loader.efi /mnt/boot/
Almost finished. Without some tuning booting will freeze after displaying some EFI frame buffer information. Seems like this happens because of using old syscons terminal. Let's switch to the new terminal:

Code: Select all

# echo 'kern.vty="vt"' >> /mnt/boot/loader.conf.local
Installing x553 driver

Code: Select all

# cp /root/if_ix.ko /mnt/boot/kernel/if_ix.ko
# echo 'if_ix_load="YES"' >> /mnt/boot/loader.conf.local
# umount /mnt
Copying image to USB flash
Insert USB flash to host machine. Make sure it is visible from the VM. Then simply dd whole virtual disk to that USB stick.

Code: Select all

# dd bs=1M if=/dev/ada1 of=/dev/da0
# gpart recover /dev/da0
Where ada1 is the virtual disk, da0 is the USB stick.

Whoa! That's all folks!

jasch
experienced User
experienced User
Posts: 144
Joined: 25 Jun 2012 10:25
Location: Germany
Status: Offline

Re: [HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

#2

Post by jasch » 06 Apr 2018 22:55

Hi, first thx for your Work.
I cant get it working, its dropping out at the Efi Framebufer information.(until there all is fine, changing syscons terminal makes no diff.)
I dont use the usb, i just try to boot from the VM.
Maybe its an Problem with the Esxi efi bios.

I just found an similar thing with esxi and Pfsesne, but this was resolved on new versions.
https://redmine.pfsense.org/issues/7975

If you have esxi maybe u can test it, if its also happens on your System.

wbr Alex
XigmaNAS 12.0.0.4 (6625)@PROXMOX 5.V - Supermicro X8DTH-6F | 2x Xeon L5640 | 96GB ECC | LSI 9210-8i|LSI 9500-8e|LSI 9201-16i | 40GBe IB Mellanox |

poroshok
NewUser
NewUser
Posts: 3
Joined: 04 Apr 2018 21:49
Status: Offline

Re: [HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

#3

Post by poroshok » 07 Apr 2018 12:30

I've tested everything on VirtualBox. And yes, it also freezed after showing EFI frame buffer info. But changing to VT fixed that. May be playing with 'vt' parameters will help. Something like kern.vt.fb.default_mode

jasch
experienced User
experienced User
Posts: 144
Joined: 25 Jun 2012 10:25
Location: Germany
Status: Offline

Re: [HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

#4

Post by jasch » 09 Apr 2018 15:35

It seems there is some Problem with the ESXI efi Bios.
Has nothing to do with Res. tried diff. Settings via loader, gop set....
When i write the Data to USB stick i can efi boot the stick on another Computer, when i try to boot this stick in esxi, frame buffer info and out.
Freebsd 11.1 is booting fine with efi.
So it seems really a Problem with Nas4free vs. ESXI Efi
XigmaNAS 12.0.0.4 (6625)@PROXMOX 5.V - Supermicro X8DTH-6F | 2x Xeon L5640 | 96GB ECC | LSI 9210-8i|LSI 9500-8e|LSI 9201-16i | 40GBe IB Mellanox |

ivannn
NewUser
NewUser
Posts: 11
Joined: 20 Dec 2015 22:50
Status: Offline

Re: [HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

#5

Post by ivannn » 21 May 2018 18:56

I managed to boot Nas4Free CD iso via IPMI virtual device on A2SDi-8C+-HLN4F, installed on a USB stick and booted successfully 11.1.0.4.5565 in BIOS Legacy mode.
It wasn't hassle free, I've spent a lot of time switching settings and testing and failing to boot until I found a working solution and you can give it a shot too. It looks like an issue with non-intuitive bios settings in the latest bios version available for download on Supermicro website, not a Nas4free efi fault.

Some say BIOS v 1.0 had an issue with switching to Legacy boot mode. I am running 1.0b OOB, but switching both Boot mode to Dual AND CSM Support to Enabled (under Security/Secure Boot) did the magic for me - I am otherwise running the motherboard with BIOS default settings.

I am going to play with setting up NIC drivers, or temporarily use a spare intel nic until FreeBSD 11.2 based Nas4free with OOB support for x553 is released - the route to deploying a VM, setting up EFI and x553 driver and capturing an image probably has to be done every time I am upgrading to the latest version which is going to suck my time for testing and recovery in case of failure, despite it looks like an interesting workaround.

jasch
experienced User
experienced User
Posts: 144
Joined: 25 Jun 2012 10:25
Location: Germany
Status: Offline

Re: [HowTo] Install Nas4Free Embedded + EFI + Intel x553 driver

#6

Post by jasch » 23 May 2018 13:37

i just want to add that for me it is solved.
i boot legacy, install rootonzfs (with both options) then switch VM bios to uefi,
and its boots fine as uefi.
XigmaNAS 12.0.0.4 (6625)@PROXMOX 5.V - Supermicro X8DTH-6F | 2x Xeon L5640 | 96GB ECC | LSI 9210-8i|LSI 9500-8e|LSI 9201-16i | 40GBe IB Mellanox |

Post Reply

Return to “[HowTo]”