From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeroen Hofstee Date: Thu, 15 May 2014 00:41:05 +0200 Subject: [U-Boot] [PATCH] arm: Allow u-boot to run from offset base address In-Reply-To: <1400105145-6628-1-git-send-email-drambo@broadcom.com> References: <1400105145-6628-1-git-send-email-drambo@broadcom.com> Message-ID: <1400107265.16796.8.camel@yellow> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Darwin, On wo, 2014-05-14 at 15:05 -0700, Darwin Rambo wrote: > +#ifdef CONFIG_ARM64 > + /* > + * Fix relocation if u-boot is not on an aligned address. > + */ > + { > + int offset = CONFIG_SYS_TEXT_BASE % 4096; > + if (offset) { > + addr += offset; > + debug("Relocation Addr bumped to 0x%08lx\n", addr); > + } > + } > +#endif > + Do you really want to check a define at runtime? Placement is typically at the end of RAM and allocation goes down, not up as in this patch. Aren't you overlapping memory here? > > static int setup_reloc(void) > { > +#ifdef CONFIG_ARM64 > + /* > + * Fix relocation if u-boot is not on an aligned address. > + */ > + int offset = CONFIG_SYS_TEXT_BASE % 4096; > + if (offset) { > + gd->relocaddr += offset; > + debug("Relocation Addr bumped to 0x%08lx\n", gd->relocaddr); > + } > +#endif > gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; > memcpy(gd->new_gd, (char *)gd, sizeof(gd_t)); > This is a generic file, hell breaks loose if you start using arch / board / pre bootloader specific workarounds here afaiac. lucky for you, I am not a u-boot maintainer, but this looks at least a bit weird, glancing at it. Regards, Jeroen