File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ * ~
2+ * .fd
3+ fs
4+ .EFI
Original file line number Diff line number Diff line change 1+ struct EFI_SYSTEM_TABLE {
2+ char _buf [60 ];
3+ struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
4+ void * _buf ;
5+ unsigned long long (* OutputString )(struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * , unsigned short * );
6+ } * ConOut ;
7+ };
8+
9+ int DllMainCRTStartup (void * ImageHandle __attribute__ ((unused )), struct EFI_SYSTEM_TABLE * SystemTable )
10+ {
11+ SystemTable -> ConOut -> OutputString (SystemTable -> ConOut , L"Hello UEFI!\n" );
12+ while (1 );
13+ return 0 ;
14+ }
Original file line number Diff line number Diff line change 1+ all : fs/EFI/BOOT/BOOTX64.EFI
2+
3+ fs/EFI/BOOT/BOOTX64.EFI : BOOTX64.c
4+ mkdir -p fs/EFI/BOOT
5+ x86_64-w64-mingw32-gcc -Wall -Wextra -nostdlib -Wl,--subsystem,10 -o $@ $<
6+
7+ run : fs/EFI/BOOT/BOOTX64.EFI
8+ qemu-system-x86_64 -nographic -bios OVMF.fd -hda fat:fs
9+
10+ clean :
11+ rm -rf * ~ fs
12+
13+ .PHONY : clean
Original file line number Diff line number Diff line change 1+ struct EFI_SYSTEM_TABLE {
2+ char _buf1 [24 ];
3+ unsigned short * FirmwareVendor ;
4+ char _buf2 [28 ];
5+ struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
6+ void * _buf ;
7+ unsigned long long (* OutputString )(struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * , unsigned short * );
8+ } * ConOut ;
9+ };
10+
11+ int DllMainCRTStartup (void * ImageHandle __attribute__ ((unused )), struct EFI_SYSTEM_TABLE * SystemTable )
12+ {
13+ SystemTable -> ConOut -> OutputString (SystemTable -> ConOut , L"Hello UEFI!\r\n" );
14+ SystemTable -> ConOut -> OutputString (SystemTable -> ConOut , SystemTable -> FirmwareVendor );
15+ while (1 );
16+ return 0 ;
17+ }
Original file line number Diff line number Diff line change 1+ all : fs/EFI/BOOT/BOOTX64.EFI
2+
3+ fs/EFI/BOOT/BOOTX64.EFI : BOOTX64.c
4+ mkdir -p fs/EFI/BOOT
5+ x86_64-w64-mingw32-gcc -Wall -Wextra -nostdlib -Wl,--subsystem,10 -o $@ $<
6+
7+ run : fs/EFI/BOOT/BOOTX64.EFI
8+ qemu-system-x86_64 -nographic -bios OVMF.fd -hda fat:fs
9+
10+ clean :
11+ rm -rf * ~ fs
12+
13+ .PHONY : clean
Original file line number Diff line number Diff line change 1+ struct EFI_INPUT_KEY {
2+ unsigned short ScanCode ;
3+ unsigned short UnicodeChar ;
4+ };
5+
6+ struct EFI_SYSTEM_TABLE {
7+ char _buf1 [44 ];
8+ struct EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
9+ void * _buf ;
10+ unsigned long long (* ReadKeyStroke )(struct EFI_SIMPLE_TEXT_INPUT_PROTOCOL * , struct EFI_INPUT_KEY * );
11+ } * ConIn ;
12+ void * _buf2 ;
13+ struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
14+ void * _buf ;
15+ unsigned long long (* OutputString )(struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * , unsigned short * );
16+ } * ConOut ;
17+ };
18+
19+ int DllMainCRTStartup (void * ImageHandle __attribute__ ((unused )), struct EFI_SYSTEM_TABLE * SystemTable )
20+ {
21+ struct EFI_INPUT_KEY efi_input_key ;
22+ unsigned short str [3 ];
23+
24+ while (1 ) {
25+ if (!SystemTable -> ConIn -> ReadKeyStroke (SystemTable -> ConIn , & efi_input_key )) {
26+ if (efi_input_key .UnicodeChar != L'\r' ) {
27+ str [0 ] = efi_input_key .UnicodeChar ;
28+ str [1 ] = L'\0' ;
29+ } else {
30+ str [0 ] = L'\r' ;
31+ str [1 ] = L'\n' ;
32+ str [2 ] = L'\0' ;
33+ }
34+ SystemTable -> ConOut -> OutputString (SystemTable -> ConOut , str );
35+ }
36+ }
37+
38+ return 0 ;
39+ }
Original file line number Diff line number Diff line change 1+ all : fs/EFI/BOOT/BOOTX64.EFI
2+
3+ fs/EFI/BOOT/BOOTX64.EFI : BOOTX64.c
4+ mkdir -p fs/EFI/BOOT
5+ x86_64-w64-mingw32-gcc -Wall -Wextra -nostdlib -Wl,--subsystem,10 -o $@ $<
6+
7+ run : fs/EFI/BOOT/BOOTX64.EFI
8+ qemu-system-x86_64 -nographic -bios OVMF.fd -hda fat:fs
9+
10+ clean :
11+ rm -rf * ~ fs
12+
13+ .PHONY : clean
You can’t perform that action at this time.
0 commit comments