Flashing UEFI from Ubuntu directly?

Is there a way to flash a motherboard from UEFI from Ubuntu directly? I downloaded an exe from HP.com and ran the self-extractor from Wine. It failed when trying to put it on a USB key. Here is the directory structure after I run the .exe and extract it with Wine.

sp57762/
├── BiosUpdate
│   ├── CryptRSA32.efi
│   ├── CryptRSA.efi
│   ├── HpBiosUpdate32.efi
│   ├── HpBiosUpdate32.s09
│   ├── HpBiosUpdate32.s12
│   ├── HpBiosUpdate32.sig
│   ├── HpBiosUpdate.efi
│   ├── HpBiosUpdate.s09
│   ├── HpBiosUpdate.s12
│   └── HpBiosUpdate.sig
├── FirmwareUpdate.exe
├── FreeDOS
│   ├── KERNEL.SYS
│   └── kernels.zip
├── hpqFlash.exe
├── HPUSBFW.exe
├── Installer.exe
├── KERNELS.ZIP
├── ROM.CAB
├── Rompaq
│   ├── 68AHH.BIN
│   ├── config.sys
│   ├── EROMPAQ.EXE
│   ├── EROMPAQ.zip
│   ├── gpl2.txt
│   └── KERNEL.SYS
└── WSSP57762.rtf

I just want to know if I can meaningfully throw the 68AHH.BIN or the .efi at the underlying hardware and get something more useful.

Background

I have an HP laptop, the instructions to flash the bios are not applicable. My BIOS simply lacks File > Flash System ROM, just like this guy. I can boot the HpBiosUpdate.efi from the EFI, but that also doesn't work and it gives me an error though different from the one he got:

The System Bios Update Failed

I tried multiple different methods, including this one.


I don't know of a general way to flash HP consumer machine firmware directly from Linux, but as a second-best, it is at least possible on the machine that I needed to update (an HP Envy 700-060ea) without the use of Windows (e.g. with only Linux installed on the machine).

First I extracted the HP softpaq:

wine Downloads/sp72302.exe /e /f z:hpbios

... and then extracted files from the self-extracting zip exe:

cd hpbios && unzip Kai_8024.exe

I examined the hpbios/Flash.bat which was amongst the files extracted...

The batch file included a commandline which updates the Intel ME firmware with the file ME9_1482.BIN. The HP tool included the Windows ME flashing tool "FWUpdLcl.exe", but it should be possible to flash the same file with Intel's EFI flash tool (FWUpdLcl.efi) from the UEFI shell.

Newer ME versions can also be updated directly from Linux using the Linux flashing tool from the "Intel CSME System Tools" FWUpdate/LINUX64/FWUpdLcl, but I wasn't able to find an equivalent for ME 9.x systems.

The main BIOS file in this case is called KAI_8024.bin - I copied this to the efi boot partition into the EFI/HP/BIOS/New/ folder then I then rebooted the machine (into an EFI shell) and ran the EFI binary: EFI/HP/BiosUpdate/HpBiosUpdate.efi from the shell command line.

n.b. instead of using the EFI shell, you can probably run it directly from grub using the chainloader command with the appropriate path to HpBiosUpdate.efi, followed by the boot command.

To obtain the EFI shell (open source included in the TianoCore project, as well as various forks), you can use one of the many online tutorials to either install an EFI shell boot entry from grub, or create a bootable USB drive etc. I used: https://github.com/tianocore/edk/blob/master/Other/Maintained/Application/UefiShell/bin/x64/Shell_Full.efi ).

n.b. The EFI/HP/BiosUpdate/ directory was factory-installed, but you can probably find a suitable copy in an HP support file download (e.g. see the original question for a possible source - although I don't know if there are different versions of HpBiosUpdate.efi for different machine types).

HpBiosUpdate.efi looks for a firmware update file in EFI/HP/BIOS/New/ and writes out a log file at EFI/HP/BiosUpdate/HpBiosUpdate.log with debug messages, as well as displaying a simple mouse-driven GUI. After the flashing was completed, the machine power cycled several times, and then after booting Linux, the expected new BIOS version 80.24 was displayed in the output of dmidecode under Linux (previously 80.13 was installed).

The log file is reasonably clear and useful, so I recommend viewing that file from Linux, to check that the contents look sensible.