Adding Files / Directories to the ESP | GPT Disk Image | UEFI Dev (in C)
Channel: Queso Fuego
Date: 2023-06-05

Making a couple functions to add files & directories to the EFI System Partition

Errata:
The paths visually show with an ending slash e.g. "Added '/EFI/BOOT/BOOTX64.EFI/'. The file is added correctly, but the path isn't ended with a null to replace the slash put in by the loop. That's fixed now in the repo, but wasn't fixed until the end of this disk image series.

Notes:
- It might be good to uppercase letters in the 8.3 directory names as well, instead of assuming the user will use only uppercase names.

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:
- Adding command line flags/options for settings sizes of things and adding files to the ESP and Data partitions.

Git Repo:
https://github.com/queso-fuego/UEFI-GPT-image-creator
https://codeberg.org/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 05593d731821417859a7777d3bd37d82b218df93

Repo state at the end of this video:
git checkout ff1a4bea046fb6c6e53cc9610ecbcf107eeed38b

Join the Community Discord: https://discord.gg/yKm4T89QFn

Contact:
https://queso_fuego.codeberg.page/contact.html

Support:
https://queso_fuego.codeberg.page/support.html

Questions about setup/software/etc.? 
Check the FAQ: https://queso_fuego.codeberg.page/about.html

Outline:
0:00 Intro / plan
6:20 Start coding, check if BOOTX64.EFI is in current directory
9:50 New function to add path to ESP
29:36 New function to add file to ESP
1:01:39 Debugging
1:09:17 Convert names to 8.3
1:22:09 Basic qemu test
1:23:57 Add dskimg.inf file to /EFI/BOOT
1:36:04 Debug making new directories in ESP

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