linuxboot / uefisettings

The tool to read/get/extract and write/change/modify BIOS/UEFI settings from Linux terminal.
BSD 3-Clause "New" or "Revised" License
35 stars 3 forks source link
bios blobstore change dump get hii hiidb hpe ilo modify ocp read script settings uefi write

uefisettings

About

uefisettings is a tool to read and write BIOS settings on a local host. It currently supports two interfaces:


Install

cargo install uefisettings

Build manually

cd /tmp
git clone https://github.com/linuxboot/uefisettings
cd uefisettings
cargo install --path .
~/.cargo/bin/uefisettings --help

Usage examples

Reset TPM

uefisettings hii set 'Pending operation' 'TPM Clear'

Check if TXT is enabled

if [[ "$(uefisettings hii get --json 'Enable Intel(R) TXT' | jq -r '.responses | .[].question.answer')" = "Enable" ]]; then
    # Do something if TXT is enabled
fi

Available commands

SUBCOMMANDS:
    get         Auto-identify backend and get the current value of a question
    help        Print this message or the help of the given subcommand(s)
    hii         Commands which work on machines exposing the UEFI HiiDB
    identify    Auto-identify backend and display hardware/bios-information
    ilo         Commands which work on machines having HPE's Ilo BMC
    set         Auto-identify backend and set/change the value of a question

hii:

SUBCOMMANDS:
    extract-db      Dump HiiDB into a file
    get             Get the current value of a question
    help            Print this message or the help of the given subcommand(s)
    list-strings    List all strings-id, string pairs in HiiDB
    set             Set/change the value of a question
    show-ifr        Show a human readable representation of the Hii Forms

ilo:

SUBCOMMANDS:
    get                Get the current value of a question
    help               Print this message or the help of the given subcommand(s)
    set                Set/change the value of a question
    show-attributes    List bios attributes and their current values

Changing UEFI settings with automation

To change BIOS settings from Linux terminal there are usually next ways available:

But this tool is an unified opensource approach to manipulate UEFI settings on any platform.


How it works

For OCP hardware

For HPE hardware

The opensource ilorest study results are published in doc/ilorest.md.


Update Thrift files

If one needs to update a file inside thrift directory then:

  1. Install fbthrift compiler: cargo install fbthrift_compiler && (sudo dnf install -y fbthrift || sudo apt install -y fbthrift)
  2. Update the .thrift file.
  3. Run ~/.cargo/bin/compiler path/to/updated/file.thrift.
  4. Run mv lib.rs path/to/generated/rust/file.rs.

For example:

# Install fbthrift compiler
cargo install fbthrift_compiler
sudo dnf install -y fbthrift

# Update file
vi thrift/uefisettings_spellings_db.thrift

# Re-generate the rust file from the thrift file.
cargo install fbthrift_compiler
~/.cargo/bin/compiler thrift/uefisettings_spellings_db.thrift
mv lib.rs thrift/rust/uefisettings_spellings_db_thrift/uefisettings_spellings_db.rs