Skip to content

Instantly share code, notes, and snippets.

View pbatard's full-sized avatar
Have a cookie!

Pete Batard pbatard

Have a cookie!
View GitHub Profile

How to test EFI File System Transposition for GRUB

  1. Apply the EFI File System Transposition patches to your git repository.
  2. Download supergrub2-2.06s1-beta2-multiarch-CD.iso from here (Courtesy of We use Super GRUB2 Disk so that we don't have to create our own GRUB config and also because its ISO was created using grub-mkrescue from 2.06 and exhibits the issues we are trying to address.
  3. We'll need to issue make install so that grub-mkrescue can collect the necessary files from the "system" for the ISOHybrid creation, so make sure to create a custom target install directory (e.g. ~/grub-install) so that your build will use this rather than the system defaults.
  4. Create a `
pbatard /
Last active July 22, 2023 14:33
UEFI:NTFS Secure Boot submission

Creating a new SB submission

  1. Put all the _ro drivers to sign in a drivers\ subdirectory
  2. Create signed cab using the following script:
    @echo off
    setlocal enabledelayedexpansion
    set DIR=drivers

del /q files.txt >NUL 2>&1

pbatard /
Last active March 18, 2020 11:09
Pete's quick edk2/edk2-platform submission guide


This guide is meant as a complement to Laszlo's more official guide, in order to fill some missing bits and pieces.

This assumes that you cloned the edk2, edk2-platforms and edk2-non-osi repository and set up tianocore.template, edk2.diff.order and so on.

Commits validation

From 4fe257a4aeae6a30563c4b904c29a31ec8452152 Mon Sep 17 00:00:00 2001
From: Pete Batard <>
Date: Sun, 17 Aug 2014 19:00:35 +0100
Subject: [PATCH] Fix the use of DirectInput with (broken) Unity
Source/SharpDX/Utilities.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Source/SharpDX/Utilities.cs b/Source/SharpDX/Utilities.cs
pbatard / xusb.diff
Created July 5, 2012 15:12
FX3 firmware upload patch for xusb
--- D:/__PROJECTS/_INTERNAL/20120118_USB3.0/LibUSBx/libusbx-1.0.12-rc1/examples/xusb.c.orig Mon Jun 18 12:00:44 2012
+++ D:/__PROJECTS/_INTERNAL/20120118_USB3.0/LibUSBx/libusbx-1.0.12-rc1/examples/xusb.c Mon Jun 18 17:04:39 2012
@@ -47,14 +47,13 @@
#define false (!true)
// Future versions of libusbx will use usb_interface instead of interface
// in libusb_config_descriptor => catter for that
#define usb_interface interface
pbatard / Prevent-memory-leaks-on-realloc-failures.patch
Created July 5, 2012 15:03
improvement on the earlier patch with usbi_reallocf
From c85a751dfd6519d126772bab7796e96c4c63351f Mon Sep 17 00:00:00 2001
From: Pete Batard <>
Date: Thu, 7 Jun 2012 19:27:43 +0100
Subject: [PATCH] All: Prevent memory leaks on realloc failures
* p = realloc(p, new_size) does not free the original buffer in case of
a realloc failure.
* reallocf() can be used to do so, but is not available on all platforms.
* This patch introduces usbi_reallocf() in libusbi.h and use that instead of realloc
* Issue and original patch submitted by Moritz Lipp (trac #27)
From 16cebba315614cd527976f6625b3ac7661ed2f47 Mon Sep 17 00:00:00 2001
From: Moritz Lipp <>
Date: Thu, 7 Jun 2012 01:08:53 +0200
Subject: [PATCH] Free 'altsetting' upon failed realloc
If the reallocation of 'altsetting' fails the variable gets set to NULL
while the memory it originally pointed to remains untouched. This patch
resolves this common error by introducing a temporary variable that is
used to catch the failed reallocation and freeing the previously
allocated memory.