shim/shim-bnc807760-change-pxe-2nd-loader-name.patch

59 lines
1.5 KiB
Diff
Raw Normal View History

From 9cf8c7fefdcfb5930cb96091676a67cc0c0402b9 Mon Sep 17 00:00:00 2001
From: Gary Ching-Pang Lin <glin@suse.com>
Date: Thu, 7 Mar 2013 11:59:44 +0800
Subject: [PATCH] Define the PXE 2nd stage loader in the beginning of the file
Make it easier to change the PXE 2nd stage loader.
---
netboot.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/netboot.c b/netboot.c
index 90fb9cb..ae723c7 100644
--- a/netboot.c
+++ b/netboot.c
@@ -39,6 +39,7 @@
#include "shim.h"
#include "netboot.h"
+#define DEFAULT_LOADER "/grub.efi"
static inline unsigned short int __swap16(unsigned short int x)
{
@@ -238,7 +239,7 @@ static BOOLEAN extract_tftp_info(char *url)
{
char *start, *end;
char ip6str[128];
- char *template = "/grubx64.efi";
+ char *template = DEFAULT_LOADER;
if (strncmp((UINT8 *)url, (UINT8 *)"tftp://", 7)) {
Print(L"URLS MUST START WITH tftp://\n");
@@ -294,9 +295,11 @@ static EFI_STATUS parseDhcp6()
static EFI_STATUS parseDhcp4()
{
- char *template = "/grubx64.efi";
- char *tmp = AllocatePool(16);
+ char *template = DEFAULT_LOADER;
+ char *tmp;
+ int len = strlen((CHAR8 *)template);
+ tmp = AllocatePool(len+1);
if (!tmp)
return EFI_OUT_OF_RESOURCES;
@@ -304,8 +307,7 @@ static EFI_STATUS parseDhcp4()
memcpy(&tftp_addr.v4, pxe->Mode->DhcpAck.Dhcpv4.BootpSiAddr, 4);
- memcpy(tmp, template, 12);
- tmp[13] = '\0';
+ memcpy(tmp, template, len+1);
full_path = tmp;
/* Note we don't capture the filename option here because we know its shim.efi
--
1.8.1.4