From patchwork Tue Sep 10 10:38:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173503 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5609834ilq; Tue, 10 Sep 2019 03:38:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGNdq2VIX+SJfTTs1vbXyn19vJnyN5gu9Ph6Yt5W2V9YGB76TYEZ6jEff/aVadeH/c+TNE X-Received: by 2002:a50:b0c6:: with SMTP id j64mr29778493edd.267.1568111937398; Tue, 10 Sep 2019 03:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568111937; cv=none; d=google.com; s=arc-20160816; b=K+CSKxFUudUx2BzyoSmNtUO+9l9CVi5e/W7ZD4DaXcorZhkLJ0FYYn8wru+0GTYsqW JeplePf2yWTVIzERtXu+mM4W/6NBXheyeC+y21xDQbOPswtc0R237PVTbN1KqQkEiZQD hcc+ADI3Q8XF0NNvlfXcuxgtRRKrE0Ei35pQxR8K4UGMnIHiOy5/C/Hu1wwGgpd6IdoF yuOlyHcPJQsG9nZTPlSsTIBvX5Pz9ZUXyxaVX9OBOI9O3koyzyL3T9e93t4Ag/dP/Se0 FQRU6pbraqiTzUE8XDBvKpvRu+Ftg5kzrOeuBVTJ0Z0aX/PkWugERoK2zec2+wTZWvB4 i7Xg== 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=K6rLgDypbdtg3ZmnkTXxoJi0aIvDUCxNdHfKL+m2rXFGU8EMP+UAJ73jdyj+yMEK0p Fzp7nnSN1Qhvyl0MCSjab+khui1gEWdaVW/pE9ABl9GcaNyz33tTJLVotRANGye+c37O 68YHN0mzHkF/zdE/yPBL7qK8vAoBZFiXg5IFEpHnhCsrywBLSCkfhHGCIe/AHLFKtcbJ GmM2rfDRVifYAT+XSt3OsA/K3pbgLwiNzZ97ccthcL1s00/LmalDE3LX+rN9Uur390e6 G6tO0nDlogecnH2bqaPJqFvoOz4e6pBHbujYREYr+Dh3UlsG/mub/FQEJj1LrsfwQ4wU G5eQ== 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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 z2si8849107ejr.360.2019.09.10.03.38.57; Tue, 10 Sep 2019 03:38:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S2406264AbfIJKi4 (ORCPT + 8 others); Tue, 10 Sep 2019 06:38:56 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44442 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406215AbfIJKix (ORCPT ); Tue, 10 Sep 2019 06:38:53 -0400 Received: by mail-lj1-f194.google.com with SMTP id u14so15867048ljj.11 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=pAS/SgGz/F3Zyq6DyFzp5rMD6+Nr+mkIugWHiBodrIA8pnU7+IMN7+Xmih9oL/HSsq yKAzeKfMnsgrszzi0YX8W4SX1Rke5GqspSU0K2aYD3DLBRBRei5qq/EwfLly2ufNau/I p5wC0R0/CYxnW33ZsV9J8SXi4zNYSdaDOMjhbYAQu/6MDjaTNgYm9PT+8mpzT72jgtvd M0AyU08sz5zizsnoX4gtOIM81YE3YF7FPgQp8c2/TxF+RKu/06WoqkuYv4OTsWFcCxP9 wqgTHeSHva2yC+nfWK+kZWfcMHHzMiebmKa/Ja1mA6g2CBxIY5yeosRmvI92MndYSxz9 UPhg== X-Gm-Message-State: APjAAAWoPT/q1DQGTDXrlfbIbra2YWQvHeLInyf9P9iN4rgcNQnh1Egi bQKld0Ex2Z8ek6L9Ca9Odq27yQ== 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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(+) -- 2.17.1 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).