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.
Optionally install cdrtools so an ISO can be generated.
- Have
cmake
in your PATH. - Make sure GNU EFI is installed on your system.
- Clone this repository and have a terminal in the root of it.
mkdir build
cd build
cmake -DWITH_GOP=1 -DWITH_TESTS=1 ..
(orcmake -G Ninja ..
if you have Ninja installed).make
(orninja
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.
- 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.iso
file. - 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.
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.