[RFC PATCH 0/2] kvmtool: Rework guest/init integration

Andre Przywara
2015-06-23T15:06:11Z

Hi,

this mini series aims at solving long standing issues with compiling
and linking the guest/init binary for MIPS.
It seems that many MIPS toolchains use different default ELF targets
for the compiler and the linker, rendering the approach of linking
the guest/init executable into the lkvm binary moot.
One could work around this by specifying some magic ELF target
options to the linker so it matches the compiler ones, but I couldn't
find a way of automatically determining those, so this approach is
only valid on a particular toolchain.
Another approach would be to fixup the ELF header, but that sounds
dodgy and fragile to me.

Instead of using "ld" this series transforms the generated guest
binary into a C file, which gets compiled (with CC) and thus
automatically links fine with the other object files.
Patch 2/2 implements this, patch 1/2 cleans up the rules for the
guest binary generation in the Makefile.

This uses the "xxd" tool, which has a special command line option
to generate a C array out of a binary blob. On the distributions
I checked, this comes with the vim package, not sure if that is a
restriction.

I compile tested this on on PowerPC64, MIPS64, ARM, ARM64, i386 and
x86_64.

Please test whether this works with your toolchain / system!

Cheers,
Andre.

Andre Przywara (2):
Makefile: cleanup guest/init generation
Makefile: use xxd for converting guest/init

Makefile | 21 ++++++++++++---------
builtin-run.c | 8 ++++----
builtin-setup.c | 8 ++++----
3 files changed, 20 insertions(+), 17 deletions(-)

--
2.3.5