Jintao 50c46e6857 Add LingYao
Change-Id: Iae6634ce565940904ee320c678d0f77473bebb90
2025-01-03 16:08:55 +08:00

137 lines
2.6 KiB
Bash
Executable File

# SPDX-License-Identifier: GPL-2.0
#!/bin/bash
# common build rules useful for out-of-tree Linux driver builds
#
distro_info_dict=(/etc/anolis-release \
/etc/bclinux-release \
/etc/openEuler-release)
OS_KEY=""
distro_version=""
exit_not_found_failure() { exit 3; }
find_distro_info()
{
# Save the first valid kernel source path
for file in "${distro_info_dict[@]}"; do
if [ -f ${file} ]; then
distro_version=${file}
break
fi
done
}
get_os_key()
{
if [ -z "${distro_version}" ]; then
CFLAGS_KEY=""
return
fi
distro_info=`cat ${distro_version}`
if [ -z "${distro_info}" ]; then
echo "cat ${distro_info} is null"
fi
case $distro_info in
"Anolis OS release 8.8")
echo "You system is Anolis OS release 8.8"
OS_KEY="anolis-8.8"
CFLAGS_KEY="-DSNIC_ANOLIS_VERSION14"
;;
"Anolis OS release 8.6")
echo "You system is Anolis OS release 8.6"
OS_KEY="anolis-8.6"
CFLAGS_KEY="-DSNIC_ANOLIS_VERSION14"
;;
"BigCloud Enterprise Linux release 21.10U4 LTS")
echo "You system is BigCloud Enterprise Linux release 21.10U4 LTS"
OS_KEY="bclinux-21.10U4"
CFLAGS_KEY="-DBCLINUX2110U4"
;;
*)
echo "You system is $distro_info"
CFLAGS_KEY=""
OS_KEY="default"
;;
esac
}
usage() {
echo "Usage: $0 [all | anolis_kernel | openeuler_kernel | clean]"
echo "all : build all kernels"
echo "anolis_kernel : build snic with anolis 5.10.134-14"
echo "openeuler_kernel : build snic with openeuler 5.10.0-136.12"
echo "clean : clean the anolis the kernel"
exit 1
}
if [ $# -eq 0 ]; then
usage
fi
find_distro_info
get_os_key
case "$1" in
anolis_kernel)
echo "Build nic modules"
echo "build crete core modules"
cd crete-core
make EXTRA_CFLAGS="-DSNIC_ANOLIS_VERSION14"
make install
cd ..
echo "build crete pnic modules"
cd crete-pnic
make EXTRA_CFLAGS="-DSNIC_ANOLIS_VERSION14"
;;
openeuler_kernel)
echo "Build nic modules"
echo "build crete core modules"
cd crete-core
make clean
make EXTRA_CFLAGS="-DSNIC_OPENEULER_VERSION136"
make install
cd ..
echo "build crete pnic modules"
cd crete-pnic
make clean
make EXTRA_CFLAGS="-DSNIC_OPENEULER_VERSION136"
cd ../
echo "build crete vdpa modules"
cd crete-vnet
./build_euler.sh
;;
all)
echo "Build nic modules"
echo "build crete core modules"
echo "EXTRA_CFLAGS is $CFLAGS_KEY"
cd crete-core
make clean
make EXTRA_CFLAGS=$CFLAGS_KEY
cd ..
echo "build crete pnic modules"
cd crete-pnic
make clean
make EXTRA_CFLAGS=$CFLAGS_KEY
;;
clean)
echo "Clean build dir ......"
cd crete-core
make clean
cd ..
cd crete-pnic
make clean
;;
*)
usage
;;
esac
echo "Building kernel..."
echo "Building kernel..."