diff options
| author | Peter Jones <pjones@redhat.com> | 2013-09-26 11:58:02 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2013-09-26 11:58:02 -0400 |
| commit | e053c227014dcaa9c2c9a63bbd00dfe149bfc468 (patch) | |
| tree | 480a3289734bcfa2c78aa1b921ec046a37183a4f /netboot.c | |
| parent | bd145c6082bde9740548ad7f88261008524ede15 (diff) | |
| download | efi-boot-shim-e053c227014dcaa9c2c9a63bbd00dfe149bfc468.tar.gz efi-boot-shim-e053c227014dcaa9c2c9a63bbd00dfe149bfc468.zip | |
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>
Diffstat (limited to 'netboot.c')
| -rw-r--r-- | netboot.c | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -39,8 +39,6 @@ #include "shim.h" #include "netboot.h" -#define DEFAULT_LOADER "/grub.efi" - static inline unsigned short int __swap16(unsigned short int x) { __asm__("xchgb %b0,%h0" @@ -63,6 +61,24 @@ typedef struct { UINT8 Data[1]; } 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 * 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; char ip6str[40]; - CHAR8 *template = DEFAULT_LOADER; + CHAR8 *template = (CHAR8 *)translate_slashes(DEFAULT_LOADER_CHAR); if (strncmp((UINT8 *)url, (UINT8 *)"tftp://", 7)) { Print(L"URLS MUST START WITH tftp://\n"); @@ -289,7 +305,7 @@ static EFI_STATUS parseDhcp6() static EFI_STATUS parseDhcp4() { - CHAR8 *template = DEFAULT_LOADER; + CHAR8 *template = (CHAR8 *)DEFAULT_LOADER_CHAR; full_path = AllocateZeroPool(strlen(template)+1); if (!full_path) |
