Skip to content

Tatsh/hello-world-efi

Repository files navigation

Hello World for EFI

GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) QA Tests Coverage Status pre-commit Stargazers

@Tatsh Mastodon Follow

This is based on Roderick W. Smith's Creating a "Hello, World" Program. The primary difference is the use of CMake as the build system.

How to build

Optionally install cdrtools so an ISO can be generated.

  1. Have cmake in your PATH.
  2. Make sure GNU EFI is installed on your system.
  3. Clone this repository and have a terminal in the root of it.
  4. mkdir build
  5. cd build
  6. cmake -DWITH_GOP=1 -DWITH_TESTS=1 .. (or cmake -G Ninja .. if you have Ninja installed).
  7. make (or ninja if you used -G Ninja in the previous step)

If hello.iso was generated, use it on an UEFI system that has a shell (many do not) or emulator such as VirtualBox.

How to run in VirtualBox

  1. Set up a new VM. It does not matter too much what settings you pick at this point.
  2. In the VM settings, under System, check Enable EFI (special OSes only).
  3. For storage, 'insert' the hello.iso file.
  4. Boot up the VM. You will see the EFI shell start to boot.
  5. When the shell shows a prompt, type fs0:
  6. Type hello.efi. You should see Hello, world! and be returned to a prompt.

How to run tests

In the build directory, run ctest or ./general_tests. These run on the host operating system, not in the EFI environment. test.c demonstrates how to mock the gnu-efilib with CMocka.

Contributors 2

  •  
  •