• Stars
    star
    497
  • Rank 88,652 (Top 2 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

EFI FileSystem drivers

EfiFs - EFI File System Drivers

Build status Build status Build status Build status Github stats
Release Licence

This is a GPLv3+ implementation of standalone EFI File System drivers, based on the GRUB 2.0 read-only drivers.

For additional info as well as precompiled drivers, see https://efi.akeo.ie

Requirements

  • Visual Studio 2022 (Windows), MinGW (Windows), gcc (Linux) or EDK2.
  • A git client able to initialize/update submodules
  • QEMU v2.7 or later if debugging with Visual Studio (NB: You can find QEMU Windows binaries here)

Compilation

Common

  • Fetch the git submodules with git submodule init and git submodule update.
    NOTE This only works if you cloned the directory using git.
  • Apply 0001-GRUB-fixes.patch to the grub\ subdirectory. This applies the changes that are required for successful compilation of GRUB.

Visual Studio (non EDK2)

  • Open the solution file and hit F5 to compile and debug the default driver.

gcc (non EDK2)

  • Run make in the top directory. If needed you can also issue something like make ARCH=<arch> CROSS_COMPILE=<tuple> where <arch> is one of ia32, x64, arm, aa64 or riscv64 (the official UEFI abbreviations for an arch, as used in /efi/boot/boot[ARCH].efi) and <tuple> is the one for your cross-compiler, such as arm-linux-gnueabi- or aarch64-linux-gnu-. e.g. make ARCH=aa64 CROSS_COMPILE=aarch64-linux-gnu-

EDK2

  • Open an elevated command prompt and create a symbolic link called EfiFsPkg, inside your EDK2 directory, to the EfiFs source. On Windows, from an elevated prompt, you could run something like mklink /D EfiFsPkg C:\efifs, and on Linux ln -s ../efifs EfiFsPkg.
  • From a command prompt, set Grub to target the platform you are compiling for by invoking:
    • (Windows) set_grub_cpu.cmd <arch>
    • (Linux) ./set_grub_cpu.sh <arch>
      Where <arch> is one of ia32, x64, arm, aarch64 or riscv64.
      Note that you MUST invoke the set_grub_cpu script every time you switch target.
  • After having invoked edksetup.bat (Windows) or edksetup.sh (Linux) run something like:
    build -a X64 -b RELEASE -t <toolchain> -p EfiFsPkg/EfiFsPkg.dsc
    
    where <toolchain> is something like VS2022 (Windows) or GCC5 (Linux).
    NB: To build an individual driver, such as NTFS, you can also use something like:
    build -a X64 -b RELEASE -t <toolchain> -p EfiFsPkg/EfiFsPkg.dsc -m EfiFsPkg/EfiFsPkg/Ntfs.inf
    
  • A Windows script to build the drivers, using EDK2 with VS2022 is also provided as edk2_build_drivers.cmd.

Testing

If QEMU is installed, the Visual Studio solution will set up and test the drivers using QEMU (by also downloading a sample image for each target file system). Note however that VS debugging expects a 64-bit version of QEMU to be installed in C:\Program Files\qemu\ (which you can download here). If that is not the case, you should edit .msvc\debug.vbs accordingly.

For testing outside of Visual Studio, make sure you have at least one disk with a target partition using the target filesystem, that is not being handled by other EFI filesystem drivers. Then boot into the EFI shell and run the following:

  • load fs0:\<fs_name>_<arch>.efi or wherever your driver was copied
  • map -r this should make a new fs# available, eg fs2:
  • You should now be able to navigate and access content (in read-only mode)
  • For logging output, set the FS_LOGGING shell variable to 1 or more
  • To unload use the drivers command, then unload with the driver ID

Visual Studio 2022 and ARM/ARM64 support

Please be mindful that, to enable ARM/ARM64 compilation support in Visual Studio 2022, you MUST go to the Individual components screen in the setup application and select the ARM compilers and libraries there, as they do NOT appear in the default Workloads screen:

VS2022 Individual Components

Additional Notes

This is a pure GPLv3+ implementation of EFI drivers. Great care was taken not to use any code from non GPLv3 compatible sources, such as rEFInd's fsw_efi (GPLv2 only) or Intel's FAT driver (requires an extra copyright notice).

Note however that some files (the non grub_#### sources under ./src/) are licensed under GPLv2+ rather than GPLv3+ and that, just like the GPLv3+ sources, we took great care of ensuring that we are fully compliant with any licensing or relicensing matters, so that they can legally be reused into GPLv2+ works.

Bonus: Commands to compile EfiFs using EDK2 on a vanilla Debian GNU/Linux 10.x

sudo apt install nasm uuid-dev gcc-multilib gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi gcc-riscv64-linux-gnu
git clone --recurse-submodules https://github.com/tianocore/edk2.git
cd edk2
make -C BaseTools
git clone --recurse-submodules https://github.com/pbatard/efifs.git EfiFsPkg
cd EfiFsPkg/grub
git apply ../0001-GRUB-fixes.patch
cd -
export GCC5_ARM_PREFIX=arm-linux-gnueabi-
export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
export GCC5_RISCV64_PREFIX=riscv64-linux-gnu-
source edksetup.sh --reconfig
./EfiFsPkg/set_grub_cpu.sh X64
build -a X64 -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc
./EfiFsPkg/set_grub_cpu.sh IA32
build -a IA32 -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc
./EfiFsPkg/set_grub_cpu.sh AARCH64
build -a AARCH64 -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc
./EfiFsPkg/set_grub_cpu.sh ARM
build -a ARM -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc
./EfiFsPkg/set_grub_cpu.sh RISCV64
build -a RISCV64 -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc

More Repositories

1

rufus

The Reliable USB Formatting Utility
C
26,912
star
2

Fido

A PowerShell script to download Windows or UEFI Shell ISOs
PowerShell
2,212
star
3

libwdi

Windows Driver Installer library for USB devices
C
1,738
star
4

uefi-ntfs

UEFI:NTFS - Boot NTFS or exFAT partitions from UEFI
C
723
star
5

UEFI-Shell

UEFI Shell binary images, generated from EDK2 stable
242
star
6

bootimg-tools

Android boot.img creation and extraction tools [NOTE: This project is NO LONGER maintained]
C
156
star
7

winpatch

Windows system file patcher
C
62
star
8

fasmg-ebc

An EFI Byte Code (EBC) assembler, based on fasmg
Assembly
38
star
9

rufus-web

https://rufus.ie homepage and locale tracker
HTML
37
star
10

ffs

For F@%k's sake - it's a MODULE!
C
34
star
11

ms-sys

Not an official mirror of ms-sys
C
32
star
12

ubrx

Universal BIOS Recovery console for x86 PCs
Assembly
31
star
13

bled

Base Library for Easy Decompression
C
29
star
14

ntfs-3g-old

UEFI read/write NTFS driver, based on ntfs-3g
C
27
star
15

fasmg-efi

A simple Hello World for x86_64 UEFI using fasmg
Assembly
22
star
16

gnu-efi

gnu-efi fork
C
19
star
17

parrot

Linux parrot device driver sample
C
15
star
18

base-parallel

Win32 console sample for running a CPU-heavy task against multiple core/CPUs
C
11
star
19

base-console

A simple "hello world" win32 console template
C
11
star
20

winpki

Windows PKI library, for binary signing and more
C
11
star
21

pbatard.github.io

Github pages
HTML
9
star
22

xtreamerdev

Automatically exported from code.google.com/p/xtreamerdev
C
9
star
23

AltInput

Alternate Input module for Kerbal Space Program
C#
8
star
24

libusbx-hp

libusbx Windows hotplug
C
8
star
25

list-immersive-colors

List Immersive Colors
C
7
star
26

xisle

XAML Islands testing ground
C++
7
star
27

AmiNtfsBug

AMI UEFI NTFS driver bug test application
C
6
star
28

jekyll

Ruby
5
star
29

files

A repository to share static content
HTML
4
star
30

EbcDebugger

A standalone EBC Debugger
C
4
star
31

libusb-pbatard

old libusb-pbatard repo and associated branches
C
4
star
32

uefi-md5sum

MD5 checksum validation for UEFI
C
3
star
33

akeo

Automatically exported from code.google.com/p/akeo
Assembly
3
star
34

AppVeyor

A repository to test AppVeyor
C
2
star
35

thanks_for_the_regression

Thanks for the regression, GitHub Actions!
2
star