Skip to content

Instantly share code, notes, and snippets.

@derjohn
Last active March 27, 2024 19:05
Show Gist options
  • Save derjohn/2c19554415cea09830225314c2072807 to your computer and use it in GitHub Desktop.
Save derjohn/2c19554415cea09830225314c2072807 to your computer and use it in GitHub Desktop.
Update your Huawei Matebook Pro X (and others) from the Linux shell with fwupd

Huawei Matebook BIOS update with Linux

Tested with Huawei Matebook X Pro (MACH-WX9) This is more or less a step by step tutorial, written 02/2021. Sadly at the moment Huawei does not ship a package in Linux Vendor Firmware Service.

WARNING

Please note that you can damage ("brick") your device if something goes wrong or is done incorrectly. This is for the advanced user! I can only say that I flashed the new firmware 0.1.33 to my MACH-WX9 successfully.

Original docs

dennemann.blog THX!!!

Identify your Device (with lshw)

sudo apt install lshw
sudo lshw
...
       description: Motherboard
       product: MACH-WX9  # <=== !!!
       vendor: HUAWEI
...
     *-firmware
          description: BIOS
          vendor: HUAWEI
          physical id: 0
          version: 1.18
          date: 08/30/2018

Side-Note: BIOS version of firmware 0.1.24 does not match the firmware version. With firmware 0.1.33 Huawei shipped also BIOS 1.33.

Install Firmware Packager

sudo apt install fwupd # the packager script is shipped with the fwupd package, at least with the package in Ubuntu Bionic.
sudo apt install gcab p7zip-full python3

Fetch current firmware for your Matebook

Firmware Download URLs

Firmware GUID

fwupdmgr get-devices
MACH-WX9 System Firmware
  Guid:                 085c293a-051a-4cc2-b0a5-0ddb7105fdbf

Packaging Step

Find the UEFI FD File

Important: You need to tell the packager where to find the UEFI Flash Descriptor ("FD"). The location changed since 0.1.24, now with 0.1.33 you find it like this:

7z x MateBook_X_Pro_BIOS_1.33.zip
cd MateBook_X_Pro_BIOS_1.33/
7z x MateBook_X_Pro_BIOS_1.33.zip
7z x MHIKR133.exe
7z x BIOS_1.33.exe

There it is: UEFI_FW.bin

Check, if there is an FD file layout inside:

7z l UEFI_FW.bin

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
                    .....        19328        19328  .text
                    .....          608          608  UEFI_FW
                    .....          224          224  .xdata
                    .....      7521664      7521664  .reloc
                    .....         1456         1456  CERTIFICATE
------------------- ----- ------------ ------------  ------------------------
                               7543280      7543280  5 files

Create .cab file with the firmware

/usr/share/fwupd/firmware-packager --firmware-name HuaweiBIOS --device-guid 085c293a-051a-4cc2-b0a5-0ddb7105fdbf --developer-name Huawei --release-version 0.1.33 --exe ./BIOS_1.33.exe --bin ./UEFI_FW.bin --out firmware_bios_update.cab

Using temp directory ... 
Extracting firmware exe
Locating firmware bin
Creating metainfo
Cabbing firmware files
Done

Flash step

sudo fwupdmgr install ./firmware_bios_update.cab 
Decompressing…           [***************************************]
Authenticating…          [***************************************]
Installing on MACH-WX9 System Firmware…                          ]
Scheduling…              [***************************************]

An update requires a reboot to complete. Restart now? [Y|n]:

Then the system needs to be rebooted and F12 must be pressed, to choose booting the updater, which is located on the NVME (EFI Partition) in the menu.

@bliof
Copy link

bliof commented Dec 28, 2022

The upgrade seems to work with the 2022 model as well.

I've upgraded from 1.10 to 1.28. Just the files are a bit different.

[root@fedora HUAWEI_MateBook_X_Pro_2022_12th_Gen_Core_BIOS_1.28]# /usr/share/fwupd/firmware_packager.py --firmware-name HuaweiBIOS --device-guid ................................... --developer-name Huawei --release-version 65553 --version-format number --update-protocol org.uefi.capsule --exe ./BIOS_P02-02W-04A_1.28.exe --bin ./UEFI_FW.bin --out firmware_bios_update.cab

and had to change the /etc/fwupd/daemon.conf like this:

# Only support installing firmware signed with a trusted key
OnlyTrusted=false

@korotin
Copy link

korotin commented Jan 24, 2023

@bliof which device-guid did you use?

fwupdmgr get-devices shows two GUIDs for my MXP 2022. I think that I should pick one that marked as main-system-firmware, but I want to be sure :)

Thanks!

@splinehip
Copy link

splinehip commented Apr 13, 2023

Update MateBook X pro 2022 1.26 to 1.28 - update is fine, but now cant boot because Secure Boot is always enabled state. If i changed to Disabled - save end exit - it state enabled again. And bootable devices section hdd id showing twice.

Solution:
SECURE BOOT:
Unplug all usbs devices
Restore bios to default
Change bios date (idk why)
Restart disable secure boot

HDD TWICE:
Set to Disabled HDD device in bottom section (list devices allowed to display in boot priority section)
Save and Exit
Revert to Enable

@exioz
Copy link

exioz commented Mar 16, 2024

God bless @derjohn and @bliof, Matebook 16's BIOS has been successfully upgraded, windows-way wasn't work.
@korotin, I used 1st one.

@derjohn
Copy link
Author

derjohn commented Mar 27, 2024

@exioz THX for the kudos <3 <3 <3

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