Migrating BIOS Boot Order to Another UP Board

roar
roar New Member Posts: 9
edited October 2017 in UP board BIOS
Hi there

I have multiple UP Boards. What I am trying to accomplish is to set all the UP Boards to the same BIOS version, configuration and boot order programatically. I have successfully been able to make all the UP Boards have the same BIOS verison and configuration, however, I cannot seem to be able to make the boot order consistent on all of them. The BIOS version I am able to successfully update to is the BIOS version which supports PXE boot UPC1BM0X_EFI. As far as configuration is concerned, I am referring to all options except boot order. For example, quiet boot enabled and PXE boot for IPV4 enabled.

The UP Boards I am using all use the AMI Aptio V (five) BIOS. I know that you can export an image of your current BIOS by using the afuefix64.efi tool provided by American Megatrends by running:
afuefix64.efi exported.bin /O

You can then flash the BIOS of another machine using the same tool with different arguments:
afuefix64.efi exported.bin /P /B /N /L

The options above evaluate to:
- P: Program main bios image
- B: Program Boot Block
- N: Program NVRAM
- L: Program all ROM Holes

I have been using the documentation and update utility available at:
AMI_Aptio_5.x_AFU_User_Guide_NDA.pdf and BIOS update util

After doing this, I can update the BIOS on another UP Board and ensure the relevant settings are configured correctly (i.e. PXE boot enabled). This all happens automatically when the UP Boards boot from my USB drive by running my custom startup.nsh script. The only problem I have is that the boot order is not changed. I need all the UP Boards to have the correctly boot order.

I have been reading the Aptio V Boot Option Infrastructure Guide which mentions the high-level steps for how the boot options are managed:
The high level steps of the boot option maintenance process are:
• Previous boot order list is read from non-volatile storage
• Currently available boot devices are collected
• Collected boot devices are filtered
• Collected boot devices are matched to options in previous boot order
• New boot options are created and missing ones are purged
• Boot options in list are processed based upon OEM needs
• Boot option list is stored back to non-volatile storage

This led me to believe the Program NVRAM argument (/N) would allow me to manipulate the boot order list as it is stored in non-volatile storage (NVRAM), however, updating the BIOS using this argument will happily update every other BIOS setting except the boot order. Can someone please provide me with some tips to manipulate the boot order programatically?

Cheers.


Edit: I do see that if I power off the device and disconnect the RTC battery, the boot options are set to some default order and all other BIOS settings are reset to default values which is quite interesting. I wonder, am I able to edit this factory default boot order to whatever I like and also force reload this factory default through EFI shell and/or by adding a different flag when performing a firmware update. Just food for thought..

Comments

  • Jesse Kaukonen
    Jesse Kaukonen New Member Posts: 42 ✭✭

    Thank you for your research into this.

    I'm currently investigating the very same issue - automating BIOS updates and setting the boot order to prioritize IPv4 PXE.

    I can verify that with UPC1DM07 storing and restoring the BIOS preferences via the tool does not restore boot order while it seems to at least enable the network stack. For me using the /L option to fill ROM holes does not work as I get an error:

    bd - Error: Requested Rom Hole not available in ROM file.
    

    This happens even if I use /O to make a copy of the same ROM.

    I also tried to update a factory BIOS Up to the latest BIOS using this tool, hoping I could do everything in one go. This doesn't work, as attempting to restore the image gives:

    1e - Error: Secure Flash Function is not supported on this file.
    

    Updating the BIOS using the update tool from the Up downloads page works, and after this the ROM can be restored. This suggests that the Up BIOS updater avoids this security feature somehow?

  • Jesse Kaukonen
    Jesse Kaukonen New Member Posts: 42 ✭✭

    I wasn't able to copy the boot order myself, but I got the cloning task automated with some Clonezilla kernel boot parameters. I've listed them here: https://sourceforge.net/p/clonezilla/discussion/Clonezilla_live/thread/91888fe3/

  • roar
    roar New Member Posts: 9

    Nice one.

    My setup and problems are quite different to yours. However, for your information, I managed to find out the flags that allow me to change the BIOS options on my UPBoards programatically. I set the desired BIOS options on my UPBoard and use the afuefix64.efi tool to generate a .bin file representing my desired BIOS configuration as described in my last post.

    afuefix64.efi exported.bin /O

    I put this file on my USB drive. I set up my USB drive with a custom EFI shell (EFI/BOOT/BOOTx64.efi file) and have a custom startup.nsh script to automatically flash my BIOS with that .bin file ensuring the BIOS options (including boot order) are also set up. It took me a long time to find a EFI shell (EFI/BOOT/BOOTx64.efi file) with the necessary functionality for managing boot options CORRECTLY (efi tool to manage boot order: bcfg ) but I have now managed to flash the BIOS how I want.

    afuefix64.efi exported.bin /P /B /N /L /X /R

    On reboot, it boots to PXE, gets the deployment image I set up and is on its merry way. Note I use a completely different PXE server to you: https://forums.fogproject.org/

    If this sounds of use to you, I can put my USB files on Github so you can get an idea of one possible way to flash the BIOS with desired options across multiple devices by having USB drive plugged in when powered on.

    Regards.

  • Jesse Kaukonen
    Jesse Kaukonen New Member Posts: 42 ✭✭

    Excellent!

    We ended up doing our clone tasks differently, but your files sound like they might be useful at some point, at least to someone.

Privacy Policy