代码拉取完成,页面将自动刷新
同步操作将从 openEuler/Kmesh 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# libboundscheck is not available in some environments, install by source
function install_libboundscheck() {
if [ ! -f /usr/local/lib/libboundscheck.so ]; then
git clone https://github.com/openeuler-mirror/libboundscheck.git
cd libboundscheck
make CC=gcc
cp lib/libboundscheck.so /usr/local/lib
cp include/* /usr/include
cd ../
rm -rf libboundscheck
fi
}
function dependency_pkg_install() {
if command -v apt > /dev/null; then
# apt install
apt-get update && apt-get install -y git make clang libbpf-dev llvm linux-tools-generic protobuf-compiler libprotobuf-dev libprotobuf-c-dev protobuf-c-compiler cmake pkg-config
install_libboundscheck
elif command -v yum > /dev/null; then
# yum install
yum install -y git make clang llvm libboundscheck protobuf protobuf-c protobuf-c-devel bpftool libbpf libbpf-devel cmake pkg-config
fi
}
# fix bug in libbpf
function fix_libbpf_bug() {
if ! grep -iq "#define SEC(name) __attribute__((section(name), used))" /usr/include/bpf/bpf_helpers.h; then
LINENUMBER=$(grep -n '#define SEC(name)' /usr/include/bpf/bpf_helpers.h | cut -f1 -d:)
if [[ ! -z "$LINENUMBER" ]]; then
sed -i "${LINENUMBER} i #if __GNUC__ && !__clang__\n#define SEC(name) __attribute__((section(name), used))\n#else" /usr/include/bpf/bpf_helpers.h
LINENUMBER=$((LINENUMBER+8))
sed -i "${LINENUMBER} a \\#endif" /usr/include/bpf/bpf_helpers.h
fi
fi
}
function adapt_low_version_kernel() {
# adapt less insn in kernel 4.19, only 4096, so modify KMESH_PER_ENDPOINT_NUM into 15
if [ "$(uname -r | cut -d '.' -f 1)" -le 4 ]; then
sed -i 's/\(KMESH_PER_ENDPOINT_NUM\).*/\1 15/g' bpf/kmesh/ads/include/config.h
fi
}
# Special case:
# There is a structure that is only defined in certain environments and is
# only used during the compilation stage. Therefore, the definition of this
# structure in the include directory is dynamically adjusted according to
# the current compilation environment during compilation.
function adapt_include_env {
if grep -q "struct bpf_mem_ptr {" /usr/include/linux/bpf.h; then
sed -i '/bpf_mem_ptr/{N;N;N;N;d;}' bpf/kmesh/ads/include/kmesh_common.h
fi
}
dependency_pkg_install
fix_libbpf_bug
adapt_low_version_kernel
adapt_include_env
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。