[v4,bpf-next,14/15] samples/bpf: add sysroot support

Message ID 20191009204134.26960-15-ivan.khoronzhuk@linaro.org
State Superseded
Headers show
  • samples: bpf: improve/fix cross-compilation
Related show

Commit Message

Ivan Khoronzhuk Oct. 9, 2019, 8:41 p.m.
Basically it only enables that was added by previous couple fixes.
Sysroot contains correct libs installed and its headers. Useful when
working with NFC or virtual machine.

Usage example:

clean (on demand)
    make ARCH=arm -C samples/bpf clean
    make ARCH=arm -C tools clean
    make ARCH=arm clean

configure and install headers:

    make ARCH=arm defconfig
    make ARCH=arm headers_install

build samples/bpf:
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- samples/bpf/ \

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

 samples/bpf/Makefile | 5 +++++
 1 file changed, 5 insertions(+)



diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 6b161326ac67..4df11ddb9c75 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -187,6 +187,11 @@  TPROGS_CFLAGS += -I$(srctree)/tools/lib/
 TPROGS_CFLAGS += -I$(srctree)/tools/include
 TPROGS_CFLAGS += -I$(srctree)/tools/perf
+ifdef SYSROOT
+TPROGS_CFLAGS += --sysroot=$(SYSROOT)
 TPROGCFLAGS_bpf_load.o += -Wno-unused-variable