mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-08 12:14:29 +00:00
Since different distros name grub*.efi differently, make it compile-time.
Basically, if you don't want grub.efi, you do: make 'DEFAULT_LOADER=\\\\grubx64.efi' Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
bd145c6082
commit
e053c22701
3
Makefile
3
Makefile
@ -14,9 +14,12 @@ EFI_LIBS = -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/
|
|||||||
EFI_CRT_OBJS = $(EFI_PATH)/crt0-efi-$(ARCH).o
|
EFI_CRT_OBJS = $(EFI_PATH)/crt0-efi-$(ARCH).o
|
||||||
EFI_LDS = elf_$(ARCH)_efi.lds
|
EFI_LDS = elf_$(ARCH)_efi.lds
|
||||||
|
|
||||||
|
DEFAULT_LOADER := \\\\grub.efi
|
||||||
CFLAGS = -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic \
|
CFLAGS = -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic \
|
||||||
-fshort-wchar -Wall -Werror -mno-red-zone -maccumulate-outgoing-args \
|
-fshort-wchar -Wall -Werror -mno-red-zone -maccumulate-outgoing-args \
|
||||||
-mno-mmx -mno-sse \
|
-mno-mmx -mno-sse \
|
||||||
|
"-DDEFAULT_LOADER=L\"$(DEFAULT_LOADER)\"" \
|
||||||
|
"-DDEFAULT_LOADER_CHAR=\"$(DEFAULT_LOADER)\"" \
|
||||||
$(EFI_INCLUDES)
|
$(EFI_INCLUDES)
|
||||||
ifeq ($(ARCH),x86_64)
|
ifeq ($(ARCH),x86_64)
|
||||||
CFLAGS += -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI
|
CFLAGS += -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI
|
||||||
|
24
netboot.c
24
netboot.c
@ -39,8 +39,6 @@
|
|||||||
#include "shim.h"
|
#include "shim.h"
|
||||||
#include "netboot.h"
|
#include "netboot.h"
|
||||||
|
|
||||||
#define DEFAULT_LOADER "/grub.efi"
|
|
||||||
|
|
||||||
static inline unsigned short int __swap16(unsigned short int x)
|
static inline unsigned short int __swap16(unsigned short int x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0"
|
__asm__("xchgb %b0,%h0"
|
||||||
@ -63,6 +61,24 @@ typedef struct {
|
|||||||
UINT8 Data[1];
|
UINT8 Data[1];
|
||||||
} EFI_DHCP6_PACKET_OPTION;
|
} EFI_DHCP6_PACKET_OPTION;
|
||||||
|
|
||||||
|
static CHAR8 *
|
||||||
|
translate_slashes(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
if (str == NULL)
|
||||||
|
return (CHAR8 *)str;
|
||||||
|
|
||||||
|
for (i = 0, j = 0; str[i] != '\0'; i++, j++) {
|
||||||
|
if (str[i] == '\\') {
|
||||||
|
str[j] = '/';
|
||||||
|
if (str[i+1] == '\\')
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (CHAR8 *)str;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* usingNetboot
|
* usingNetboot
|
||||||
* Returns TRUE if we identify a protocol that is enabled and Providing us with
|
* Returns TRUE if we identify a protocol that is enabled and Providing us with
|
||||||
@ -229,7 +245,7 @@ static BOOLEAN extract_tftp_info(CHAR8 *url)
|
|||||||
{
|
{
|
||||||
CHAR8 *start, *end;
|
CHAR8 *start, *end;
|
||||||
char ip6str[40];
|
char ip6str[40];
|
||||||
CHAR8 *template = DEFAULT_LOADER;
|
CHAR8 *template = (CHAR8 *)translate_slashes(DEFAULT_LOADER_CHAR);
|
||||||
|
|
||||||
if (strncmp((UINT8 *)url, (UINT8 *)"tftp://", 7)) {
|
if (strncmp((UINT8 *)url, (UINT8 *)"tftp://", 7)) {
|
||||||
Print(L"URLS MUST START WITH tftp://\n");
|
Print(L"URLS MUST START WITH tftp://\n");
|
||||||
@ -289,7 +305,7 @@ static EFI_STATUS parseDhcp6()
|
|||||||
|
|
||||||
static EFI_STATUS parseDhcp4()
|
static EFI_STATUS parseDhcp4()
|
||||||
{
|
{
|
||||||
CHAR8 *template = DEFAULT_LOADER;
|
CHAR8 *template = (CHAR8 *)DEFAULT_LOADER_CHAR;
|
||||||
full_path = AllocateZeroPool(strlen(template)+1);
|
full_path = AllocateZeroPool(strlen(template)+1);
|
||||||
|
|
||||||
if (!full_path)
|
if (!full_path)
|
||||||
|
1
shim.c
1
shim.c
@ -43,7 +43,6 @@
|
|||||||
#include "shim_cert.h"
|
#include "shim_cert.h"
|
||||||
#include "ucs2.h"
|
#include "ucs2.h"
|
||||||
|
|
||||||
#define DEFAULT_LOADER L"\\grub.efi"
|
|
||||||
#define FALLBACK L"\\fallback.efi"
|
#define FALLBACK L"\\fallback.efi"
|
||||||
#define MOK_MANAGER L"\\MokManager.efi"
|
#define MOK_MANAGER L"\\MokManager.efi"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user