nixpkgs/pkgs/tools/system/efibootmgr/arbitrary-filenames.patch
Shea Levy 21d7f598c8 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
2012-03-13 21:32:09 +00:00

24 lines
979 B
Diff

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);