Reading Files in the EFI System Partition | UEFI Dev (in C)
Adding and using file protocols to read the EFI System Partition from within a booted EFI application.
Notes:
- An EFI "image" might only be the application itself, the metadata is only for and about the booted file/application. So I misspoke on that.
Links:
https://uefi.org/specifications (uefi & other specifications)
UEFI Programming playlist:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqZYHNLtOZ1MNxOt8myP5K0p
Git Repo:
https://github.com/queso-fuego/uefi-dev
Repo state at the start of this video:
git clone --recurse-submodules https://github.com/queso-fuego/uefi-dev
cd uefi-dev
git checkout 16e96d5fac523052c4918b47fa0bbbcaeff32fce
Repo state at the end of this video:
git checkout e90a7023a9b5fc93ba2335aa7bdc6883112921a8
Next video:
- Probably Block IO and maybe Disk IO protocols to see what block devices are available and to read files from a basic data partition.
Join the Community Discord: https://discord.gg/yKm4T89QFn
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:00 Intro, get loaded image protocol from spec
0:11:00 Add menu option to read ESP files, add file protocols from spec
0:33:33 Get root directory pointer
0:38:36 Add cleanup label, read root directory entries
0:51:24 Add input to navigate directories, add strncmp/strrchr/strcat functions
1:27:34 Add fixes for going up a directory
1:30:43 Allocate buffer for file
1:37:45 Read file into buffer
1:44:44 Print file contents
1:50:32 Potential things coming up & outro
Music credits:
Winter Night by Sakura Girl | https://soundcloud.com/sakuragirl_official
Music promoted by https://www.chosic.com/free-music/all/
Creative Commons CC BY 3.0
https://creativecommons.org/licenses/by/3.0/
#uefidev #cprogramming #files