From patchwork Fri Jul 22 14:14:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 12926526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0831C43334 for ; Fri, 22 Jul 2022 14:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=t+vse5ZJXD4FNAsOBp9ZPdxKvYfx+aCoIIA42TLW/14=; b=cFQqO0t2Pb4fBA lIrRUtdlxVqIiJuHMstFTnsxw+1P1pY/RYyWPsds7mURm1jn/yh8Himge6Z+eiLN/ukOLuW4LHVwC r3lPck3PiuQeopScLGuQOY2I5SpnBcn7KrRMTE2QYHXYiNDSuOsBJlBekCk/MElAQUYZTCxXkXtZD liXOjCdlokhRjIwKTJUTmbp1j7E17gZQlJ3bR2mV76LhlDCaYb9KbGYYHEveiCncXfIrEya5rdsie ym4uHUJUopfpfLEG8lKnBTCLdaDzsz2a0xtLJglexCCvHFky5XLC31+VkiUlMIpZNHFs4N43UuLJ8 ZzGefdOnFdxbURV+W/fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEtQ9-005qS7-GT; Fri, 22 Jul 2022 14:14:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEtQ6-005qHs-EZ for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2022 14:14:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4BD6D1063; Fri, 22 Jul 2022 07:14:18 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 15AFF3F70D; Fri, 22 Jul 2022 07:14:15 -0700 (PDT) From: Alexandru Elisei To: will@kernel.org, julien.thierry.kdev@gmail.com, maz@kernel.org, andre.przywara@arm.com, suzuki.poulose@arm.com, james.morse@arm.com, vladimir.murzin@arm.com, anup@brainfault.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH kvmtool 0/1] Introduce LIBFDT_DIR Date: Fri, 22 Jul 2022 15:14:47 +0100 Message-Id: <20220722141448.168252-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220722_071422_554683_B8D6FC5D X-CRM114-Status: GOOD ( 16.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 | ^~~~~~~~~~ compilation terminated. make: *** [Makefile:350: libfdt/fdt.o] Error 1 [1] https://lore.kernel.org/linux-arm-kernel/20220526171955.145563-1-alexandru.elisei@arm.com/ [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(-)