Code Monkey home page Code Monkey logo

uefisettings's Introduction

linuxboot

The LinuxBoot project allows you to replace your server's firmware with Linux.

Supported server mainboards

  • qemu emulated Q35 systems
  • Intel S2600WF
  • Dell R630
  • Winterfell Open Compute node (works well)
  • Leopard Open Compute node (works well)
  • Tioga Pass Open Compute node (works well)
  • Monolake Open Compute node (not tested)

Build instructions

Make sure you have installed the dependencies uuid-dev, nasm, and acpica-tools (or equivalent for your distribution).

You need to provide:

  • The vendor UEFI firmware for the mainboard
  • A Linux kernel built with the CONFIG_EFI_BDS option enabled
  • An initrd.cpio file with enough tools to kexec the rest of the system.

For the initrd, the Heads firmware or u-root systems work well. Both will build minimal runtimes that can fit into the few megabytes of space available.

For everything except qemu, you'll need to copy the vendor ROM dump to boards/$(BOARD)/$(BOARD).rom. Due to copyright restrictions, we can't bundle the ROM images in this tree and you must supply your own ROM from your own machine. qemu can built its own ROM from the edk2 tree, so this is not necessary.

Configure the build system:

cp path/to/s2600wf.rom boards/s2600wf/
make \
	BOARD=s2600wf \
	KERNEL=../path/to/bzImage \
	INITRD=../path/to/initrd.cpio.xz \
	config
make

This will write the values into the .config file so that you don't need to specify them each time. If all goes well you will end up with a file in build/$(BOARD)/linuxboot.rom that can be flashed to your machine. It will take a while since it also clones the LinuxBoot patched version of tianocore/edk2 UDK2018 branch and build it.

Emulating with qemu

If you want to experiment with LinuxBoot you can run it under qemu. No ROM file is necessary, although you still need a Heads or NERF runtime kernel/initrd pair. You can launch the emulator by running:

make run

This will use your current terminal as the serial console, which will likely mess with the settings. After killing qemu by closing the window you will need to run stty sane to restore the terminal settings (echo is likely turned off, so you'll have to type this in the blind).

Adding a new mainboard

Copy Makefile.board from one of the other mainboards and edit it to match your new board's ROM layout. The qemu one is not the best example since it has to match the complex layout of OVMF; most real mainboards are not this messy.

You'll need to figure out which FVs have to be preserved, how much space can be recovered from the ME region, etc. The per-board makefile needs to set the following variables:

  • FVS: an ordered list of IFD, firmware volumes and padding
  • linuxboot-size: the final size of the ROM image in bytes (we should verify this against the real ROM instead)

More info

uefisettings's People

Contributors

facebook-github-bot avatar orangecms avatar stepancheg avatar xaionaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uefisettings's Issues

Dealing with "provided value did not match any possible option"

Thanks for this tool. I'm trying to change my BIOS setting to restore power after external power is lost (it's a remote server, so it is difficult to go hook up a KB and monitor to do this).

The server is running an Asrock AB350 motherboard, and I can see a few relevant parameters in the output of uefisettings hii show-ifr:

        OpCode: Form
            OpCode: Subtitle - S: 
                OpCode: EqIdVal
                OpCode: OneOf - Q: Restore On AC Power Loss - Help: Restore Status On AC Power Loss
                -Range8(Range8 { min_value: 1, max_value: 2, step: 0 })
                -Answer: Unknown
                    OpCode: OneOfOption - S: Power On
                    -ValueType:0
                    -Value:NumSize8(1)
                    OpCode: OneOfOption - S: Power Off
                    -ValueType:0
                    -Value:NumSize8(2)
                OpCode: OneOf - Q: GPIO Devices Support - Help: Enable/Disable GPIO ACPI Devices Support, disable it will disable i2C and uart interface device.
                -Range8(Range8 { min_value: 1, max_value: 255, step: 0 })
                -Answer: Unknown
                    OpCode: OneOfOption - S: Enabled
                    -ValueType:0
                    -Value:NumSize8(1)
                    OpCode: OneOfOption - S: Auto
                    -ValueType:0
                    -Value:NumSize8(255)

Likewise, in the list-strings output, I see that "Restore On AC Power Loss" as well:

            469: "Restore On AC Power Loss",
            470: "Restore Status On AC Power Loss",

If I get that value, it gives the following output:

$ sudo uefisettings hii get "Restore On AC Power Loss"
GetResponseList {
    responses: [
        GetResponse {
            selector: "899407D7-99FE-43D8-9A21-79EC328CAC21",
            backend: Backend::Hii,
            question: Question {
                name: "Restore On AC Power Loss",
                answer: "Unknown",
                options: [],
                help: "Restore Status On AC Power Loss",
            },
            is_translated: false,
        },
    ],
}

But if I try to set the value to one of the options indicated by show-ifr, I get an error:

$ sudo uefisettings hii set "Restore On AC Power Loss" "Power On"
{"error_message":"provided value did not match any possible option"}

I assume this is because there are no options allowed in the Question output above. Is there any way to set this value on my motherboard, or is this just likely unsupported?

Thanks for your help.

This is on a Linux (TrueNAS scale) system:

$ uname -a
Linux truenas 6.1.55-production+truenas #2 SMP PREEMPT_DYNAMIC Tue Oct 31 16:07:08 UTC 2023 x86_64 GNU/Linux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.