Rikitav.IO.ExtensibleFirmware.BootService
1.0.1
dotnet add package Rikitav.IO.ExtensibleFirmware.BootService --version 1.0.1
NuGet\Install-Package Rikitav.IO.ExtensibleFirmware.BootService -Version 1.0.1
<PackageReference Include="Rikitav.IO.ExtensibleFirmware.BootService" Version="1.0.1" />
paket add Rikitav.IO.ExtensibleFirmware.BootService --version 1.0.1
#r "nuget: Rikitav.IO.ExtensibleFirmware.BootService, 1.0.1"
// Install Rikitav.IO.ExtensibleFirmware.BootService as a Cake Addin #addin nuget:?package=Rikitav.IO.ExtensibleFirmware.BootService&version=1.0.1 // Install Rikitav.IO.ExtensibleFirmware.BootService as a Cake Tool #tool nuget:?package=Rikitav.IO.ExtensibleFirmware.BootService&version=1.0.1
ExtensibleFirmware
Description
ExtensibleFirmware is a .NET class library for working with UEFI firmware. It provides tools for editing the boot process, allowing developers to modify and configure boot parameters for enhanced flexibility.
Features
- Getting EFI system partition
- Editing and creating boot entries.
- Editing global variables for firmware.
Installation
# Install via NuGet
Install-Package ExtensibleFirmware
Usage Examples
Example 1: Getting ESP
using Rikitav.IO.ExtensibleFirmware.SystemPartition;
using System.IO;
namespace Examples
{
class Program
{
public static void Main()
{
// Getting 'EFI system partition' volume path
string EspVolumePath = EfiPartition.GetFullPath();
// Example reading config file from ESP using volume path, instead of using MountVol
string configText = File.ReadAllText(Path.Combine(EspVolumePath, "EFI", "Ubuntu", "grub.cfg"));
}
}
}
Example 2: Reading boot option
using Rikitav.IO.ExtensibleFirmware.BootService;
using Rikitav.IO.ExtensibleFirmware.BootService.DevicePathProtocols;
using Rikitav.IO.ExtensibleFirmware.BootService.LoadOption;
using System;
namespace Examples
{
class Program
{
public static void Main()
{
// Reading boot option
FirmwareBootOption bootOption = FirmwareBootService.ReadLoadOption(0x0003); // <-- Set here your variable index
// Enumerating all protocols
foreach (DevicePathProtocolBase protocol in bootOption.OptionProtocols)
Console.WriteLine(protocol.ToString()); // Getting string representation of protocol
}
}
}
Example 3: Creating boot option
using Rikitav.IO.ExtensibleFirmware.BootService;
using Rikitav.IO.ExtensibleFirmware.BootService.DevicePathProtocols;
using Rikitav.IO.ExtensibleFirmware.BootService.LoadOption;
using Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols;
using System;
namespace Examples
{
class Program
{
public static void Main()
{
// Setting device path protocols
// This protocols instructions boot service how to load your option
DevicePathProtocolBase[] protocols = new DevicePathProtocolBase[]
{
new HardDriveMediaDevicePath(new Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")), // The partition on which the bootloader is located
new FilePathMediaDevicePath("EFI\\MyApplication\\bootx64.efi"), // Path to the EFI application to be loaded
new DevicePathProtocolEnd() // Indicates the end of the boot option. if this is omitted, the option will not be considered valid
};
// Creating simple load option
FirmwareBootOption bootOption = new FirmwareBootOption(LoadOptionAttributes.ACTIVE, "MyLoader", Array.Empty<byte>(), protocols);
// Creating new load option
ushort newLoadOptionIndex = FirmwareBootService.CreateLoadOption(bootOption, true);
// Logging new boot option index
Console.WriteLine("Boot option sucessfully created, new option index : {0}", newLoadOptionIndex);
}
}
}
Requirements
Most functionality will work on every Windows system that supports uefi, except EfiExecutableInfo and VolumenName pathes, the will only work on Windows 8 or above
Resources
If you want to learn more about UEFI and how this library works, read the documentation at the following links :
License
This project is licensed under the GNU GPL License. See LICENSE for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Rikitav.IO.ExtensibleFirmware (>= 1.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rikitav.IO.ExtensibleFirmware.BootService:
Package | Downloads |
---|---|
Rikitav.IO.ExtensibleFirmware.MediaDevicePathProtocols
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.