EFI System Partition | GPT Disk Image | UEFI Dev (in C)
Writing a basic FAT32 filesystem for an "/EFI/BOOT" folder structure, to fill out the EFI System Partition.
Errata:
- Probably should clear the top 4 bits of each FAT32 cluster, as the spec says to ignore or not mess with these bits,
but I haven't had any issues so far for EFI through QEMU or on hardware, so it seems to be fine?
Links:
https://uefi.org/specifications
https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system
https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx (EFI FAT Filesystem Spec)
UEFI Programming playlist:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqZYHNLtOZ1MNxOt8myP5K0p
Next video:
- Making functions to add files/directories to the EFI System Partition, and maybe starting command line flags after.
Git Repo:
https://github.com/queso-fuego/UEFI-GPT-image-creator
Repo state at the start of this video:
git clone -n https://github.com/queso-fuego/UEFI-GPT-image-creator
cd UEFI-GPT-image-creator
git checkout 9469347a4872e01e71429823c788ec95bbc7ddc2
Repo state at the end of this video:
git checkout 05593d731821417859a7777d3bd37d82b218df93
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 Intro / UEFI info on filesystem
3:48 FAT32 EFI spec & wikipedia page
8:11 Look at VBR layout
17:00 Add gpt_table_lbas to fix hardcoding
21:31 Start write_esp() function, add VBR struct
38:27 Look at FS Info sector layout, add FSInfo struct
43:42 Try to explain FAT cluster layout
53:09 Look at FAT info in the spec, explain minimum FAT32/ESP size
1:00:33 Write FAT Tables/clusters
1:08:36 Start FAT data region
1:11:51 Look at FAT Directory Entry in the spec
1:18:36 Write FAT directories, fix compile errors
1:45:41 Test in Qemu
1:48:17 Next 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/
#fat32 #diskimage #cprogramming