Skip to content

Instantly share code, notes, and snippets.

@eNV25
Last active December 13, 2024 03:59
Show Gist options
  • Save eNV25/c8001491dc0440656ff7b0ae18993ba1 to your computer and use it in GitHub Desktop.
Save eNV25/c8001491dc0440656ff7b0ae18993ba1 to your computer and use it in GitHub Desktop.
Instructions to Update the BIOS/UEFI for an HP Laptop on Linux

Instructions to Update the BIOS/UEFI for an HP Laptop on Linux

To update the BIOS/UEFI firmware requires HP-specific files in the EFI System Partition, also referred to as ESP.

On a Linux system, the ESP is typically mounted on /boot/efi or /efi. Whithin you should also find a EFI directory, e.g. /boot/efi/EFI or /efi/EFI. This article assumes that the ESP is mounted on /efi and that the /efi/EFI directory exists. You can replace that with the mount point your system uses.

The HP-specific files are located in /efi/EFI/HP or /efi/EFI/Hewlet-Packard. These files typically come preinstalled in HP Windows PCs. If you have these files you could skip Install HP-specific files.

Install HP-specific files

We can obtain the HP-specific files using HP's HP PC Hardware Diagnostics 4-IN-1 USB KEY installer. This installer contains the needed files. We can simply extract this installer and copy the needed files to the ESP

HP's installer only runs on Windows, but it is possible to extract it by running the self-extracting executable on Wine. You cannot simply extract the executable using 7-zip because the executable needs to do some file generation.

Download the executable. You can get the URL to the latest executable from HP's website.

$ wget https://ftp.hp.com/pub/softpaq/sp112501-113000/sp112853.exe

Run the executable using wine. This will extract its contents to ./sp112853.

$ wine sp112853.exe /s /e /f sp112853

Copy the HP-specific files to the the ESP.

# cp -r sp142721/field/{Hewlett-Packard,HP} /efi/EFI/

According to HP, this works for most hardware. For some cases you may need additional files. I have tired this with an HP Pavilion 13-an0008ne Laptop only, which required no additional steps.

Install BIOS update

You'll need to find you updated BIOS image. You can find one by going to HP's Software and Drivers page, and input your serial number. Make sure you select Windows as your Operating System, otherwise it may not show the updates.

These drivers often also come in Windows executables, you should run them in wine. The executable will first fail to install automatically. Then it will display different options on how to procede. Select the Copy option and select a directory where the BIOS image and the key file should be copied to.

$ wget https://ftp.hp.com/pub/softpaq/sp112501-113000/sp112516.exe
$ wine sp112516.exe /s /f sp112516           # extract and execute

Complete BIOS update using HP Hardware Diagnostics

There should be a .bin and an .s12 file. Copy these files to the ESP to the directory /efi/EFI/Hewlett-Packard/BIOS/New and /efi/EFI/HP/BIOS/New. Here I am using 084C5 as an example.

# mkdir /efi/EFI/Hewlett-Packard/BIOS/New
# cp sp112516/084C5{.bin,.s12} /efi/EFI/Hewlett-Packard/BIOS/New
# mkdir /efi/EFI/HP/BIOS/New
# cp sp112516/084C5{.bin,.s12} /efi/EFI/HP/BIOS/New

At this point you should have the needed HP-specific files and the BIOS update installed in the ESP. Now, you can actually complete the update.

Boot into firmware settings and press F2 to enter HP Hardware Diagnostics. You should be presented a menu and there should a menu entry named BIOS Management. Navigate to BIOS Management > Update BIOS. Your BIOS should start updating.

If you have enabled Secure Boot with custom keys, you will first need to sign the HP-specific .efi files.

Complete BIOS update using Win+B key combination

Sometimes the previous method does not work, and the BIOS Management option does not show up. You can alternatively copy the .bin and .s12 file to /efi/EFI/Hewlett-Packard/BIOS/Current or /efi/EFI/HP/BIOS/Current, and press Win-B while the PC is booting up. This key combination should cause a BIOS firmware recovery using the files you copied.

