Expanding WDS Functionality: Adding UEFI Boot Capability

Hi all!

This article describes the steps you need to follow to add UEFI boot capability to your WDS.

Those. The instructions in this article assume that you already have the following configuration:

1. Windows Server 2012R2 (ΠΈΠ»ΠΈ Π½ΠΎΠ²Π΅Π΅)
2. ΠŸΠΎΠ»Π½ΠΎΡΡ‚ΡŒΡŽ настроСнный DHCP для Ρ€Π°Π±ΠΎΡ‚Ρ‹ с WDS
3. БобствСнно сам WDS
4. IIS
5. Π’ΠΈΡ€Ρ‚ΡƒΠ°Π»ΡŒΠ½Π°Ρ машина ΠΈΠ»ΠΈ ПК с Ubuntu

Also, here are described actions that did not bring me the proper result.
I described them to facilitate the search and save your time.

foreword

I made a WDS at work with a lot of goodies, tk. tired of constantly running around with a bunch of flash drives and overwriting them.

These articles helped me by the way:
Adding WDS Versatility
PXE boot menu with System Center Configuration Manager


It looks like this

Expanding WDS Functionality: Adding UEFI Boot Capability

And everything was fine, new images were added for loading, the winPE image was overgrown with new features and everything worked.

But, far from all devices support the BIOS / Legacy boot mode, or if they do, then its inclusion may be in a very non-obvious place.

Yes, and installing windows in legacy mode, when it is possible to install in UEFI, is not cool.

As a result, I decided to add the ability to boot into UEFI, and went to Google.

But I did not find structured information on how to get a working WDS + UEFI.
Actually, that's why I decided to write this article.

Before I start, I will describe the problem that took the most time.

When adding UEFI to WDS, the following, rather non-obvious situation is possible:

If you add a boot file to WDS and when you try to boot on the device
in UEFI you see the following text:
The selected boot device failed. Press <Enter> to Continue.
Or Boot Device Not Found
But loading in legacy works for you.
Then one of the possible options is the absence of a file wdsmgfw.efi,
on the following path: %WDSpath%Bootx64wdsmgfw.efi

You can take it here: C:WindowsSystem32RemInstbootx64wdsmgfw.efi
Or, if for some reason this file is missing for you, I posted it on google.
For this solution, thanks guys from reddit.

With this problem, I killed the most time, because. I thought the problem was somewhere in the WDS or DHCP configuration.

Configured policies by adding Vendor Classes for various architectures, and configuring DHCP options 060, 066, 067. Instructions for configuring DHCP policies.

Architectures in ASCII for configuring DHCP

PXEClient:Arch:00000 - BIOS/Legacy
PXEClient:Arch:00006 - UEFI x86
PXEClient:Arch:00007 - UEFI x64

Also, I tried various options for boot files. .efi

  • syslinux
  • grubs 2

I also tried to find the problem in the Event Log.
win + r -> eventvwr -> Π–ΡƒΡ€Π½Π°Π»Ρ‹ ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠΉ ΠΈ слуТб -> Microsoft -> Windows -> Deployment-Services-Diagnostics

But, as I said above, the problem lay in the file wdsmgfw.efi.
Either I accidentally deleted it myself, or it was not copied during installation
and configuring WDS.

Well, let's get started!

Instructions

Stage 1 - Verify that WDS is working

Take any device or virtual machine with support for booting in UEFI mode over the network and try to boot.

You should have the following picture:

Expanding WDS Functionality: Adding UEFI Boot Capability

If so, great, you can continue.
If not, then see what I wrote in the preface.

Stage 2 - Building the iPXE Boot File

We launch pre-prepared Ubuntu, open a terminal and paste this line:

git clone https://git.ipxe.org/ipxe.git ipxe

Expanding WDS Functionality: Adding UEFI Boot Capability

Here I would like to make a small remark that you may have to add packages to Ubuntu that are necessary for compiling C and C ++.
I just have them installed.

Downloaded? - Great!
Now you need to make a configuration file for the assembly.
In the terminal, we write:

