Intro / Overview | UEFI Dev (in C)

Queso Fuego
Queso Fuego
Intro, setup, and hello world program to start programming for x86_64 EFI applications. We'll be writing a program to make G ...
Intro, setup, and hello world program to start programming for x86_64 EFI applications.
We'll be writing a program to make GPT disk images with an EFI system partition and basic data partition, and an OS loader EFI application for an operating system bootloader.
Everything will follow official specifications and documentation for UEFI, ACPI, FAT32, etc. as much as possible.
Hopefully this will show that UEFI isn't mysterious or complex, and is actually nice to program for, assuming your machines support it.
I'll try to explain all code as I'm typing it up and reading the docs. Expect some long, boring videos unless I suddenly become really funny or great at editing.

UEFI dev playlist:
UEFI Programming in C

Git Repo:
https://github.com/queso-fuego/uefi-dev

Repo state as of this video (with slight makefile changes):
git clone --recurse-submodules https://github.com/queso-fuego/uefi-dev
cd uefi-dev
git checkout 9f65a7b05543bc42c43a12baec3b5cb878cf4a37

Videos for the EFI application (BOOTX64.EFI) will update this repo, after the gpt disk image videos are done.

Notes:
- wchar_t and L"" string literals are not needed, and I don't like them much due to wide characters being 16 bit on windows and 32 bit on linux by default. UTF-16 can be used directly with C11 or later, with u"" string literals and char16_t from uchar.h. If you have errors with uchar.h or don't want to use it, you can use 'typedef uint_least16_t char16_t;' and cast string literals to (char16_t *)"" to get the C11+ standard UTF-16 type.

- You can of course write EFI applications in other languages, even assembly. The system table pointer is passed to an efi entry point in RDX (see UEFI 2.10 spec section 2.3.4.1). Calling conventions seem to follow Microsoft's x86_64 calling convention/abi.
I recommend flat assembler (fasm) for writing assembly: https://flatassembler.net/. It's small, fast, and has built-in PE file & EFI subsystem support!

- I may make an .iso creator program in the future as an alternative to the GPT hard disk image creator. The ISO9660 and El Torito specs are public and freely available, but look a lot more involved than GPT images which are only a couple structs & arrays for the MBR and GPT headers & tables.

Misc links:
https://en.wikipedia.org/wiki/UEFI
https://uefi.org/specifications
https://uefi.org/uefi
https://en.cppreference.com/w/c/strin...
https://www.unicode.org/faq/utf_bom.h...
https://gcc.gnu.org/onlinedocs/gcc/St... (look at included freestanding headers e.g. stdint.h)
https://en.wikipedia.org/wiki/Red_zon...
https://www.qemu.org/download/
https://github.com/tianocore/tianocor...
https://www.kraxel.org/repos/jenkins/...
https://www.7-zip.org/
https://nuwen.net/mingw.html
https://github.com/skeeto/w64devkit
https://github.com/queso-fuego/UEFI-G... (this will be rewritten in upcoming videos)
https://rufus.ie/en/

Alternatively, for C development on Windows:
https://www.mingw-w64.org/downloads/ (gcc/mingw)
https://releases.llvm.org/download.html (clang/LLVM)
https://www.msys2.org/
https://www.cygwin.com/
or WSL/WSL2

https://github.com/sainnhe/everforest (neovim colorscheme)
https://www.sumatrapdfreader.org/free... (fast/minimal pdf reader for windows)

Join the Community Discord: Discord: discord

Next video(s):
- Starting a C program to create valid GPT hard disk images, including an EFI system partition with FAT32 filesystem, which will boot an EFI application in emulation and on real hardware.

Contact:
https://queso_fuego.srht.site/contact.html

- Let me know if there's anything specific you'd like to see!

Questions about setup/software/etc.?
Check the FAQ: https://queso_fuego.srht.site/about.html

Outline:
0:00 intro/overview
6:30 dev tools for linux & windows
27:47 example EFI application, BOOTX64.EFI
38:58 test on qemu
41:00 test on hardware (laptop)
42:51 wrapping up/coming up

Music credits:
Winter Night by Sakura Girl | SoundCloud: sakuragirl_official
Music promoted by https://www.chosic.com/free-music/all/
Creative Commons CC BY 3.0
https://creativecommons.org/licenses/...

#uefi #x86_64 #intro

همه توضیحات ...