In this project, we were responsible for developing a UEFI program functioning as a file system explorer. Our primary goal was to design a user interface that allows for easy navigation and interaction with files and directories in the UEFI environment. This project involved a detailed study of UEFI specifications and understanding the principles of developing related applications. Utilizing the protocols available in the UEFI file system, we integrated files and directories. Additionally, developing the user interface, adding advanced features like file searching, filtering, and sorting, and developing error management mechanisms to handle potential exceptions and errors were part of the challenges of this project. Finally, we conducted extensive testing and validation of the program in various scenarios.
Before starting, ensure your Linux distribution has the following packages installed:
- NASM (Netwide Assembler): An assembler and disassembler for the Intel x86 architecture.
- IASL (Intel ACPI Compiler/Decompiler): Used for Advanced Configuration and Power Interface (ACPI).
- UUID-Dev (Universally Unique ID Library): Essential for generating unique identifiers in UEFI.
- Python 3: Necessary for running build infrastructure scripts.
Run the following commands in your terminal:
sudo apt-get install -y nasm iasl uuid-dev python3 sudo apt-get install -y python3-distutils
git clone https://github.com/tianocore/edk2 cd edk2 git submodule update --init
-
Compile C Programs: EDK2 utilizes a combination of Python scripts and C programs located in the BaseTools directory.
make -C BaseTools
This command builds tools and libraries under BaseTools/Source/C/bin and BaseTools/Source/C/libs.
-
Tool Wrappers and User Manuals:
- EDK2 offers comprehensive wrappers for the use of build tools on both Linux and Windows platforms. For detailed guidance, refer to the corresponding directories within the EDK2 repository.
- User manuals for various build tools are located under
BaseTools/UserManuals
.
-
Initialize Environment: Source the
edksetup.sh
script:. edksetup.sh
-
Building EDKII: Use the
build
command to compile EDKII packages.
-
Building OVMF: Execute the following command to build OVMF:
build --platform=OvmfPkg/OvmfPkgX64.dsc --arch=X64 --buildtarget=RELEASE --tagname=GCC5
Note: GCC version 5 or higher is required.
-
Locating Build Artifacts: The build artifacts can be found in the directory structure:
Build/{Platform Name}/{TARGET}_{TOOL_CHAIN_TAG}/FV
.
- Users interact with the program through a command-line interface, issuing commands for file system operations.
ls
: List files and directories in the current directory.ls -n
: List files and directories sorted by name.rm
: Remove files or directories.mkdir
: Create a new directory.cd
: Change the current directory.nano
: Text editor for file editing or creating a new file.info
: Display information about a file or directory.cat
: Display the contents of a file.copy
: Copy files or directories.cut
: Cut (move) files or directories.paste
: Paste copied or cut files or directories.search
: Search for files or directories by name.quit
: Exit the program.
- The application is developed using the EDK II (EFI Development Kit II) framework, which provides a development environment for UEFI applications.
- File system interactions are performed using the EFI_FILE_PROTOCOL, a standard protocol for UEFI file system operations.
- QEMU (Quick EMUlator) is utilized as the UEFI environment for running and testing the application.
For in-depth information on the implementation details of each feature, please refer to our thorough documentation available in the "Documents" directory. The documentation provides comprehensive insights into the design choices, coding practices, and specific functionalities of each command implemented in this UEFI application.
-
Install QEMU: To install QEMU on your system, run the following command in the terminal:
sudo apt-get install qemu-system-x86_64
-
Running OVMF in QEMU: To run OVMF with QEMU, use the following command:
qemu-system-x86_64 -drive if=pflash,format=raw,readonly,file=Build/OvmfX64/RELEASE_GCC5/FV/OVMF_CODE.fd -drive if=pflash,format=raw,file=Build/OvmfX64/RELEASE_GCC5/FV/OVMF_VARS.fd -nographic -net none