# UEFI shell



## balanga (Mar 16, 2017)

I have recently acquired a  Z83 mini computer on which I would like to run FreeBSD.

I've tried setting the BIOS to boot from USB but haven't managed so far... There are options for booting from various USB sources, as there is for LAN/PXE, but none of them seem to prevent Windows from booting...Now I'm trying to figure out if I can do anything using the UEFI shell, but that is a complete mystery at the moment. Just wondered if there is a FreeBSD guide to using UEFI. And whether I can start the boot process from the UEFI shell by selecting a particular device to boot from.


----------



## balanga (Mar 16, 2017)

Seems I posted this twice - couldn't work out how to delete the second copy...


----------



## Phishfry (Mar 16, 2017)

EFI shell is pretty useless from what I see.

Please link to your box. Is this the one from amazon you asked about previously?

Some things to consider:
32bit EFI on some inexpensive Windows 10 boxes.
FreeBSD only supports 64bit EFI -but I saw a post here where somebody got 32bit EFI working using grub2 bootloader I believe.

Have you tried a Ubuntu live stick? It might give you some clues as to the hardware details.
The upboard uses an Z8350 and boots.
https://forums.freebsd.org/threads/56565/#post-329315

I have some boards with a bad EFI bios and started debugging by using FreeBSD 32 bit version as it does not have EFI support.
So your checking if the box will run in legacy mode. I would wipe the Windows 10 install after imaging a backup. I could see it overtaking the boot order.
Is the bios real basic? What is the bios maker?


----------



## balanga (Mar 16, 2017)

BIOS - Aptio Setup Utility - American Megatrends - version BT3 0.18 x64

CPU Intel Atom x5-Z8350 CPU @ 1.44G

Product Name           Z83 II
Manufacturer Name   AZW

http://www.ebay.co.uk/itm/291767100131?_trksid=p2057872.m2749.l2649&ssPageName=STRK:MEBIDX:IT

I'm not sure how I would image a backup or restore for that matter...


----------



## Phishfry (Mar 16, 2017)

WinPE is what I use for offline Windows backup. Bootable thumbdrive with imaging tools.

Try the FreeBSD 32bit memstick install image and see if you can boot it.


----------



## asteriskRoss (Mar 16, 2017)

What are you trying to boot from?  A FreeBSD UEFI memstick image?  Can you see the install media in the list of boot options?

If you can't successfully set the boot device from the UEFI boot menu then it may be that the UEFI shell won't help.  However, the shell is very powerful and should allow you to manipulate the boot order.  Have a look at the UEFI shell specification [PDF].  In the "Shell Commands" section you will see a description of the bcfg command:


			
				http://www.uefi.org/sites/default/files/resources/UEFI_Shell_2_2.pdf said:
			
		

> Examples:
> 
> To display boot options:
> Shell> bcfg boot dump
> ...



The first stage UEFI boot loader for FreeBSD is /boot/boot1.efi, which I expect you will find on the EFI partitition of the install media as /EFI/BOOT/BOOTX64.EFI.  This is one of the default locations in which the UEFI BIOS should look for a bootloader.  Try adding this location on the FreeBSD install media as a boot option.  You can remove it later using the UEFI BIOS menu or the UEFI shell.

Phishfry: The Atom x5 Z8350 is 64-bit.


----------



## Phishfry (Mar 16, 2017)

A bit of background: The previous version of these tiny HTPC boxes also used an 64bit cpu(Z37xx), but it shipped with a 32bit EFI firmware because it was cheaper for licensing purposes.. This was all about Windows10 and licensing.

So I am wondering if this is the same issue. Then next gen of these Windows10 boxes using an 32bit EFI on x64.

Just something you have to consider when troubleshooting.
https://forums.freebsd.org/threads/58751/#post-336036


----------



## balanga (Mar 17, 2017)

Following advice above, I created a USB stick with FreeBSD-11.0-RELEASE-amd64-mini-memstick.img and it actually showed up in the boot options, so some progress.... 

I get the Beastie logo and boot process starts, but halts with

```
ppc0: cannot reserve I/O port range
```

That means nothing to me, but its a start...


----------



## asteriskRoss (Mar 17, 2017)

Phishfry, thanks for the information.  I've not seen a 32-bit UEFI implementation in the wild but you piqued my interest.  Perhaps it is because I have a looming work deadline   I found an interesting Intel blog posting on the subject: Why Cheap Systems Run 32-bit UEFI on x64 Processors.

balanga, I'm not sure how to easily and definitively tell whether your UEFI implementation is 32-bit or 64-bit.  The ver UEFI shell command might do it.  It would be possible to write a UEFI shell application but that seems rather complicated.  Given that the FreeBSD first stage UEFI loader is executing I am hopeful it is 64-bit.

I believe that ppc(4) is the parallel port driver.  Try disabling it for now (I appreciate you may want to actually get it working later) by escaping to the loader prompt and typing:

```
set hint.ppc.0.disabled="1"
boot
```
References: ppc(4), device.hints(5), loader(8)


----------



## balanga (Mar 17, 2017)

Thanks for the suggestion, however I think it is only a warning msg, since doing what you mention the boot process stops at exactly the same place except with the ppc0 msg.. just after 

```
atkbd0: [GIANT-LOCKED]
```

I did manage to successfully boot up Linux Mint, so I'm sure I'll get FreeBSD booting eventually, when I find the right incantations ...


----------



## Phishfry (Mar 18, 2017)

Why not test the FreeBSD-11 32-bit memstick installer (i386 not amd64) in live mode.
Unless you have bad internet it should take all of 5 minutes.
The ram cant be upgraded so why is 64-bits important. Get it running first then do the bling thing.

Wasn't there a hint on the upboard I posted. It is uart related but worth a shot. Another loader setting to try.
https://forums.freebsd.org/threads/56565/#post-329315
ppc problem as well...


----------

