Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/bpf: Remove xxd util dependency

The verification signature header generation requires converting a
binary certificate to a C array. Previously this only worked with
xxd (part of vim-common package).
As xxd may not be available on some systems building selftests, it makes
sense to substitute it with more common utils: hexdump, wc, sed to
generate equivalent C array output.

Tested by generating header with both xxd and hexdump and comparing
them.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/20260128190552.242335-1-mykyta.yatsenko5@gmail.com

authored by

Mykyta Yatsenko and committed by
Andrii Nakryiko
b640d556 ba225407

+6 -5
-1
tools/testing/selftests/bpf/.gitignore
··· 23 23 test_libbpf 24 24 xdping 25 25 test_cpp 26 - test_progs_verification_cert 27 26 *.d 28 27 *.subskel.h 29 28 *.skel.h
+6 -4
tools/testing/selftests/bpf/Makefile
··· 720 720 $(Q)mkdir -p $(BUILD_DIR) 721 721 $(Q)$(VERIFY_SIG_SETUP) genkey $(BUILD_DIR) 722 722 723 + # Generates a header with C array declaration, containing test_progs_verification_cert bytes 723 724 $(VERIFY_SIG_HDR): $(VERIFICATION_CERT) 724 - $(Q)ln -fs $< test_progs_verification_cert && \ 725 - xxd -i test_progs_verification_cert > $@ 725 + $(Q)(echo "unsigned char test_progs_verification_cert[] = {"; \ 726 + hexdump -v -e '12/1 " 0x%02x," "\n"' $< | sed 's/0x ,//g; $$s/,$$//'; \ 727 + echo "};"; \ 728 + echo "unsigned int test_progs_verification_cert_len = $$(wc -c < $<);") > $@ 726 729 727 730 # Define test_progs test runner. 728 731 TRUNNER_TESTS_DIR := prog_tests ··· 901 898 *.BTF *.BTF_ids *.BTF.base \ 902 899 no_alu32 cpuv4 bpf_gcc \ 903 900 liburandom_read.so) \ 904 - $(OUTPUT)/FEATURE-DUMP.selftests \ 905 - test_progs_verification_cert 901 + $(OUTPUT)/FEATURE-DUMP.selftests 906 902 907 903 .PHONY: docs docs-clean 908 904