Hi Mark,
2017-03-09 1:05 GMT+09:00 Mark Rutland <mark.rutl...@arm.com>: >> >> /* >> - * If we are not at the correct run-time location, set the new >> - * correct location and then move the image there. >> + * If bit 3 of the flags field is set, the 2MB aligned base of the >> + * kernel image can be anywhere in physical memory, so respect >> + * images->ep. Otherwise, relocate the image to the base of RAM >> + * since memory below it is not accessible via the linear mapping. >> */ >> - dst = gd->bd->bi_dram[0].start + le64_to_cpu(ih->text_offset); >> + if (le64_to_cpu(ih->flags) & BIT(3)) >> + dst = images->ep - le64_to_cpu(ih->text_offset); > > I take it this is a pre-correction for the ALIGN() below? Without this, the image would be always relocated even if images->ep is already bootable location. Unnecessary relocation should be avoided. > There's one last wrinkle to take care of here, if we want to boot a > kernel older than commit a2c1d73b94ed49f5 (i.e. v3.16). Until then, the > text_offset was of unknown endianness. > > As mentiond in the Linux documentation, you can detect this based on the > image_size field, e.g. > > uint64_t text_offset; > > /* > * Prior to Linux commit a2c1d73b94ed49f5, the text_offset field > * is of unknown endianness. In these cases, the image_size > * field is zero, and we can assume a fixed value of 0x80000. > */ > if (le64_to_cpu(ih->image_size) == 0) > text_offset = 0x80000; > else > text_offset = (le64_to_cpu(ih->text_offset)); > > ... then you can reuse that text_offset value for both cases above. > Thanks. I will fix this too. -- Best Regards Masahiro Yamada _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot