Update HP BIOS settings in Linux

For a larger project, we had to update BIOS settings on a HP Z2 Mini G9 Workstation Desktop PC – from within Linux, that is. Now “BIOS” in essence is the firmware that is running before Linux is active. This means it is highly manufacturer dependent and you cannot – possibly – update the BIOS without a manufacturer supplied program to do that.

Is there such thing for HP? Turns out: there is! So now you can change any BIOS setting from within Linux. Also, for example, configuration settings to start the PC at a certain time or day, or to change power-on-button settings.

At https://ftp.hp.com/pub/caps-softpaq/cmit/linuxtools/HP_LinuxTools.html, HP supplies us with a nice .tgz file that contains several RPM’s and a few utilities that have been nicely compiled for other Linux distributions. Installation is rather easy:

wget https://ftp.hp.com/pub/softpaq/sp143001-143500/sp143035.tgz
tar -zxf sp143035.tgz
cd hpflash-3.22/
cd non-rpms/
tar -ztf hpuefi-mod-3.04.tgz
cd hpuefi-mod-3.04/
make
sudo insmod hpuefi.ko
sudo mknod -m 644 /dev/hpuefi c `grep hpuefi /proc/devices|cut -d ' ' -f 1` 0

So there we are: our kernel module has been loaded and a device is available. If we go back up one directory, you’ll notice that there is another tgz-file there, called hp-flash-3.22_x86_64.tgz. This is full of hp-flash utilities, compiled for several Linux-distributions. You can find, for example, hp-flash.u2204, hp-flash.rh610, hp-flash.sled15 among others. A nice install.sh script could help you put these in the /opt/hp/hp-flash/bin/ directory, should you be interested in that.

Now I’m actually quite lazy and not willing to clutter my system with proprietary HP utilities, so I will not run the installer script. The hp-repsetup utility is what is needed for BIOS functionality and as I’m running Ubuntu 22.04, I’ll just run the hp-repsetup.u2204 utility right from the builds/ directory.

After this, things are quite easy.

Reading all BIOS settings can be done with hp-repsetup.u2204 -a -g biosfile – where the -a option means “write ASCII”, the -g is for “get” and biosfile is where the output will be stored. If you leave the -a out, the output file is written as Unicode UCS-2, which can be edited by vi, but will not show up nicely in less.

Now you can edit the fields that you want to change, by editing the biosfile that you just created with an editor of choice. Simply put a * in front of options that you would like to enable. Then run hp-repsetup again, this time as hp-repsetup -a -s biosfile – where -a is still for ASCII and -s is for “set”. You don’t have to set everything at once, it is also possible to just change a single setting. For example, make a file /tmp/newsetting that only contains:

Wednesday
	*Enable

Then use hp-repsetup.u2204 -a -s /tmp/newsetting to just have the PC autostart on Wednesdays.

Important Wisdom: as far as I can see, the “language” setting does not interfere with the hp-repsetup BIOS output, i.e. if you change your BIOS language to Traditional Chinese, your settings in hp-repsetup will still be English. (Tip: should you want to test this yourself, please use a language that you can revert from without calling HP support!)

The hp-repsetup script (as opposed to the hp-repsetup.u2204 program that I’m running) does a few more things: it runs modprobe hpuefi.ko and re-runs the mknod command with a script that it (most likely) installed during install phase; afterwards, it unloads the hpuefi.ko kernel module from memory again.

As said, I did not install and I’m only doing this once, so I’m not too interested in putting this somewhere on the system, but your situation could be different.

Leave a Reply

Your email address will not be published. Required fields are marked *