# uefi **Repository Path**: vingen/uefi ## Basic Information - **Project Name**: uefi - **Description**: uefi-clang These are incomplete and you should probably use the official headers from [Tianocore](https://www.tianocore.org/). - **Primary Language**: C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-11-18 - **Last Updated**: 2026-01-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: UEFI, EDK2, tianocore ## README # uefi-clang ### c flags for uefi clang ``` Makefile CFLAGS = -target x86_64-pc-win32-coff -fno-builtin -ffreestanding -fno-stack-protector -fshort-wchar -mno-red-zone CLDFLAGS = -flavor link -subsystem:efi_application -entry:efi_main CC = clang LD = lld # CFLAGS += -I ./uefi # CSRCS += ./uefi/uefi.c ``` ### usage of 'uefi-helper' 0. install clang qemu make 1. include uefi_helper.h and uefi_helper.c into your project. 2. add 'init_helper(imageHandle, systemTable);" into efi_main before your other code. ``` c #include #include EFI_STATUS EFIAPI efi_main(EFI_HANDLE imageHandle, EFI_SYSTEM_TABLE *systemTable) { EFI_STATUS status = EFI_SUCCESS; init_helper(imageHandle, systemTable); // enable uefi helper. CleanScreen(); Println(L"Hello UEFI Application!"); if(EFI_ERROR(status)){ EPrintln("Some error message."); return StatusOut(status); // print uefi status error message. } /* othe code */ return status; } ``` ### example ``` make -C example run ``` -- -- ## UEFI headers ### Base on [Github: yoppeh/efi](https://github.com/yoppeh/efi) Requires . These are incomplete and you should probably use the official headers from [Tianocore](https://www.tianocore.org/). You could build a "Hello World" application just by including and using the declarations there. Everything needed to reference the *Boot Services*, *Runtime Services*, *Configuration Table*, *System Table* and base types are included in . Using protocols requires including the appropriate protocol header. The naming convention for the include filename is to use the name of the structure, as it appears in the UEFI specification, and naming the file using the first letter of each component of the structure name. For example, the *EfiGraphicsOutputProtocol* is defined in *protocol/efi-gop.h*. Please let me know of any mistakes. I'm also willing to add things as a favor. As it stands, I've only included components that I'm actually using. -- -- ``` ────uefi. ├── uefi.h ├── uefi_helper.c ├── uefi_helper.h ├── efi.h ├── efi-bs.h ├── efi-ct.h ├── efi-rs.h ├── efi-st.h ├── efi-time.h ├── protocol │ ├── efi-acpitp.h │ ├── efi-dpp.h │ ├── efi-fp.h │ ├── efi-gop.h │ ├── efi-lidpp.h │ ├── efi-lip.h │ ├── efi-sfsp.h │ ├── efi-sio.h │ ├── efi-stip.h │ ├── efi-stop.h │ └── efi-vmpp.h │ ├── example │ ├── hello.c │ ├── Makefile │ └── startup.nsh │ ├── LICENSE └── README.md ```