From: Raymund Will Subject: Make default '--loader' build-time configurable. Each distribution uses a specific 'vendor'-directory in the 'efi' directory on the EFI System Partition to store their EFI loader. There's little use in hardcoding the value for just one in 'efibootmgr', which is displayed in '--help' and used as default without '--loader'. Simply use make OS_VENDOR=redhat EFI_LOADER=grub.efi to get the previous value. :) Signed-off-by: Raymund Will --- Makefile | 4 ++++ src/efibootmgr/efibootmgr.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) Index: efibootmgr-0.12/Makefile =================================================================== --- efibootmgr-0.12.orig/Makefile +++ efibootmgr-0.12/Makefile @@ -1,5 +1,8 @@ default: all + OS_VENDOR := vendor + EFI_LOADER := boot.efi + SIGNING_KEY := pjones RELEASE_MAJOR := 0 RELEASE_MINOR := 12 @@ -8,6 +11,7 @@ RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR) CFLAGS = $(EXTRA_CFLAGS) -DEFIBOOTMGR_VERSION=\"$(RELEASE_MAJOR).$(RELEASE_MINOR)\" \ + -DDEFAULT_LOADER=\"\\\\efi\\\\$(OS_VENDOR)\\\\$(EFI_LOADER)\" \ -Wsign-compare -Wall -Werror -g -D_FILE_OFFSET_BITS=64 \ -I/usr/include/efivar Index: efibootmgr-0.12/src/efibootmgr/efibootmgr.c =================================================================== --- efibootmgr-0.12.orig/src/efibootmgr/efibootmgr.c +++ efibootmgr-0.12/src/efibootmgr/efibootmgr.c @@ -1,5 +1,6 @@ /* - efibootmgr.c - Manipulates EFI variables as exported in /proc/efi/vars + efibootmgr.c - Manipulates EFI variables as exported in + /sys/firmware/efi/vars (previously was /proc/efi/vars) Copyright (C) 2001-2004 Dell, Inc. @@ -18,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - This must tie the EFI_DEVICE_PATH to /boot/efi/EFI/redhat/grub.efi + This must tie the EFI_DEVICE_PATH to /boot/efi/efi//.efi The EFI_DEVICE_PATH will look something like: ACPI device path, length 12 bytes Hardware Device Path, PCI, length 6 bytes @@ -58,6 +59,9 @@ #define EFIBOOTMGR_VERSION "unknown (fix Makefile!)" #endif +#ifndef DEFAULT_LOADER +#define DEFAULT_LOADER "unknown (fix Makefile!)" +#endif typedef struct _var_entry { char *name; @@ -985,7 +989,7 @@ usage() printf("\t --ip-port , set local and remote IP ports\n"); printf("\t --ip-origin { {dhcp|static} | { static|stateless|stateful} }\n"); #endif - printf("\t-l | --loader name (defaults to \\EFI\\redhat\\grub.efi)\n"); + printf("\t-l | --loader name (defaults to \""DEFAULT_LOADER"\")\n"); printf("\t-L | --label label Boot manager display label (defaults to \"Linux\")\n"); printf("\t-n | --bootnext XXXX set BootNext to XXXX (hex)\n"); printf("\t-N | --delete-bootnext delete BootNext\n"); @@ -1013,6 +1017,7 @@ set_default_opts() opts.timeout = -1; /* Don't set it */ opts.edd10_devicenum = 0x80; opts.loader = "\\EFI\\redhat\\grub.efi"; + opts.loader = DEFAULT_LOADER; opts.label = (unsigned char *)"Linux"; opts.disk = "/dev/sda"; opts.part = 1;