The 64-bit PowerPC GENERIC kernel boots on a wide variety of firmwares. The current fixed load address is a best-guess that is supposed to work everywhere. The impending addition of OPAL support for bare-metal POWER8 narrows the parameter space that works everywhere to zero, so we need a new system.
The attached changes make the kernel position-independent, loadable and executable from any fixed address accessible in real mode. This is a relatively small set of changes since powerpc64 ABI is essentially always position-independent unless you deliberately thwart that (which we had done in a few places). Major highlights:
- Modify loader to accept dynamic ELF images as kernels. These are distinguished from modules by their entry point being non-zero; changes to kmod.mk to enforce this are included. The changes there are protected by checks for powerpc64, but I believe they should be harmless on all architectures. Feedback or tests on this point would be appreciated.
- Code in locore64.S and elf64_machdep.c to perform relocations at kernel start.
- Code for the trap handlers to make them position-independent.
- Makefile.powerpc bits to tell the compiler and linker to generate position-independent code.