Also note that updating will re-enable Secure Boot if had it disabled. If so, you might want to disable it again. Your custom Secure Boot keys will be preserved.

@UbayGD
Copy link

UbayGD commented Jan 15, 2024

@UbayGD the later two files are digital signature of .bin blob. You just couldn't flash them instead of the right binary.

@UbayGD Just copy all of those files to the directory depending on the method.

The thing is that I have 3 .bin to flash and I'm afraid to select the wrong one :')

  • 089A0ME0.bin
  • 08A1EME0.bin
  • 08A1DME0.bin

@eNV25
Copy link
Author

eNV25 commented Jan 15, 2024

@UbayGD Where did these come from? Were all of these from your device specific BIOS update?

I think the HP PC Hardware Diagnostics 4-IN-1 USB KEY files should have a .csv file somewhere. That might help.

@dmitrmax
Copy link

@UbayGD use dmidecode tool. Its output contains Base Board Information section. There will be a Product Name that will contain one of these codes.

@eNV25 HPs has incompatible hardware in some models and has different BIOSes for them which should be matched by the product code.

@UbayGD
Copy link

UbayGD commented Jan 16, 2024

@UbayGD use dmidecode tool. Its output contains Base Board Information section. There will be a Product Name that will contain one of these codes.

Thank you very much! Browsing through all the information provided by dmidecode I have seen that one of the .bin starts with the product name of the laptop.

Wish me luck!

@mridlen
Copy link

mridlen commented Jan 22, 2024

Ok, so I ran into issues and this is my solution:

I needed to download 2 files:

  1. Download the HP PC Hardware Diagnostics UEFI for my system - this creates the bootable USB to run the firmware update
  2. Download the latest BIOS update for my system - this is the firmware payload

On my end I have both Windows and Linux so I am doing the Windows stuff on the Windows side.

  1. Create HP PC Hardware Diagnostics UEFI using the USB option (WIndows)
  2. Run the BIOS update and select extract files to location (Windows)
  3. Copy the extracted *.bin and *.sig files to HP/BIOS/New and Hewlett-Packard/BIOS/New on the USB stick (Windows)
  4. Boot laptop with ESC and select F2 Diagnostics menu
  5. If it takes a few moments, this is good because it is reading from USB
  6. GUI should appear (this is good because the previous was a text UI) - this means it is reading from the USB
  7. Select Firmware Update from the menu, and click through to install it
  8. BIOS update takes a long time... go get a cup of coffee. I am writing these instructions and it is only halfway done installing.

@DJCrashdummy
Copy link

It doesn't show any window, only messages in the terminal. It looks for a driver with a name that seems related to BIOS and then exits with an error.

@berarma if your terminal was full with something similar like this, i had and solved the same issue...

...
wine: Assertion failed at address 00007F6DB8CDD00B (thread 0032), starting debugger...
20 - Error: Unable to initialize memory manager
0015:err:service:process_send_command service protocol error - failed to write pipe!

thankfully i remembered that i had to state i'm using Windows 10 to be able to download the stupid exe-file... and i created a new wineprefix to be on the safe side and don't mess up my other wineprefixes by any chance.
but the default winver= is empty which is equal to winver=win7! so i set it to winver=win10 and it worked like a charm.

@DJCrashdummy
Copy link

Where did these come from? Were all of these from your device specific BIOS update?

@eNV25 yes, in my case there are 4 *.bin files with corresponding *.sig files...

use dmidecode tool. Its output contains Base Board Information section. There will be a Product Name that will contain one of these codes.

@dmitrmax unfortunately greping the name of all my files didn't give a result and even going through the whole output didn't give any hint.
...but i think i remember quite some time ago (when HP still provided a way to create a bootable stick on linux resp. independent from the OS) there were also more than one *.bin file for one of my notebooks and their guide said to copy all files to the stick.