cd ipxe/src
gedit chain.ipxe

And paste the following code into this file, and then save:

#!ipxe

dhcp
chain http://%IP-address-your-IIS-server%/install.ipxe

We go back to the terminal and start the compilation:

make bin-x86_64-efi/ipxe.efi EMBED=chain.ipxe

Expanding WDS Functionality: Adding UEFI Boot Capability

If everything is in order, then you should get the following output in the terminal:

Expanding WDS Functionality: Adding UEFI Boot Capability

And file ipxe.efi, along the way: ipxe/src/bin-x86_64-efi/ipxe.efi
If for some reason you can't compile on your own,
I have attached mine file.
It is compiled to boot from http://192.168.0.100/install.ipxe

That's all for Ubuntu.

Step 3 - Adding ipxe.efi to WDS

We take the file that we received in the second stage and copy it along the way:
%WDSpath%Bootx64%your-boot-folder%EFIBOOT
After we rename it to BOOTX64.EFI.
It's not necessary, it's just more convenient.

Then we launch cmd on behalf of the administrator, and write the following commands:

wdsutil /set-server /bootprogram:Bootx64%your-boot-folder%EFIBOOTBOOTX
64.EFI /architecture:x64uefi
ΠΈ
wdsutil /set-server /N12bootprogram:Bootx64%your-boot-folder%EFIBOOTBOOTX
64.EFI /architecture:x64uefi

This will set the resulting file to be downloaded via WDS.

Let's check the configuration:

wdsutil /get-server /Show:Config

Expanding WDS Functionality: Adding UEFI Boot Capability

I also copied the ipxe.efi file, renamed it BOOTIA32.EFI and configured boot for it, just in case. architecture:x86uefi
But by and large, this makes no sense, because. Bootmgfw.efi file does not support x86

Let's check what happened.
Expanding WDS Functionality: Adding UEFI Boot Capability
Great, WDS sends our file for download and it, in turn, looks for the configuration along the path: http://192.168.0.100/install.ipxe

Step 4 - Menu Configuration

Go to the root folder of your site.
The default is: C:inetpubwwwroot

Create a text file install.ipxe.

and configure it according to documentation and your needs.
There is also a Russian language description commands.
I enjoyed this instructions when configuring your WDS.

install.ipxe configuration example

#!ipxe

:start
menu Please choose an operating system to start/install
item --gap Start Win PE
item WinPE-x64 WinPE x64
item --gap ipxe shell
item shell       Drop to iPXE shell

choose target && goto ${target}

:failed
echo Booting failed, dropping to shell
goto shell

:shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start

:WinPE-x64
kernel http://192.168.0.100/wimboot
initrd http://192.168.0.100/peSE/Boot/bcd
initrd http://192.168.0.100/peSE/Boot/boot.sdi
initrd http://192.168.0.100/peSE/Boot/peSE64.wim
boot || goto failed

You can read about the configuration for loading winPE here.

Stage 5 - MIME types

After creating the menu and adding all the necessary files to the IIS root folder,
you need to give them access.

Because even if you try to download a file from the browser, you will get an error at its address: HTTP 404.3 - Not Found.
Expanding WDS Functionality: Adding UEFI Boot Capability

To do this, you need to add MIME types in the IIS control panel, in accordance
with file extensions that you will download via http.

I did not look for which MIME type is best for this purpose, and asked application/octet-stream, after which everything worked.

For files that don't have an extension, use a dot.

Like this:

Expanding WDS Functionality: Adding UEFI Boot Capability

Conclusion

Ultimately, we get the ability to boot over a local network through UEFI.

If we did everything correctly, then there will be something like this boot selection menu:

Expanding WDS Functionality: Adding UEFI Boot Capability

If you have prepared the basic tools and you will not bother with the configuration, then it takes about 10-20 minutes to implement this feature.
It took me 2 working days, because. I had to google a lot.

Successful implementation!

Thank you for your attention and many thanks to those people whose articles helped me!
On HabrΓ© it is: Ingtar ΠΈ Deeptown.

Source: habr.com

Add a comment