efibootmgr: Create patch to allow arbitrary loader filenames

This is required for the NixOS efiBootStub module, since the default 40
characters is not enough for efi\nixos\{hash}-linux-3.3-rc7-bzImage.efi

svn path=/nixpkgs/trunk/; revision=33049
This commit is contained in:
Shea Levy 2012-03-13 21:32:09 +00:00
parent 63b934c36f
commit 21d7f598c8
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,24 @@
diff -Naur efibootmgr-0.5.4-orig/src/lib/efi.c efibootmgr-0.5.4/src/lib/efi.c
--- efibootmgr-0.5.4-orig/src/lib/efi.c 2008-01-03 15:34:01.000000000 +0100
+++ efibootmgr-0.5.4/src/lib/efi.c 2012-03-13 22:25:51.000000000 +0100
@@ -495,7 +495,8 @@
int rc, edd_version=0;
uint8_t mbr_type=0, signature_type=0;
uint64_t start=0, size=0;
- efi_char16_t os_loader_path[40];
+ efi_char16_t *os_loader_path;
+ size_t os_loader_path_size;
memset(signature, 0, sizeof(signature));
@@ -535,7 +536,9 @@
signature,
mbr_type, signature_type);
- efichar_from_char(os_loader_path, opts.loader, sizeof(os_loader_path));
+ os_loader_path_size = sizeof(efi_char16_t) * (1 + strlen(opts.loader) / sizeof(char));
+ os_loader_path = malloc(os_loader_path_size);
+ efichar_from_char(os_loader_path, opts.loader, os_loader_path_size);
p += make_file_path_device_path (p, os_loader_path);
p += make_end_device_path (p);

View File

@ -7,13 +7,14 @@ stdenv.mkDerivation {
buildInputs = [ pciutils zlib perl ];
patches = [ ./arbitrary-filenames.patch ];
src = fetchurl {
url = "http://linux.dell.com/efibootmgr/permalink/efibootmgr-${version}.tar.gz";
sha256 = "0wcfgf8x4p4xfh38m9x3njwsxibm9bhnmvpjj94lj9sk9xxa8qmm";
};
patchPhase = ''
postPatch = ''
substituteInPlace "./tools/install.pl" \
--replace "/usr/bin/perl" "${perl}/bin/perl"
'';