Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5996573ybe; Tue, 10 Sep 2019 11:55:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkkki4g42wgo+2W1iXK87uE7ct4UnWIUbqbhEwk3Wa0krX14xhHwcCZAPyfOr4znxrlT8t X-Received: by 2002:a17:907:2065:: with SMTP id qp5mr25761124ejb.151.1568141732760; Tue, 10 Sep 2019 11:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141732; cv=none; d=google.com; s=arc-20160816; b=RpzMjLJhxsU4d0j8I/CDdlt8L8/Xv0oQjFWkSmt1Yx2V/snSZmalBAoToenxazp1X5 1eEb6/414lE5ceMxOniYPEw51mu4ugiN5JXkGG8iMHLuhB07lWToEZlM5oEEiSChAq29 MsXyAElJQL6HOo+7wknSDYdhP8hT0CgpF6DCggoY7Z7a+5Yy/6nB0Snu1lmTCouK/mG1 kJZUQJ0g+PSnrww5+FgdmfQtAxvNIRFKZWC3+UDHSvU5UHUjg9deHFON6GGji3UcteC2 tlvJ0M1kMkLOBBygpFq3IeeegdLIQeb1mOQOsI3QjSbC2th3cV/Pe1D2TdRdjWb6fLmw IXwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=aOBDMFi7PSb0gHyNeqqhWN1bJP3tg81RdsZh4BrKqUw=; b=iMiAvAb8FLPTYBBtA7RhFmK+3cjVMtcJfHDtkHIpE1J/UrZcQTNBdDnwyCKz7Nw9pB GjeuCheWqFrmIsQOayTrXjsuJFBgA7gPKV/fzV6kqfyTtTw3sa/NY2/V47WOUCXQ0QtQ qYAIJwvBrtmv+pi1rg4gzzMHUUHsMxYdOrV0uKqVQmlB/4vWCYu016+A7X/hP9DXJItR nT4ZzDO1hVEadkyqd67msK/w/WTDCC6hrfnxIqZ2+qrychYUHypJSRv/02a2dwvnzi3J jCnFvfoyYCoIdqFYQFA0ghCGJYKcvxdX8UmPxg7/FYgh3FjAhfImx87Ehh5DyHTVb7/0 P//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dZCGaEuJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si29si9829994ejb.75.2019.09.10.11.55.09; Tue, 10 Sep 2019 11:55:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dZCGaEuJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406277AbfIJKi4 (ORCPT + 99 others); Tue, 10 Sep 2019 06:38:56 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34617 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406251AbfIJKiy (ORCPT ); Tue, 10 Sep 2019 06:38:54 -0400 Received: by mail-lj1-f193.google.com with SMTP id h2so9385469ljk.1 for ; Tue, 10 Sep 2019 03:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aOBDMFi7PSb0gHyNeqqhWN1bJP3tg81RdsZh4BrKqUw=; b=dZCGaEuJIGUCPQEGK33Sn/a9ZXr1W2in9EPfmjnbwJAMCekhG6gPrUKBXtM9dA6Bua CO0ROLT22y9S3G5cB0fUS+NwtMDzJr6+L13qfksUvKAEex3h114d1QzyYZ8sZ6IjKuSt rkwhMTdhR2vjcycIZ/U4KfP6/DGiUOHzrf1z1Ykp5RNNE8nDy3evu9ck5pH876DEllqg sRw/k+zeukJc80NgALQN0hag/HPBhscdR5rSFY7PjS3o0+DYv3vwXnmOn0f1CoV9/JzP FG5HBwd3LzjMCIpehQQdiNtCwLoUdPyT7QvAmxLutks5bbQM/+usVCkuxFOtnq0+Q2uv 9New== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aOBDMFi7PSb0gHyNeqqhWN1bJP3tg81RdsZh4BrKqUw=; b=JcltRPH6rOIFmClWG/sUCP5cBgyIEJwbXecMwrhHeAV+8cHnuj39/a2BqIEQvfq6Zw ixdxmlRjBZxFMFnk8pA5AIT7JinHkaslrfKfUcBJmgjUDMGZ8S6U50NmB0ZKw/epRBR7 EOR1F1Ik47wGoumaW8zkUfYmHquTTZtIqiuMhOjEqTu5FIOxun2kvT7LHg5eHVcpw+DV RVWZj/5HZBNSRwDfiZYiPdOozEtPNkz5wHQmGOObOfQJlbWHz/rsf5+qzvxCazS7gt2q mRYk6UAB1nyyFc/IpPWsnVpGrv5zCd9cZRpoOj4B4ZXhp+jMnjhm1fnPaMGrRInaQ8hC HGVA== X-Gm-Message-State: APjAAAWkngTwVRmOFcyhVV0GTMccgi2pPXRbuz0fxE2qgTWREaZ9mJeC PZH8DFBgki+Cvbn/69qnRVXH0A== X-Received: by 2002:a2e:8012:: with SMTP id j18mr19477348ljg.36.1568111930993; Tue, 10 Sep 2019 03:38:50 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id g5sm4005563lfh.2.2019.09.10.03.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 03:38:50 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH bpf-next 11/11] samples: bpf: makefile: add sysroot support Date: Tue, 10 Sep 2019 13:38:30 +0300 Message-Id: <20190910103830.20794-12-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> References: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Basically it only enables that was added by previous couple fixes. For sure, just make tools/include to be included after sysroot headers. export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- make samples/bpf/ SYSROOT="path/to/sysroot" Sysroot contains correct libs installed and its headers ofc. Useful when working with NFC or virtual machine. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 +++++ samples/bpf/README.rst | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4edc5232cfc1..68ba78d1dbbe 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -177,6 +177,11 @@ ifeq ($(ARCH), arm) CLANG_EXTRA_CFLAGS := $(D_OPTIONS) endif +ifdef SYSROOT +ccflags-y += --sysroot=${SYSROOT} +PROGS_LDFLAGS := -L${SYSROOT}/usr/lib +endif + ccflags-y += -I$(objtree)/usr/include ccflags-y += -I$(srctree)/tools/lib/bpf/ ccflags-y += -I$(srctree)/tools/testing/selftests/bpf/ diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst index 5f27e4faca50..786d0ab98e8a 100644 --- a/samples/bpf/README.rst +++ b/samples/bpf/README.rst @@ -74,3 +74,13 @@ samples for the cross target. export ARCH=arm64 export CROSS_COMPILE="aarch64-linux-gnu-" make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang + +If need to use environment of target board (headers and libs), the SYSROOT +also can be set, pointing on FS of target board: + +export ARCH=arm64 +export CROSS_COMPILE="aarch64-linux-gnu-" +make samples/bpf/ SYSROOT=~/some_sdk/linux-devkit/sysroots/aarch64-linux-gnu + +Setting LLC and CLANG is not necessarily if it's installed on HOST and have +in its targets appropriate arch triple (usually it has several arches). -- 2.17.1