[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/7] mkimage: Refactor IMAGE_EFI checks into a function grub_imag
From: |
Ian Campbell |
Subject: |
[PATCH 1/7] mkimage: Refactor IMAGE_EFI checks into a function grub_image_needs_reloc. |
Date: |
Sun, 29 Dec 2013 18:47:30 +0000 |
Signed-off-by: Ian Campbell <address@hidden>
---
util/grub-mkimagexx.c | 12 ++++++------
util/mkimage.c | 7 +++++++
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index 0a1ac9e..d059396 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -1371,7 +1371,7 @@ SUFFIX (locate_sections) (const char *kernel_path,
grub_util_info ("locating the section %s at 0x%"
GRUB_HOST_PRIxLONG_LONG,
name, (unsigned long long) current_address);
- if (image_target->id != IMAGE_EFI)
+ if (!grub_image_needs_reloc(image_target))
{
current_address = grub_host_to_target_addr (s->sh_addr)
- image_target->link_addr;
@@ -1413,7 +1413,7 @@ SUFFIX (locate_sections) (const char *kernel_path,
grub_util_info ("locating the section %s at 0x%"
GRUB_HOST_PRIxLONG_LONG,
name, (unsigned long long) current_address);
- if (image_target->id != IMAGE_EFI)
+ if (!grub_image_needs_reloc(image_target))
current_address = grub_host_to_target_addr (s->sh_addr)
- image_target->link_addr;
section_addresses[i] = current_address;
@@ -1486,7 +1486,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t
*exec_size,
for (i = 0; i < num_sections; i++)
section_vaddresses[i] = section_addresses[i] + image_target->vaddr_offset;
- if (image_target->id != IMAGE_EFI)
+ if (!grub_image_needs_reloc(image_target))
{
Elf_Addr current_address = *kernel_sz;
@@ -1507,7 +1507,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t
*exec_size,
grub_util_info ("locating the section %s at 0x%"
GRUB_HOST_PRIxLONG_LONG,
name, (unsigned long long) current_address);
- if (image_target->id != IMAGE_EFI)
+ if (!grub_image_needs_reloc(image_target))
current_address = grub_host_to_target_addr (s->sh_addr)
- image_target->link_addr;
@@ -1528,7 +1528,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t
*exec_size,
|| image_target->id == IMAGE_SPARC64_CDCORE)
*kernel_sz = ALIGN_UP (*kernel_sz, image_target->mod_align);
- if (image_target->id == IMAGE_EFI)
+ if (grub_image_needs_reloc(image_target))
{
symtab_section = NULL;
for (i = 0, s = sections;
@@ -1588,7 +1588,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t
*exec_size,
out_img = xmalloc (*kernel_sz + total_module_size);
- if (image_target->id == IMAGE_EFI)
+ if (grub_image_needs_reloc(image_target))
{
*start = SUFFIX (relocate_symbols) (e, sections, symtab_section,
section_vaddresses, section_entsize,
diff --git a/util/mkimage.c b/util/mkimage.c
index 26d9816..645e296 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -922,6 +922,13 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr
sym_addr)
return GRUB_ERR_NONE;
}
+static int grub_image_needs_reloc(const struct grub_install_image_target_desc
*target)
+{
+ if (target->id == IMAGE_EFI)
+ return 1;
+ return 0;
+}
+
#pragma GCC diagnostic ignored "-Wcast-align"
#define MKIMAGE_ELF32 1
--
1.8.4.rc3
- [PATCH 0/7] arm-uboot: support for different RAM bases, Ian Campbell, 2013/12/29
- [PATCH 2/7] mkimage: Replace hardcoded 0x400 in R_ARM_ABS32 relocation, Ian Campbell, 2013/12/29
- [PATCH 1/7] mkimage: Refactor IMAGE_EFI checks into a function grub_image_needs_reloc.,
Ian Campbell <=
- [PATCH 3/7] mkimage: account for space for trampolines earlier, Ian Campbell, 2013/12/29
- [PATCH 4/7] mkimage: make R_ARM_ABS32 debug output more consistent, Ian Campbell, 2013/12/29
- [PATCH 5/7] mkimage: allow linking at address 0, Ian Campbell, 2013/12/29
- [PATCH 6/7] mkimage: support images which require full relocation at mkimage time., Ian Campbell, 2013/12/29