From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VxLP9-0001Ob-SH for mharc-grub-devel@gnu.org; Sun, 29 Dec 2013 13:48:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VxLP1-00019Q-Md for grub-devel@gnu.org; Sun, 29 Dec 2013 13:48:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VxLOv-0008Ln-8N for grub-devel@gnu.org; Sun, 29 Dec 2013 13:47:55 -0500 Received: from benson.vm.bytemark.co.uk ([212.110.190.137]:37736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VxLOv-0008Lh-2P for grub-devel@gnu.org; Sun, 29 Dec 2013 13:47:49 -0500 Received: from cpc22-cmbg14-2-0-cust482.5-4.cable.virginm.net ([86.6.25.227] helo=hastur.hellion.org.uk) by benson.vm.bytemark.co.uk with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VxLOt-0000L1-Hl; Sun, 29 Dec 2013 18:47:48 +0000 Received: by hastur.hellion.org.uk (sSMTP sendmail emulation); Sun, 29 Dec 2013 18:47:46 +0000 From: Ian Campbell To: grub-devel@gnu.org Subject: [PATCH 7/7] arm-uboot: support relocation at installation time Date: Sun, 29 Dec 2013 18:47:36 +0000 Message-Id: <1388342856-18317-7-git-send-email-ijc@hellion.org.uk> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1388342839.32105.25.camel@hastur.hellion.org.uk> References: <1388342839.32105.25.camel@hastur.hellion.org.uk> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.110.190.137 Cc: Vladimir Serbinenko , Leif Lindholm , Ian Campbell X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2013 18:48:01 -0000 Partially link kernel.img and take advantage of the new PLATFORM_FLAGS_ABS_RELOC support to link the final kernel image for a particular address. Signed-off-by: Ian Campbell --- grub-core/Makefile.core.def | 2 +- include/grub/offsets.h | 2 +- util/mkimage.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index e5e558c..f14a2c4 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -95,7 +95,7 @@ kernel = { i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; emu_cflags = '$(CFLAGS_GNULIB)'; emu_cppflags = '$(CPPFLAGS_GNULIB)'; - arm_uboot_ldflags = '-Wl,-Ttext=0x08000000'; + arm_uboot_ldflags = '-Wl,-r,-d'; arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; i386_pc_startup = kern/i386/pc/startup.S; diff --git a/include/grub/offsets.h b/include/grub/offsets.h index 85e7401..bb14190 100644 --- a/include/grub/offsets.h +++ b/include/grub/offsets.h @@ -120,7 +120,7 @@ #define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 0x8 #define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4 -#define GRUB_KERNEL_ARM_UBOOT_LINK_ADDR 0x08000000 +#define GRUB_KERNEL_ARM_UBOOT_DEFAULT_LINK_ADDR 0x08000000 /* Minimal gap between _end and the start of the modules. It's a hack for PowerMac to prevent "CLAIM failed" error. The real fix is to diff --git a/util/mkimage.c b/util/mkimage.c index 7b29acf..112092e 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -549,14 +549,14 @@ static const struct grub_install_image_target_desc image_targets[] = .voidp_sizeof = 4, .bigendian = 0, .id = IMAGE_UBOOT, - .flags = PLATFORM_FLAGS_NONE, + .flags = PLATFORM_FLAGS_ABS_RELOC, .total_module_size = GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE, .decompressor_compressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, .section_align = GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN, .vaddr_offset = 0, - .link_addr = GRUB_KERNEL_ARM_UBOOT_LINK_ADDR, + .link_addr = GRUB_KERNEL_ARM_UBOOT_DEFAULT_LINK_ADDR, .elf_target = EM_ARM, .mod_gap = GRUB_KERNEL_ARM_UBOOT_MOD_GAP, .mod_align = GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN, @@ -1802,8 +1802,8 @@ grub_install_generate_image (const char *dir, const char *prefix, hdr->ih_magic = grub_cpu_to_be32_compile_time (GRUB_UBOOT_IH_MAGIC); hdr->ih_time = grub_cpu_to_be32 (time (0)); hdr->ih_size = grub_cpu_to_be32 (core_size); - hdr->ih_load = grub_cpu_to_be32 (image_target->link_addr); - hdr->ih_ep = grub_cpu_to_be32 (image_target->link_addr); + hdr->ih_load = grub_cpu_to_be32 (target_address); + hdr->ih_ep = grub_cpu_to_be32 (start_address); hdr->ih_type = GRUB_UBOOT_IH_TYPE_KERNEL; hdr->ih_os = GRUB_UBOOT_IH_OS_LINUX; hdr->ih_arch = GRUB_UBOOT_IH_ARCH_ARM; -- 1.8.4.rc3