diff --git a/aarch64-reloc.patch b/aarch64-reloc.patch new file mode 100644 index 0000000..bd86338 --- /dev/null +++ b/aarch64-reloc.patch @@ -0,0 +1,56 @@ +From f472bc5ac54e72eb09b0606f588085af504d754b Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 12 Aug 2014 10:42:43 +0200 +Subject: [PATCH] Support R_AARCH64_PREL32 relocation + + * include/grub/elf.h (R_AARCH64_PREL32): Define. + * util/grub-mkimagexx.c (make_reloc_section): Handle it. + (relocate_addresses): Likewise. +--- + include/grub/elf.h | 1 + + util/grub-mkimagexx.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/include/grub/elf.h b/include/grub/elf.h +index caa7963..836b304 100644 +--- a/include/grub/elf.h ++++ b/include/grub/elf.h +@@ -2070,6 +2070,7 @@ typedef Elf32_Addr Elf32_Conflict; + #define R_AARCH64_ABS32 258 /* Direct 32 bit. */ + #define R_AARCH64_JUMP26 282 /* 26-bit relative. */ + #define R_AARCH64_CALL26 283 /* 26-bit relative. */ ++#define R_AARCH64_PREL32 261 /* 32-bit pc-relative. */ + #define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */ + #define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */ + #define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */ +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index 0a1ac9e..376dc2d 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -836,6 +836,15 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, + *target = grub_host_to_target64 (grub_target_to_host64 (*target) + sym_addr); + } + break; ++ case R_AARCH64_PREL32: ++ { ++ grub_uint32_t *t32 = (grub_uint32_t *) target; ++ *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) ++ + sym_addr ++ - target_section_addr - offset ++ - image_target->vaddr_offset); ++ break; ++ } + case R_AARCH64_JUMP26: + case R_AARCH64_CALL26: + { +@@ -1197,6 +1206,7 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out, + } + break; + /* Relative relocations do not require fixup entries. */ ++ case R_AARCH64_PREL32: + case R_AARCH64_CALL26: + case R_AARCH64_JUMP26: + break; +-- +2.0.4 + diff --git a/grub2.changes b/grub2.changes index 4af7371..0e4d91a 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Aug 12 12:56:29 UTC 2014 - schwab@suse.de + +- Enable building on aarch64 +- aarch64-reloc.patch: support R_AARCH64_PREL32 relocation +- Build host tools with RPM_OPT_FLAGS + ------------------------------------------------------------------- Mon Aug 11 14:34:55 UTC 2014 - dvaleev@suse.com diff --git a/grub2.spec b/grub2.spec index 86233fa..ecd9124 100644 --- a/grub2.spec +++ b/grub2.spec @@ -80,16 +80,23 @@ BuildRequires: xen-devel # build efi bootloader on some platforms only: %if ! 0%{?efi} -%global efi %{ix86} x86_64 ia64 +%global efi %{ix86} x86_64 ia64 aarch64 +%endif +%ifarch aarch64 +%define only_efi 1 %endif %ifarch %{efi} %ifarch %{ix86} %define grubefiarch i386-efi %else +%ifarch aarch64 +%define grubefiarch arm64-efi +%else %define grubefiarch %{_target_cpu}-efi %endif %endif +%endif %if 0%{?suse_version} == 1110 %define only_efi %{nil} @@ -140,6 +147,7 @@ Patch36: 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch Patch37: grub2-use-Unifont-for-starfield-theme-terminal.patch Patch38: grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch Patch39: grub2-use-rpmsort-for-version-sorting.patch +Patch40: aarch64-reloc.patch # Btrfs snapshot booting related patches Patch101: 0002-btrfs-add-ability-to-boot-from-subvolumes.patch Patch102: 0003-cmdline-add-envvar-loader_cmdline_append.patch @@ -196,7 +204,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?only_x86_64:1} ExclusiveArch: x86_64 %else -ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x +ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x aarch64 %endif %description @@ -338,6 +346,7 @@ mv po/grub.pot po/%{name}.pot %patch37 -p1 %patch38 -p1 %patch39 -p1 +%patch40 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 @@ -405,6 +414,7 @@ CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once " CXXFLAGS=" " FFLAGS=" " export CFLAGS CXXFLAGS FFLAGS +export HOST_CFLAGS=$RPM_OPT_FLAGS %ifarch x86_64 cd build-xen