c2f7a5e9af
Fix AArch64 machines with no RAM latched lower than 1GB Resolves: rhbz#1615969 Set http_path and http_url when HTTP booting Hopefully slightly better error reporting in some cases Better allocation of kernel+initramfs on x86_64 and aarch64 Resolves: rhbz#1572126 Signed-off-by: Peter Jones <pjones@redhat.com>
97 lines
3.4 KiB
Diff
97 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Thu, 30 Aug 2018 11:10:18 -0400
|
|
Subject: [PATCH] Try to pick better locations for kernel and initrd
|
|
|
|
Don't limit allocations on 64-bit platforms to < 0x3fffffff; use
|
|
__UINTPTR_MAX__ or __INTPTR_MAX__.
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
grub-core/kern/efi/mm.c | 2 +-
|
|
grub-core/loader/i386/efi/linux.c | 7 ++++---
|
|
include/grub/arm64/efi/memory.h | 2 +-
|
|
include/grub/x86_64/efi/memory.h | 4 ++--
|
|
4 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
|
|
index 306924f73a4..4c00f4cc9d3 100644
|
|
--- a/grub-core/kern/efi/mm.c
|
|
+++ b/grub-core/kern/efi/mm.c
|
|
@@ -122,7 +122,7 @@ grub_efi_allocate_pages_max (grub_efi_physical_address_t max,
|
|
grub_efi_boot_services_t *b;
|
|
grub_efi_physical_address_t address = max;
|
|
|
|
- if (max > 0xffffffff)
|
|
+ if (max >= GRUB_EFI_MAX_USABLE_ADDRESS)
|
|
return 0;
|
|
|
|
b = grub_efi_system_table->boot_services;
|
|
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
|
index ea9f5134e67..fddf54762a7 100644
|
|
--- a/grub-core/loader/i386/efi/linux.c
|
|
+++ b/grub-core/loader/i386/efi/linux.c
|
|
@@ -28,6 +28,7 @@
|
|
#include <grub/efi/efi.h>
|
|
#include <grub/efi/linux.h>
|
|
#include <grub/tpm.h>
|
|
+#include <grub/cpu/efi/memory.h>
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
@@ -108,7 +109,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
size += ALIGN_UP (grub_file_size (files[i]), 4);
|
|
}
|
|
|
|
- initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
|
|
+ initrd_mem = grub_efi_allocate_pages_max (GRUB_EFI_MAX_USABLE_ADDRESS, BYTES_TO_PAGES(size));
|
|
if (!initrd_mem)
|
|
{
|
|
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
|
|
@@ -209,7 +210,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|
goto fail;
|
|
}
|
|
|
|
- params = grub_efi_allocate_pages_max (0x3fffffff,
|
|
+ params = grub_efi_allocate_pages_max (GRUB_EFI_MAX_USABLE_ADDRESS,
|
|
BYTES_TO_PAGES(sizeof(*params)));
|
|
if (! params)
|
|
{
|
|
@@ -309,7 +310,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|
BYTES_TO_PAGES(lh->init_size));
|
|
|
|
if (!kernel_mem)
|
|
- kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
|
|
+ kernel_mem = grub_efi_allocate_pages_max(GRUB_EFI_MAX_USABLE_ADDRESS,
|
|
BYTES_TO_PAGES(lh->init_size));
|
|
|
|
if (!kernel_mem)
|
|
diff --git a/include/grub/arm64/efi/memory.h b/include/grub/arm64/efi/memory.h
|
|
index c6cb3241714..af62f56cf7e 100644
|
|
--- a/include/grub/arm64/efi/memory.h
|
|
+++ b/include/grub/arm64/efi/memory.h
|
|
@@ -1,6 +1,6 @@
|
|
#ifndef GRUB_MEMORY_CPU_HEADER
|
|
#include <grub/efi/memory.h>
|
|
|
|
-#define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffffffffULL
|
|
+#define GRUB_EFI_MAX_USABLE_ADDRESS __UINTPTR_MAX__
|
|
|
|
#endif /* ! GRUB_MEMORY_CPU_HEADER */
|
|
diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h
|
|
index fb7437f7b5f..70bce170850 100644
|
|
--- a/include/grub/x86_64/efi/memory.h
|
|
+++ b/include/grub/x86_64/efi/memory.h
|
|
@@ -2,9 +2,9 @@
|
|
#include <grub/efi/memory.h>
|
|
|
|
#if defined (__code_model_large__)
|
|
-#define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffffffffffffULL
|
|
+#define GRUB_EFI_MAX_USABLE_ADDRESS __UINTPTR_MAX__
|
|
#else
|
|
-#define GRUB_EFI_MAX_USABLE_ADDRESS 0x7fffffffffffffffULL
|
|
+#define GRUB_EFI_MAX_USABLE_ADDRESS __INTPTR_MAX__
|
|
#endif
|
|
|
|
#endif /* ! GRUB_MEMORY_CPU_HEADER */
|