Skip to content

Instantly share code, notes, and snippets.

@derjohn
Last active March 27, 2024 19:05
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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.

@milanP96
Copy link

First of all thanks for sharing this.
But for me after reboot and choosing updater to boot fwupdmgr and lshw are still showing old version.

Reboot is final step or I'm missing something?

@derjohn
Copy link
Author

derjohn commented Jul 20, 2021

After the reboot there should appear a progress bar that indicates an upgrade process. Did it ?

@FeepingCreature
Copy link

FeepingCreature commented Jul 26, 2021

Worked for me, thanks a lot!

Note that <2019 BIOS 1.37 is actually 0.1.55.

@milanP96
Copy link

milanP96 commented Aug 3, 2021

After the reboot there should appear a progress bar that indicates an upgrade process. Did it ?

No, it just restarted system after choose updater on boot. I updated it with installing windows dual boot

@tczank
Copy link

tczank commented Dec 20, 2021

I'm getting this error firmware_packager.py: error: the following arguments are required: --version-format, --update-protocol

@secam
Copy link

secam commented Jan 3, 2022

yes,the same error for me
This one worked
firmware_packager.py --firmware-name HuaweiBIOS --device-guid --developer-name Huawei --release-version 65574 --version-format org.uefi.capsule --update-protocol number --exe ./BIOS_1.37.exe --bin ./UEFI_FW.bin --out firmware_bios_update.cab

note the --release-version parameter it is taken from
fwupdmgr get-devices
output for current version + 1, otherwise it wouldn't start the update
System Firmware:
│ │ Current version: 65573

firmware_packager.py is not installed with fwupd package, so I had to clone it from fwupd git repo (https://github.com/fwupd/fwupd) and it worked just fine specifying the full path to .py file

--version-format org.uefi.capsule
--update-protocol number
experimentally defined.

guid is for my laptop is represented with 3 values, I've taken the first one and it worked fine
There was also no "update mode" in UEFI screen, but after fwupdmgr install command the 2 disks appeared in the boot list, so I've disabled the first one, booted and seen the update progress bar.

@tczank
Copy link

tczank commented Jan 4, 2022

Thanks for the answer! I could generate the .cab, however now when I try to flash it I get Device System Firmware does not support number, only org.uefi.capsule, after that I tried the following:

  1. tried replacing --update-protocol number with --update-protocol org.uefi.capsule ended up getting Firmware version formats were different, device was 'number' and release is 'org.uefi.capsule'
  2. then I tried replacing --release-version 65544 with --release-version org.uefi.capsule ended up getting Specified firmware is older than installed 'org.uefi.capsule < 65543'

Edit

I could flash it after using these options to generate the cab:
--release-version 65544 --version-format number --update-protocol org.uefi.capsule
and allowing unsigned firmwares in /etc/fwupd/daemon.conf
However, after rebooting the BIOS version has not changed.

@tczank
Copy link

tczank commented Jul 25, 2022

Could conclude the update after recent version update (1.8.3-1)

@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