Hello UEFI!
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
build/
|
||||||
|
vdir/
|
||||||
|
.vscode/
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
MINGW_GCC = x86_64-w64-mingw32-gcc
|
||||||
|
QEMU = qemu-system-x86_64
|
||||||
|
MINGW_GCC_FLAGS = -Wall -Wextra -e efi_main -nostdinc -nostdlib -fno-builtin -Wl,--subsystem,10
|
||||||
|
|
||||||
|
all:
|
||||||
|
mkdir -p build
|
||||||
|
x86_64-w64-mingw32-gcc $(MINGW_GCC_FLAGS) -o build/BOOTX64.EFI boot.c
|
||||||
|
|
||||||
|
vdir: all
|
||||||
|
mkdir -p vdir
|
||||||
|
mkdir -p vdir/EFI/BOOT
|
||||||
|
cp build/BOOTX64.EFI vdir/EFI/BOOT
|
||||||
|
|
||||||
|
run: vdir
|
||||||
|
$(QEMU) -bios /usr/share/ovmf/OVMF.fd -net none -drive file=fat:rw:vdir,index=0,format=vvfat -serial stdio
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build vdir
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#define ull unsigned long long
|
||||||
|
|
||||||
|
struct EFI_SYSTEM_TABLE {
|
||||||
|
char _buf[60];
|
||||||
|
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
|
||||||
|
ull _buf;
|
||||||
|
ull (*OutputString)(
|
||||||
|
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
|
||||||
|
unsigned short *String);
|
||||||
|
ull _buf2[4];
|
||||||
|
ull (*ClearScreen)(
|
||||||
|
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This);
|
||||||
|
} *ConOut;
|
||||||
|
};
|
||||||
|
|
||||||
|
void efi_main(void *ImageHandle __attribute__ ((unused)), struct EFI_SYSTEM_TABLE *SystemTable)
|
||||||
|
{
|
||||||
|
SystemTable->ConOut->ClearScreen(SystemTable->ConOut);
|
||||||
|
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Hello UEFI!\n");
|
||||||
|
while (1);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user