[PATCH kvmtool 0/1] Introduce LIBFDT_DIR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is based on the series that added the libfdt source files to the
kvmtool tree [1]. I've reconsidered the feedback I got from Andre and Will,
and so I came up with a different approach: the user can opt to compile
libdt without installing it system-wide and use LIBFDT_DIR to point kvmtool
to the static version of the library.

For example, to cross-compile for arm64:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LIBFDT_DIR=libfdt-arm64

For riscv:

$ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- LIBFDT_DIR=libfdt-riscv

where libfdt-arm64 and libfdt-riscv are the patch to libfdt compiled for
the arm64 and, respectively, the riscv architectures.

This approach is complementary to using the system libraries, it does not
replace them entirely like the previous approach.

Why is introducing LIBFDT_DIR a good idea? One might rightly argue that
installing the library requires only three extra instructions. The obvious
answer is that the user doesn't have the necessary permissions to install
the library.

And then is the fact that on my x86 machine I tried to install the shared
library for powerpc with two different compilers and I failed. When using
the bootlin stable compiler [2] (gcc-10.3.0) I got this error after
following the instructions in INSTALL:

         [..]
	 LD fdtget
/usr/bin/ld: libfdt/libfdt-1.6.1.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make: *** [Makefile:346: fdtget] Error 1

When using the powerpc64 crosscompiled from kernel.org [3], I wasn't even
able to compile libfdt because the cross-compiler is missing libc:

         [..]
	 CC libfdt/fdt.o
In file included from libfdt/libfdt_env.h:12,
                 from libfdt/fdt.c:6:
/home/alex/data/cross-compilers/x86-host/powerpc64-gcc-12.1.0-nolibc/powerpc64-linux/lib/gcc/powerpc64-linux/12.1.0/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
    9 | # include_next <stdint.h>
      |                ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:350: libfdt/fdt.o] Error 1

[1] https://lore.kernel.org/linux-arm-kernel/20220526171955.145563-1-alexandru.elisei@xxxxxxx/
[2] https://toolchains.bootlin.com/
[3] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.1.0/

Alexandru Elisei (1):
  Makefile: Introduce LIBFDT_DIR to specify libfdt location

 INSTALL  | 12 +++++++++++-
 Makefile | 29 ++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 8 deletions(-)

-- 
2.37.0

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux