Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*~ | ||
*.fd | ||
fs | ||
.EFI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |