Hello World for EFI
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.
- Have
cmakein your PATH. - Make sure GNU EFI is installed on your system.
- Clone this repository and have a terminal in the root of it.
mkdir buildcd buildcmake -DWITH_GOP=1 -DWITH_TESTS=1 ..(orcmake -G Ninja ..if you have Ninja installed).make(orninjaif you used-G Ninjain 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
- Set up a new VM. It does not matter too much what settings you pick at this point.
- In the VM settings, under System, check Enable EFI (special OSes only).
- For storage, ‘insert’ the
hello.isofile. - Boot up the VM. You will see the EFI shell start to boot.
- When the shell shows a prompt, type
fs0: - 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.