From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
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 <ivan.khoronzhuk@linaro.org>
Subject: [PATCH bpf-next 00/11] samples: bpf: improve/fix cross-compilation
Date: Tue, 10 Sep 2019 13:38:19 +0300 [thread overview]
Message-ID: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> (raw)
This series contains mainly fixes/improvements for cross-compilation
but not only, tested for arm, arm64, but intended for any arch.
Also verified on native build (not cross compilation) for x86_64
and arm.
Initial RFC link:
https://lkml.org/lkml/2019/8/29/1665
Prev. version:
https://www.spinics.net/lists/netdev/msg597823.html
Besides the patches given here, the RFC also contains couple patches
related to llvm clang
arm: include: asm: swab: mask rev16 instruction for clang
arm: include: asm: unified: mask .syntax unified for clang
They are necessarily to verify arm build.
The change touches not only cross-compilation and can have impact on
other archs and build environments, so might be good idea to verify
it in order to add appropriate changes, some warn options could be
tuned also.
All is tasted on x86-64 with clang installed (has to be built containing
targets for arm, arm64..., see llvm -v, usually it's present already)
Instructions to test native on x86_64
=================================================
Native build on x86_64 is done in usual way and shouldn't have difference
except HOSTCC is now printed as CC wile building the samples.
Instructions to test cross compilation on arm64
=================================================
#Toolchain used for test:
gcc version 8.3.0
(GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))
# Get some arm64 FS, containing at least libelf
I've used sdk for TI am65x got here:
http://downloads.ti.com/processor-sdk-linux/esd/AM65X/latest/exports/\
ti-processor-sdk-linux-am65xx-evm-06.00.00.07-Linux-x86-Install.bin
# Install this binary to some dir, say "sdk".
# Configure kernel (use defconfig as no matter), but clean everything
# before.
make ARCH=arm64 -C tools/ clean
make ARCH=arm64 -C samples/bpf clean
make ARCH=arm64 clean
make ARCH=arm64 defconfig
# The kernel version used in sdk doesn't correspond to checked one,
# but for this verification only headers need to be syched,
# so install them:
make ARCH=arm64 headers_install
# or on SDK if need keep them in sync (not necessarily to verify):
make ARCH=arm64 INSTALL_HDR_PATH=/../sdk/\
ti-processor-sdk-linux-am65xx-evm-06.00.00.07/linux-devkit/sysroots/\
aarch64-linux/usr headers_install
# Build samples
make samples/bpf/ ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-"\
SYSROOT="/../sdk/ti-processor-sdk-linux-am65xx-evm-06.00.00.07/\
linux-devkit/sysroots/aarch64-linux"
Instructions to test cross compilation on arm
=================================================
#Toolchains used for test:
arm-linux-gnueabihf-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011
or
arm-linux-gnueabihf-gcc
(GNU Toolchain for the A-profile Architecture 8.3-2019.03 \
(arm-rel-8.36)) 8.3.0
# Get some FS, I've used sdk for TI am52xx got here:
http://downloads.ti.com/processor-sdk-linux/esd/AM57X/05_03_00_07/exports/\
ti-processor-sdk-linux-am57xx-evm-05.03.00.07-Linux-x86-Install.bin
# Install this binary to some dir, say "sdk".
# Configure kernel, but clean everything before.
make ARCH=arm -C tools/ clean
make ARCH=arm -C samples/bpf clean
make ARCH=arm clean
make ARCH=arm omap2plus_defconfig
# The kernel version used in sdk doesn't correspond to checked one, but
headers only should be synched, so install them:
make ARCH=arm64 headers_install
# or on SDK if need keep them in sync (not necessarily):
make ARCH=arm INSTALL_HDR_PATH=/../sdk/\
ti-processor-sdk-linux-am57xx-evm-05.03.00.07/linux-devkit/sysroots/\
armv7ahf-neon-linux-gnueabi/usr headers_install
# Build samples
make samples/bpf/ ARCH=arm CROSS_COMPILE="arm-linux-gnueabihf-"\
SYSROOT="/../sdk/ti-processor-sdk-linux-am57xx-evm-05.03\
.00.07/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi"
Based on bpf-next/master
v2..v1:
- restructured patches order
- split "samples: bpf: Makefile: base progs build on Makefile.progs"
to make change more readable. It added couple nice extra patches.
- removed redundant patch:
"samples: bpf: Makefile: remove target for native build"
- added fix:
"samples: bpf: makefile: fix cookie_uid_helper_example obj build"
- limited -D option filter only for arm
- improved comments
- added couple instructions to verify cross compilation for arm and
arm64 arches based on TI am57xx and am65xx sdks.
- corrected include a little order
Ivan Khoronzhuk (11):
samples: bpf: makefile: fix HDR_PROBE "echo"
samples: bpf: makefile: fix cookie_uid_helper_example obj build
samples: bpf: makefile: use --target from cross-compile
samples: bpf: use own EXTRA_CFLAGS for clang commands
samples: bpf: makefile: use D vars from KBUILD_CFLAGS to handle
headers
samples: bpf: makefile: drop unnecessarily inclusion for bpf_load
samples: bpf: add makefile.prog for separate CC build
samples: bpf: makefile: base progs build on makefile.progs
samples: bpf: makefile: use CC environment for HDR_PROBE
libbpf: makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf
targets
samples: bpf: makefile: add sysroot support
samples/bpf/Makefile | 172 ++++++++++++++++++++++----------------
samples/bpf/Makefile.prog | 77 +++++++++++++++++
samples/bpf/README.rst | 10 +++
tools/lib/bpf/Makefile | 11 ++-
4 files changed, 194 insertions(+), 76 deletions(-)
create mode 100644 samples/bpf/Makefile.prog
--
2.17.1
next reply other threads:[~2019-09-10 10:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 10:38 Ivan Khoronzhuk [this message]
2019-09-10 10:38 ` [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo" Ivan Khoronzhuk
2019-09-10 10:46 ` Sergei Shtylyov
2019-09-10 14:54 ` Ivan Khoronzhuk
2019-09-11 11:02 ` Sergei Shtylyov
2019-09-13 19:56 ` Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 02/11] samples: bpf: makefile: fix cookie_uid_helper_example obj build Ivan Khoronzhuk
2019-09-13 20:48 ` Yonghong Song
2019-09-13 21:25 ` Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 03/11] samples: bpf: makefile: use --target from cross-compile Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 04/11] samples: bpf: use own EXTRA_CFLAGS for clang commands Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 05/11] samples: bpf: makefile: use D vars from KBUILD_CFLAGS to handle headers Ivan Khoronzhuk
2019-09-13 21:12 ` Yonghong Song
2019-09-13 21:24 ` Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 06/11] samples: bpf: makefile: drop unnecessarily inclusion for bpf_load Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 07/11] samples: bpf: add makefile.prog for separate CC build Ivan Khoronzhuk
2019-09-13 21:33 ` Yonghong Song
2019-09-13 22:14 ` Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 08/11] samples: bpf: makefile: base progs build on makefile.progs Ivan Khoronzhuk
2019-09-13 21:41 ` Yonghong Song
2019-09-13 22:25 ` Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 09/11] samples: bpf: makefile: use CC environment for HDR_PROBE Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 10/11] libbpf: makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets Ivan Khoronzhuk
2019-09-13 21:43 ` Yonghong Song
2019-09-13 22:33 ` Ivan Khoronzhuk
2019-09-10 10:38 ` [PATCH bpf-next 11/11] samples: bpf: makefile: add sysroot support Ivan Khoronzhuk
2019-09-13 21:45 ` Yonghong Song
2019-09-13 22:36 ` Ivan Khoronzhuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190910103830.20794-1-ivan.khoronzhuk@linaro.org \
--to=ivan.khoronzhuk@linaro.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=jakub.kicinski@netronome.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).