# FreeBSD 10.1 Release/Stable UEFI Boot Freeze on ASUS H87 And H97 Plus Motherboards



## NuLL3rr0r (Jan 4, 2015)

I installed and built FreeBSD 10.1-STABLE kernel and world on an Asus P8Z77-V with a Core i7 3370K CPU on a GPT disk and UEFI enabled. It had some issues at first, but after upgrading the BIOS to rev-2104 which is the latest version it works flawlessly.

Now, I've got two systems (H87-Plus rev-2002 + Core i5 4440) and (H97-Plus rev 2306 + Core i5 4460) which are not able to boot from UEFI, when I do the `make installworld`.

This is what I do after re-partitioning and a clean install:

/etc/make.conf

```
CPUTYPE?=core-avx2
MAKE_JOBS_SAFE=yes
MAKE_JOBS_NUMBER=5
KERNCONF=GENERIC
```

`cd /usr/src/
make clean
rm -rf /usr/obj/*
make buildworld -j5
make buildkernel -j5 KERNCONF=GENERIC
make installkernel KERNCONF=GENERIC
shutdown -r now`

After installing the new kernel it boots fine. Then I do boot in single user mode using `boot -s` at loader's command line, and do the following:

`mount -u /
mount -a -t ufs
adjkerntz -i
mergemaster -p
cd /usr/src/
make installworld
mergemaster
reboot`

This is where things are getting messy! After rebooting the system it goes to ASUS EZ Mode and won't boot (Maybe it cannot find the boot partition or so). When I try my BIOS boot menu using F8 and boot from the disk it shows the following and freezes, nothing works except a cold reboot:


```
>> FreeBSD EFI boot block
      Loader path: /boot/loder.efi
_
```

I even tried `gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptboot -i 1 ada0` on FreeBSD install shell without any success. It won't even boot to the previous stage anymore.

I followed a similar process for my P8Z77-V setup. Except the following inside /etc/make.conf:

/etc/make.conf

```
CPUTYPE?=corei7-avx
MAKE_JOBS_SAFE=yes
MAKE_JOBS_NUMBER=9
KERNCONF=GENERIC
```

I don't know what's wrong. But, I'll appreciate any help.


----------



## wblock@ (Jan 4, 2015)

Is it booting in UEFI mode or legacy BIOS mode?  If it really is a UEFI boot, writing the BIOS bootcode was a mistake.

Setting CPUTYPE?=core-avx2 might be overly optimistic.  I've had no problems using CPUTYPE?=corei7 on my i5 machines (yes, that's correct), but /usr/share/examples/etc/make.conf says core-avx2 is for clang only.  That implies that it is less well tested than the gcc options.


----------



## NuLL3rr0r (Jan 4, 2015)

Never mind. I found The Root of All Evil!

The problem was with the CPUTYPE option. While it seems /usr/share/mk/bsd.cpu.mk mentions core-avx2 and both 4440 and 4460 support AVX2 instructions, the compiler somehow produces crippled binaries which segfaults. Setting it to a safer option such as corei7-avx simply solves the issue.


----------



## NuLL3rr0r (Jan 4, 2015)

wblock@ said:


> Is it booting in UEFI mode or legacy BIOS mode?  If it really is a UEFI boot, writing the BIOS bootcode was a mistake.
> 
> Setting CPUTYPE?=core-avx2 might be overly optimistic.  I've had no problems using CPUTYPE?=corei7 on my i5 machines (yes, that's correct), but /usr/share/examples/etc/make.conf says core-avx2 is for clang only.  That implies that it is less well tested than the gcc options.



Thank you for the answer. I tried a few installations and the last one using corei7-avx which was done a few minutes ago, fortunately worked for me. I'm using Clang in the base system, no GCC.


----------