-> so i copied all files to the New folders, and it worked fine.

@DJCrashdummy
Copy link

@eNV25 it seems, i found an alternative to the Win+B way:
i also had the issue of BIOS Management not showing up... but instead of rebooting and fiddling around with the files again, i knew it must be bootable. so i pressed F9 while booting to get to the boot priority menu. beside some entries to choose, at the bottom the line Boot From EFI File can be selected.
i looked a little bit around at HP resp. Hewlett-Packard and its subfolders and thanks to its meaningful names it was clear to use HpBiosUpdate.efi (attention: for nearly every *.efi file there is also a *32.efi file, which is - i'm pretty sure - only for 32bit-systems) and also fortunately this file was only present in one of the two folders.
so i chose Hewlett-Packard/BIOSUpdate/HpBiosUpdate.efi and instantly the BIOS update started... it took some time and even after the "initial flash" with a somewhat "nicer GUI" it rebooted and continued with a more "bare mettle TUI" (white text on black background) the flashing & verifying for at least further 6 or more parts.
after that it rebooted again and asked if i want to enable the TPM (to use Windows 11), but Secure Boot was deactivated and stayed so.
interestingly after the update i checked again and only one *.bin file with its corresponding *.sig file was gone resp. moved to the Current folder, but just in the HP/BIOS/ folder. in the Hewlett-Packard/BIOS/New folder still all 4 *.bin files with its *.sig files remained there.

i have no idea, if this is a proper way to do it, or if i just was lucky to get somewhere and not destroying this notebook.
maybe someone with a deeper knowledge regarding this process can confirm this method or advise against it.
beside that, it is still mysterious to me, why there are 2 folders HP and Hewlett-Packard which content is quite similar but not completely identical and the payload has to be copied to both of them. -> i would also appreciate some insight into that topic!

@eNV25
Copy link
Author

eNV25 commented Jan 31, 2024

@DJCrashdummy that's pretty cool. I had no idea.

I'm not updating this page because I haven't tried it yet.

@jsoques
Copy link

jsoques commented Feb 8, 2024

Why go through all this hassle when you can update the HP Bios through the bios settings itself? Am I missing something? I just updated the bios of my HP Elitedesk 705 G4 mini pc. The only requirement is that it be connected to the internet with the Ethernet cable.

@berarma
Copy link

berarma commented Feb 8, 2024

Why go through all this hassle when you can update the HP Bios through the bios settings itself? Am I missing something? I just updated the bios of my HP Elitedesk 705 G4 mini pc. The only requirement is that it be connected to the internet with the Ethernet cable.

I don't think this is possible with every model.

@jsoques
Copy link

jsoques commented Feb 9, 2024

Why go through all this hassle when you can update the HP Bios through the bios settings itself? Am I missing something? I just updated the bios of my HP Elitedesk 705 G4 mini pc. The only requirement is that it be connected to the internet with the Ethernet cable.

I don't think this is possible with every model.

Oh ok!

@dmitrmax
Copy link

dmitrmax commented Feb 9, 2024

Why go through all this hassle when you can update the HP Bios through the bios settings itself? Am I missing something? I just updated the bios of my HP Elitedesk 705 G4 mini pc. The only requirement is that it be connected to the internet with the Ethernet cable.

Because HP made a fetish out of it on the low end laptops by not including appropriate bios setting into the bios firmware

@rafaelrpinto
Copy link

Win+B did the trick on my HP Omen 15-en1004np upgrading from F.6 to F.24 Rev.A.
Thanks 👍

@alexey198233
Copy link

Easy way:
https://ftp.hp.com/pub/caps-softpaq/cmit/linuxtools/HP_LinuxTools.html
run depmod after build and load hpuefi. Dont foget provide password , otherwise you get error "Cannot transfer this image!"
Tested on hp probook 440g6 Ubuntu 22.04

@bretif
Copy link

bretif commented Sep 18, 2024

Method proposed by @alexey198233 works well on Ubuntu 24.04.
Easy and no problem at all

@alexey198233
Copy link

alexey198233 commented Sep 18, 2024

There is one more way. I will explain using the example of the HP Probook 440g6 firmware.

The BIOS downloaded from the HP website is not intended for direct flashing (in my case, this is the R71_012800.bin file). The utilities on the HP_TOOLS section are needed to create the firmware.bin file (add few bytes to the beginning of the file), not for flash. The EFI/HP/BIOS/New path apparently serves only to display information about the firmware, it does not need to be created for flashing (that is why, if you have no HP_TOOLS partition, it complains about the incorrect firmware file size because it is not on the required path ). The firmware itself is created by utilities, copied into the EFI/HP/DEVFW folder and then flashed.
The algorithm is as follows:

  1. Download exe archive with utilities and the BIOS archive inside.
  2. Unpack the archive, run the installation under Wine or VirtualBox.
  3. After running the utility, there will be a bunch of errors in the logs about the impossibility of creating a correct firmware.bin file, since there is no full access to the WMI interface,
    but the firmwareRecovery.bin file will be created - this is the bios file for the firmware. It is created during the launch of HpFirmwareUpdRec and is deleted when it is closed.
    Minimize HpFirmwareUpdRec, copy the firmwareRecovery.bin file and rename it to firmware.bin
  4. Mount the EFI partition and copy firmware.bin to the EFI/HP/DEVFW folder.
  5. Reboot, go to bios. The firmware will start automatically when you go to the bios / firmware update section.
    Before flashing, make sure that the downloaded bios file exactly for your model (the list of supported models you can found in the History.txt file).

@alexey198233
Copy link

Method proposed by @alexey198233 works well on Ubuntu 24.04. Easy and no problem at all

You can use this method also , Linux tools support limited devices.
https://gist.github.com/eNV25/c8001491dc0440656ff7b0ae18993ba1?permalink_comment_id=5195795#gistcomment-5195795

@dmitrmax
Copy link

dmitrmax commented Sep 18, 2024

  1. Download exe archive with utilities and the BIOS archive inside.
  2. Unpack the archive, run the installation under Wine or VirtualBox.

It seems to me that 7z can perfectly unpack those exe files under Linux. So no need for various emulators

@alexey198233
Copy link

  1. Download exe archive with utilities and the BIOS archive inside.
  2. Unpack the archive, run the installation under Wine or VirtualBox.

It seems to me that 7z can perfectly unpack those exe files under Linux. So no need for various emulators

Anyway you need emulator to run HpFirmwareUpdRec.exe , that util unpack main firmware archive (in my case R71_012800.bin > firmwareRecovery.bin). Better just run install directly from wine or under virtualbox and get firmwareRecovery.bin after that , just less move .

@alexey198233
Copy link

alexey198233 commented Sep 18, 2024

R71_012800.bin even not an archive , HpFirmwareUpdRec.exe just append few bites with extended info.

  1. Download exe archive with utilities and the BIOS archive inside.
  2. Unpack the archive, run the installation under Wine or VirtualBox.

It seems to me that 7z can perfectly unpack those exe files under Linux. So no need for various emulators

Anyway you need emulator to run HpFirmwareUpdRec.exe , that util unpack main firmware archive (in my case R71_012800.bin > firmwareRecovery.bin). Better just run install directly from wine or under virtualbox and get firmwareRecovery.bin after that , just less move .

@levicki
Copy link

levicki commented Sep 24, 2024

Can this help?

https://ftp.hp.com/pub/caps-softpaq/cmit/linuxtools/HP_LinuxTools.html

  The toolset is compatible with the following HP systems:
     2015 and newer HP Desktop Workstations
     2018 and newer HP business Notebooks and Desktops.

This utility will not work on platforms prior to those listed above.

@alexey198233
Copy link

Can this help?

https://ftp.hp.com/pub/caps-softpaq/cmit/linuxtools/HP_LinuxTools.html

  The toolset is compatible with the following HP systems:
     2015 and newer HP Desktop Workstations
     2018 and newer HP business Notebooks and Desktops.

This utility will not work on platforms prior to those listed above.

Help with what ? This is tool for flashing HP BIOS , but support limited models . What model you have ?

@levicki
Copy link

levicki commented Sep 26, 2024

Help with what?

With not having to use Wine.

This is tool for flashing HP BIOS , but support limited models.

Yes, I know. That's why I asked if it would be helpful to people commenting here.

What model you have?

HP ProBook 440 G7, should be supported by that tool, but I wasn't asking for myself.

Have you considered making a bootable WinPE image for flashing and adding the Windows flash tool to it instead of running it from Linux with emulation?

@alexey198233
Copy link

Help with what?

With not having to use Wine.

This is tool for flashing HP BIOS , but support limited models.

Yes, I know. That's why I asked if it would be helpful to people commenting here.

What model you have?

HP ProBook 440 G7, should be supported by that tool, but I wasn't asking for myself.

Have you considered making a bootable WinPE image for flashing and adding the Windows flash tool to it instead of running it from Linux with emulation?

Yes, you can use it directly. This is linux executable, but first you must build and load module hpuefi .

@alexey198233
Copy link

Have you considered making a bootable WinPE image for flashing and adding the Windows flash tool to it instead of running it from Linux with emulation?

Yes. But anyway windows HP flash tool try to find and mount HP_TOOL partition. If can't find it - offer to create, if i skip creation and try to flash, then got error "EFI flash not detected as supported".

image

I think it's because can't mount EFI partition . I don't now why , i have simple fat32 efi with correct flags , that normal mount in linux/mac os. I tryed to mount efi by hand and have same error. Also i have some WMI error in logs.

Used Windows 10 PE x64. Maybe its trouble with my assembly PE itself or because partition don't have windows specific directories, i don't have real windows on my laptop to check it.

I fork this manual .
https://gist.github.com/alexey198233/087a1a52d7a31b07bc4e114220561bac

Flashing very easy , and remember: wine is NOT an emulator :)

