__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
#!/bin/bash
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

case $1 in
	-h|--help)
		echo -e "$0 [-j <n>]"
		echo -e "\tTest the different ways of building bpftool."
		echo -e ""
		echo -e "\tOptions:"
		echo -e "\t\t-j <n>:\tPass -j flag to 'make'."
		exit 0
		;;
esac

J=$*

# Assume script is located under tools/testing/selftests/bpf/. We want to start
# build attempts from the top of kernel repository.
SCRIPT_REL_PATH=$(realpath --relative-to=$PWD $0)
SCRIPT_REL_DIR=$(dirname $SCRIPT_REL_PATH)
KDIR_ROOT_DIR=$(realpath $PWD/$SCRIPT_REL_DIR/../../../../)
cd $KDIR_ROOT_DIR
if [ ! -e tools/bpf/bpftool/Makefile ]; then
	echo -e "skip:    bpftool files not found!\n"
	exit 4 # KSFT_SKIP=4
fi

ERROR=0
TMPDIR=

# If one build fails, continue but return non-0 on exit.
return_value() {
	if [ -d "$TMPDIR" ] ; then
		rm -rf -- $TMPDIR
	fi
	exit $ERROR
}
trap return_value EXIT

check() {
	local dir=$(realpath $1)

	echo -n "binary:  "
	# Returns non-null if file is found (and "false" is run)
	find $dir -type f -executable -name bpftool -print -exec false {} + && \
		ERROR=1 && printf "FAILURE: Did not find bpftool\n"
}

make_and_clean() {
	echo -e "\$PWD:    $PWD"
	echo -e "command: make -s $* >/dev/null"
	make $J -s $* >/dev/null
	if [ $? -ne 0 ] ; then
		ERROR=1
	fi
	if [ $# -ge 1 ] ; then
		check ${@: -1}
	else
		check .
	fi
	(
		if [ $# -ge 1 ] ; then
			cd ${@: -1}
		fi
		make -s clean
	)
	echo
}

make_with_tmpdir() {
	local ARGS

	TMPDIR=$(mktemp -d)
	if [ $# -ge 2 ] ; then
		ARGS=${@:1:(($# - 1))}
	fi
	echo -e "\$PWD:    $PWD"
	echo -e "command: make -s $ARGS ${@: -1}=$TMPDIR/ >/dev/null"
	make $J -s $ARGS ${@: -1}=$TMPDIR/ >/dev/null
	if [ $? -ne 0 ] ; then
		ERROR=1
	fi
	check $TMPDIR
	rm -rf -- $TMPDIR
	echo
}

echo "Trying to build bpftool"
echo -e "... through kbuild\n"

if [ -f ".config" ] ; then
	make_and_clean tools/bpf
	## "make tools/bpf" sets $(OUTPUT) to ...tools/bpf/runqslower for
	## runqslower, but the default (used for the "clean" target) is .output.
	## Let's make sure we clean runqslower's directory properly.
	make -C tools/bpf/runqslower OUTPUT=${KDIR_ROOT_DIR}/tools/bpf/runqslower/ clean

	## $OUTPUT is overwritten in kbuild Makefile, and thus cannot be passed
	## down from toplevel Makefile to bpftool's Makefile.

	# make_with_tmpdir tools/bpf OUTPUT
	echo -e "skip:    make tools/bpf OUTPUT=<dir> (not supported)\n"

	make_with_tmpdir tools/bpf O
else
	echo -e "skip:    make tools/bpf (no .config found)\n"
	echo -e "skip:    make tools/bpf OUTPUT=<dir> (not supported)\n"
	echo -e "skip:    make tools/bpf O=<dir> (no .config found)\n"
fi

echo -e "... from kernel source tree\n"

make_and_clean -C tools/bpf/bpftool

make_with_tmpdir -C tools/bpf/bpftool OUTPUT

make_with_tmpdir -C tools/bpf/bpftool O

echo -e "... from tools/\n"
cd tools/

make_and_clean bpf

## In tools/bpf/Makefile, function "descend" is called and passes $(O) and
## $(OUTPUT). We would like $(OUTPUT) to have "bpf/bpftool/" appended before
## calling bpftool's Makefile, but this is not the case as the "descend"
## function focuses on $(O)/$(subdir). However, in the present case, updating
## $(O) to have $(OUTPUT) recomputed from it in bpftool's Makefile does not
## work, because $(O) is not defined from command line and $(OUTPUT) is not
## updated in tools/scripts/Makefile.include.
##
## Workarounds would require to a) edit "descend" or use an alternative way to
## call bpftool's Makefile, b) modify the conditions to update $(OUTPUT) and
## other variables in tools/scripts/Makefile.include (at the risk of breaking
## the build of other tools), or c) append manually the "bpf/bpftool" suffix to
## $(OUTPUT) in bpf's Makefile, which may break if targets for other directories
## use "descend" in the future.

# make_with_tmpdir bpf OUTPUT
echo -e "skip:    make bpf OUTPUT=<dir> (not supported)\n"

make_with_tmpdir bpf O

echo -e "... from bpftool's dir\n"
cd bpf/bpftool

make_and_clean

make_with_tmpdir OUTPUT

make_with_tmpdir O

Filemanager

Name Type Size Permission Actions
benchs Folder 0755
test_kmods Folder 0755
Makefile File 33.38 KB 0644
Makefile.docs File 2.15 KB 0644
ima_setup.sh File 3.26 KB 0755
test_bpftool.sh File 415 B 0755
test_bpftool_build.sh File 3.9 KB 0755
test_bpftool_metadata.sh File 1.63 KB 0755
test_doc_build.sh File 638 B 0755
test_ftrace.sh File 786 B 0755
test_kmod.sh File 1.46 KB 0755
test_lirc_mode2.sh File 764 B 0755
test_lwt_ip_encap.sh File 14.55 KB 0755
test_lwt_seg6local.sh File 6.11 KB 0755
test_tc_edt.sh File 2.75 KB 0755
test_tc_tunnel.sh File 7.82 KB 0755
test_tunnel.sh File 14.26 KB 0755
test_xdp_features.sh File 2.5 KB 0755
test_xdp_redirect_multi.sh File 6.18 KB 0755
test_xdp_vlan.sh File 5.89 KB 0755
test_xdp_vlan_mode_generic.sh File 186 B 0755
test_xdp_vlan_mode_native.sh File 180 B 0755
test_xdping.sh File 2.12 KB 0755
test_xsk.sh File 5.31 KB 0755
verify_sig_setup.sh File 2.73 KB 0755
vmtest.sh File 11.19 KB 0755
with_addr.sh File 1.27 KB 0755
with_tunnels.sh File 693 B 0755
xsk_prereqs.sh File 1.48 KB 0755
Filemanager