Skip to content
Permalink
Browse files
Initial commit
  • Loading branch information
cupnes committed Jan 1, 2017
0 parents commit 6fd7c23
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 0 deletions.
@@ -0,0 +1,4 @@
*~
*.fd
fs
.EFI
@@ -0,0 +1,14 @@
struct EFI_SYSTEM_TABLE {
char _buf[60];
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
void *_buf;
unsigned long long (*OutputString)(struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *, unsigned short *);
} *ConOut;
};

int DllMainCRTStartup(void *ImageHandle __attribute__ ((unused)), struct EFI_SYSTEM_TABLE *SystemTable)
{
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Hello UEFI!\n");
while (1);
return 0;
}
@@ -0,0 +1,13 @@
all: fs/EFI/BOOT/BOOTX64.EFI

fs/EFI/BOOT/BOOTX64.EFI: BOOTX64.c
mkdir -p fs/EFI/BOOT
x86_64-w64-mingw32-gcc -Wall -Wextra -nostdlib -Wl,--subsystem,10 -o $@ $<

run: fs/EFI/BOOT/BOOTX64.EFI
qemu-system-x86_64 -nographic -bios OVMF.fd -hda fat:fs

clean:
rm -rf *~ fs

.PHONY: clean
@@ -0,0 +1,17 @@
struct EFI_SYSTEM_TABLE {
char _buf1[24];
unsigned short *FirmwareVendor;
char _buf2[28];
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
void *_buf;
unsigned long long (*OutputString)(struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *, unsigned short *);
} *ConOut;
};

int DllMainCRTStartup(void *ImageHandle __attribute__ ((unused)), struct EFI_SYSTEM_TABLE *SystemTable)
{
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Hello UEFI!\r\n");
SystemTable->ConOut->OutputString(SystemTable->ConOut, SystemTable->FirmwareVendor);
while (1);
return 0;
}
@@ -0,0 +1,13 @@
all: fs/EFI/BOOT/BOOTX64.EFI

fs/EFI/BOOT/BOOTX64.EFI: BOOTX64.c
mkdir -p fs/EFI/BOOT
x86_64-w64-mingw32-gcc -Wall -Wextra -nostdlib -Wl,--subsystem,10 -o $@ $<

run: fs/EFI/BOOT/BOOTX64.EFI
qemu-system-x86_64 -nographic -bios OVMF.fd -hda fat:fs

clean:
rm -rf *~ fs

.PHONY: clean
@@ -0,0 +1,39 @@
struct EFI_INPUT_KEY {
unsigned short ScanCode;
unsigned short UnicodeChar;
};

struct EFI_SYSTEM_TABLE {
char _buf1[44];
struct EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
void *_buf;
unsigned long long (*ReadKeyStroke)(struct EFI_SIMPLE_TEXT_INPUT_PROTOCOL *, struct EFI_INPUT_KEY *);
} *ConIn;
void *_buf2;
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
void *_buf;
unsigned long long (*OutputString)(struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *, unsigned short *);
} *ConOut;
};

int DllMainCRTStartup(void *ImageHandle __attribute__ ((unused)), struct EFI_SYSTEM_TABLE *SystemTable)
{
struct EFI_INPUT_KEY efi_input_key;
unsigned short str[3];

while (1) {
if (!SystemTable->ConIn->ReadKeyStroke(SystemTable->ConIn, &efi_input_key)) {
if (efi_input_key.UnicodeChar != L'\r') {
str[0] = efi_input_key.UnicodeChar;
str[1] = L'\0';
} else {
str[0] = L'\r';
str[1] = L'\n';
str[2] = L'\0';
}
SystemTable->ConOut->OutputString(SystemTable->ConOut, str);
}
}

return 0;
}
@@ -0,0 +1,13 @@
all: fs/EFI/BOOT/BOOTX64.EFI

fs/EFI/BOOT/BOOTX64.EFI: BOOTX64.c
mkdir -p fs/EFI/BOOT
x86_64-w64-mingw32-gcc -Wall -Wextra -nostdlib -Wl,--subsystem,10 -o $@ $<

run: fs/EFI/BOOT/BOOTX64.EFI
qemu-system-x86_64 -nographic -bios OVMF.fd -hda fat:fs

clean:
rm -rf *~ fs

.PHONY: clean

0 comments on commit 6fd7c23

Please sign in to comment.