@levicki
Copy link

levicki commented Sep 26, 2024

Yes. But anyway windows HP flash tool try to find and mount HP_TOOL partition. If can't find it - offer to create, if i skip creation and try to flash, then got error "EFI flash not detected as supported".

Actually, according to your error log it also can't mount the ESP partition on drive T: (it is probably taken by RAM disk in default WinPE image). As for private WMI extension, that is probably installed by some chipset driver and drivers can be integrated in WinPE image too.

@alexey198233
Copy link

Yes. But anyway windows HP flash tool try to find and mount HP_TOOL partition. If can't find it - offer to create, if i skip creation and try to flash, then got error "EFI flash not detected as supported".

Actually, according to your error log it also can't mount the ESP partition on drive T: (it is probably taken by RAM disk in default WinPE image). As for private WMI extension, that is probably installed by some chipset driver and drivers can be integrated in WinPE image too.

I write about that under screenshot log.
T: is not taken at all.
This tool not mount partition on drive , Actually HP tool assign letter for partition, if it taken HP tool just use another letter, with same error.
Possible you can install drivers on flash drive with PE , make windows efi partition on linux system , but this is Instructions to Update the BIOS/UEFI for an HP Laptop under Linux and it's easy and quick.

@DaRandomCube
Copy link

so, how do i know which additional files i need and where do i place them?

@alexey198233
Copy link

so, how do i know which additional files i need and where do i place them?

you can read step by step manual here :
https://gist.github.com/alexey198233/087a1a52d7a31b07bc4e114220561bac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment