1function install_qat() { 2 if ! hash yasm; then 3 install yasm 4 fi 5 6 in_syms() { 7 local syms 8 if [[ -e /proc/kallsyms ]]; then 9 syms=/proc/kallsyms 10 elif [[ -e /boot/System.map-$kernel_ver ]]; then 11 syms=/boot/System.map-$kernel_ver 12 else 13 return 0 14 fi 15 16 grep -q "$1" "$syms" 17 } 18 19 if [[ -e /sys/module/qat_c62x ]]; then 20 sudo modprobe -r qat_c62x || : 21 fi 22 if [[ -d $GIT_REPOS/QAT ]]; then 23 sudo rm -rf "$GIT_REPOS/QAT" 24 fi 25 26 mkdir "$GIT_REPOS/QAT" 27 28 tar -C "$GIT_REPOS/QAT" -xzof - < <(wget -O- "$DRIVER_LOCATION_QAT") 29 30 if ge "$kernel_ver" 6.3.0; then 31 patch --dir="$GIT_REPOS/QAT" -p1 32 fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-iommu_map.patch" 33 34 if ge "$kernel_ver" 6.4.0; then 35 patch --dir="$GIT_REPOS/QAT" -p1 \ 36 < "$rootdir/test/common/config/pkgdep/patches/qat/0001-driver-core+semaphore.patch" 37 patch --dir="$GIT_REPOS/QAT" -p1 \ 38 < "$rootdir/test/common/config/pkgdep/patches/qat/0001-algapi.patch" 39 fi 40 41 patch --dir="$GIT_REPOS/QAT" -p1 \ 42 < "$rootdir/test/common/config/pkgdep/patches/qat/0001-no-vmlinux.patch" 43 44 (cd "$GIT_REPOS/QAT" && sudo ./configure --enable-icp-sriov=host && sudo make install) 45 46 if ! sudo service qat_service start; then 47 echo "failed to start the qat service. Something may be wrong with your device or package." 48 fi 49} 50 51function install_rocksdb() { 52 # Rocksdb is installed for use with the blobfs tests. 53 if [ ! -d /usr/src/rocksdb ]; then 54 git clone "${GIT_REPO_ROCKSDB}" "$GIT_REPOS/rocksdb" 55 git -C "$GIT_REPOS/rocksdb" checkout 6.15.fb 56 sudo mv "$GIT_REPOS/rocksdb" /usr/src/ 57 else 58 sudo git -C /usr/src/rocksdb checkout 6.15.fb 59 echo "rocksdb already in /usr/src. Not checking out again" 60 fi 61} 62 63function install_fio() { 64 # This version of fio is installed in /usr/src/fio to enable 65 # building the spdk fio plugin. 66 local fio_version="fio-3.35" 67 68 if [ ! -d /usr/src/fio ]; then 69 if [ ! -d fio ]; then 70 git clone "${GIT_REPO_FIO}" "$GIT_REPOS/fio" 71 sudo mv "$GIT_REPOS/fio" /usr/src/ 72 else 73 sudo mv "$GIT_REPOS/fio" /usr/src/ 74 fi 75 ( 76 git -C /usr/src/fio checkout master \ 77 && git -C /usr/src/fio pull \ 78 && git -C /usr/src/fio checkout $fio_version \ 79 && if [ $OSID == 'freebsd' ]; then 80 gmake -C /usr/src/fio -j${jobs} \ 81 && sudo gmake -C /usr/src/fio install 82 else 83 make -C /usr/src/fio -j${jobs} \ 84 && sudo make -C /usr/src/fio install 85 fi 86 ) 87 else 88 echo "fio already in /usr/src/fio. Not installing" 89 fi 90} 91 92function install_flamegraph() { 93 # Flamegraph is used when printing out timing graphs for the tests. 94 if [ ! -d /usr/local/FlameGraph ]; then 95 git clone "${GIT_REPO_FLAMEGRAPH}" "$GIT_REPOS/FlameGraph" 96 mkdir -p /usr/local 97 sudo mv "$GIT_REPOS/FlameGraph" /usr/local/FlameGraph 98 else 99 echo "flamegraph already installed. Skipping" 100 fi 101} 102 103function _install_qemu() { 104 local repo=$1 105 local branch=$2 106 local prefix=${3:-} 107 local name=${4:-} 108 109 mkdir -p "$GIT_REPOS/qemu" 110 111 local repo_dir=$GIT_REPOS/qemu/$branch 112 if [[ -n $prefix ]]; then 113 repo_dir=$GIT_REPOS/qemu/$prefix-$branch 114 fi 115 116 if [[ ! -d $repo_dir ]]; then 117 git clone "$repo" -b "$branch" "$repo_dir" 118 else 119 echo "qemu already checked out. Skipping" 120 fi 121 122 declare -a opt_params=("--prefix=/usr/local/qemu/${repo_dir##*/}") 123 declare -a extra_cflags=() 124 125 opt_params+=("--disable-docs") 126 if ((gcc_version >= 9)); then 127 opt_params+=("--disable-glusterfs") 128 fi 129 130 extra_cflags+=("-Wno-error") 131 132 # Most tsocks proxies rely on a configuration file in /etc/tsocks.conf. 133 # If using tsocks, please make sure to complete this config before trying to build qemu. 134 if [[ $INSTALL_TSOCKS == true && $NO_TSOCKS != true ]]; then 135 if hash tsocks 2> /dev/null; then 136 opt_params+=("--with-git='tsocks git'") 137 fi 138 fi 139 opt_params+=("--extra-cflags=${extra_cflags[*]}") 140 141 if [[ $prefix == vanilla ]]; then 142 # Latest qemu seems to take sysconfdir from the prefix and instead of checking /etc 143 # it looks under /usr/local/qemu/vanilla*/bin/../etc which is a bit peculiar. Fix it. 144 opt_params+=("--sysconfdir=/etc/") 145 fi 146 147 # The qemu configure script places several output files in the CWD. 148 (cd "$repo_dir" && ./configure "${opt_params[@]}" --target-list="x86_64-softmmu" --enable-kvm --enable-linux-aio --enable-numa) 149 150 make -C "$repo_dir" -j${jobs} 151 sudo make -C "$repo_dir" install 152 153 # Add a symlink to point at a latest build - this is useful to easily track QEMU flavors for which 154 # branches change quite often (e.g. vfio-user's). 155 [[ -n $name ]] || return 0 156 [[ -L /usr/local/qemu/$name-latest ]] && sudo rm "/usr/local/qemu/$name-latest" 157 sudo ln -s "/usr/local/qemu/${repo_dir##*/}" "/usr/local/qemu/$name-latest" 158} 159 160function install_qemu() { 161 # Four versions of QEMU are used in the tests, three are installed 162 # directly from the source. Each QEMU is dedicated for different 163 # use-cases: 164 # - Packed QEMU: version provided by given distro. Used to boot VMs 165 # from within vhost tests. 166 # - vfio-user QEMU: A special fork to test libvfio-user components. 167 # - Vanilla QEMU: Used by the CI to boot the testing VMs. 168 169 _install_qemu $GIT_REPO_QEMU_VFIO $VFIO_QEMU_BRANCH "" vfio-user 170 _install_qemu "$GIT_REPO_QEMU" "$VANILLA_QEMU_BRANCH" vanilla vanilla 171} 172 173function install_nvmecli() { 174 # nvme-cli >1.11.1 should be used. 175 rm -rf "$GIT_REPOS/nvme-cli-cuse" 176 git clone "https://github.com/linux-nvme/nvme-cli.git" "$GIT_REPOS/nvme-cli-cuse" 177 git -C "$GIT_REPOS/nvme-cli-cuse" checkout v2.5 178 179 meson setup --force-fallback-for=libnvme \ 180 "$GIT_REPOS/nvme-cli-cuse/.build" \ 181 "$GIT_REPOS/nvme-cli-cuse" 182 meson compile -C "$GIT_REPOS/nvme-cli-cuse/.build" 183 184 rm -rf /usr/local/src/nvme-cli 185 mv "$GIT_REPOS/nvme-cli-cuse" /usr/local/src/nvme-cli 186 187 # Make sure binary is available for the cuse tests 188 if [[ -e /usr/local/src/nvme-cli/.build/nvme ]]; then 189 sudo ln -s .build/nvme /usr/local/src/nvme-cli/ 190 fi 191} 192 193# This function install version of nvme-cli, that support listing spdk nvme 194# devices, should be remove after changes present in nvme-cli upstream. 195function install_nvmecli_plugin() { 196 rm -rf "$GIT_REPOS/nvme-cli-plugin" 197 198 git clone $GIT_REPO_NVME_CLI "$GIT_REPOS/nvme-cli-plugin" 199 git -C "$GIT_REPOS/nvme-cli-plugin" fetch $GIT_REPO_NVME_CLI refs/changes/95/16795/12 200 git -C "$GIT_REPOS/nvme-cli-plugin" checkout FETCH_HEAD 201 202 meson setup --force-fallback-for=libnvme,json-c \ 203 "$GIT_REPOS/nvme-cli-plugin/.build" \ 204 "$GIT_REPOS/nvme-cli-plugin" 205 meson compile -C "$GIT_REPOS/nvme-cli-plugin/.build" 206 207 rm -rf /usr/local/src/nvme-cli-plugin 208 mv "$GIT_REPOS/nvme-cli-plugin" /usr/local/src/nvme-cli-plugin 209 210 # Make sure binary is available for the plugin tests 211 if [[ -e /usr/local/src/nvme-cli-plugin/.build/nvme ]]; then 212 sudo ln -s .build/nvme /usr/local/src/nvme-cli-plugin/ 213 fi 214} 215 216function install_libiscsi() { 217 # We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need 218 # to later. Cloning from git is just future proofing the machines. 219 if [[ ! -d $GIT_REPOS/libiscsi ]]; then 220 git clone "${GIT_REPO_LIBISCSI}" "$GIT_REPOS/libiscsi" 221 else 222 echo "libiscsi already checked out. Skipping" 223 fi 224 (cd "$GIT_REPOS/libiscsi" && ./autogen.sh && ./configure --prefix=/usr/local/libiscsi) 225 make -C "$GIT_REPOS/libiscsi" -j${jobs} WARN_CFLAGS= 226 sudo make -C "$GIT_REPOS/libiscsi" install 227} 228 229function install_git() { 230 if type -P git; then 231 if ge "$(git --version | awk '{print $3}')" "$GIT_VERSION"; then 232 return 0 233 fi 234 fi >/dev/null 235 236 install zlib-devel curl-devel 237 tar -C "$GIT_REPOS" -xzof <(wget -qO- "$GIT_REPO_GIT") 238 (cd "$GIT_REPOS/git-$GIT_VERSION" \ 239 && make configure \ 240 && ./configure \ 241 && sudo make -j${jobs} install) 242} 243 244function install_extra_pkgs() { 245 if [[ $INSTALL_QAT == true ]]; then 246 install libudev-devel || install libudev-dev || : 247 fi 248 249 if [[ $INSTALL_QEMU == true ]]; then 250 install qemu-system-x86 qemu-img \ 251 || install qemu-system-x86 qemu-utils \ 252 || install qemu 253 254 # Install extra dependency which was removed from Qemu 7.2 source tree 255 install libslirp-devel \ 256 || install libslirp-dev 257 fi || : 258} 259 260function install_vagrant() { 261 local vagrant_version="2.2.7" 262 local vagrant_installer="vagrant_${vagrant_version}_x86_64.deb" 263 local vagrant_plugins=(vagrant-libvirt vagrant-sshfs vagrant-cachier vagrant-proxyconf) 264 265 if [[ $OSID != ubuntu ]]; then 266 echo "Currently, Vagrant installation is supported only on ubuntu" 267 return 0 268 fi 269 270 # Install vagrant and it's plugins dependencies 271 # function should be defined in pkgdep/$package_manager file 272 install_vagrant_dependencies 273 274 # Download and install vagrant 275 if hash vagrant &> /dev/null; then 276 echo "Vagrant is already installed" 277 else 278 wget "https://releases.hashicorp.com/vagrant/${vagrant_version}/${vagrant_installer}" 279 sudo dpkg -i "${vagrant_installer}" 280 fi 281 vagrant --version 282 283 # Install vagrant plugins 284 local vagrant_plugin_list 285 vagrant_plugin_list=$(vagrant plugin list) 286 287 local plugin 288 for plugin in "${vagrant_plugins[@]}"; do 289 if grep -Fq "$plugin" <<< "$vagrant_plugin_list"; then 290 echo "$plugin already installed" 291 else 292 vagrant plugin install "$plugin" 293 fi 294 done 295} 296 297function install_igb_uio() { 298 git clone "${GIT_REPO_DPDK_KMODS}" "$GIT_REPOS/dpdk-kmods" 299 300 (cd "$GIT_REPOS/dpdk-kmods/linux/igb_uio" && make -j ${jobs}) 301 sudo mkdir -p "/lib/modules/$(uname -r)/extra/dpdk" 302 sudo cp "$GIT_REPOS/dpdk-kmods/linux/igb_uio/igb_uio.ko" "/lib/modules/$(uname -r)/extra/dpdk" 303 sudo depmod 304} 305 306function install_irdma() { 307 local RDMA_CORE_VERSION=44.0 308 local RDMA_CORE=https://github.com/linux-rdma/rdma-core/releases/download/v$RDMA_CORE_VERSION/rdma-core-$RDMA_CORE_VERSION.tar.gz 309 310 if [[ $ID != fedora ]]; then 311 echo "Installation of the irdma can be attempted only on Fedora" 312 return 0 313 fi 314 315 # Install extra dependencies needed by the rdma-core 316 install ninja-build pandoc perl-generators valgrind-devel python-docutils libnl3 libnl3-devel python3-Cython 317 318 rm -rf "$GIT_REPOS/irdma-$IRDMA_VERSION" 319 rm -rf "$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION" 320 321 curl -L -o- "$IRDMA_DRIVER" | tar -C "$GIT_REPOS" -xzf - 322 [[ -e $GIT_REPOS/irdma-$IRDMA_VERSION/build.sh ]] 323 324 if ge "$kernel_ver" 6.5.1; then 325 patch --dir="$GIT_REPOS/irdma-$IRDMA_VERSION" -p1 326 fi < "$rootdir/test/common/config/pkgdep/patches/irdma/0001-irdma-avoid-fortify-string-warning.patch" 327 ( 328 cd "$GIT_REPOS/irdma-$IRDMA_VERSION" 329 sed -i "s/IRDMA_FLUSH_DELAY_MS 1500/IRDMA_FLUSH_DELAY_MS 50/" \ 330 "$GIT_REPOS/irdma-$IRDMA_VERSION/src/irdma/verbs.h" 331 "$GIT_REPOS/irdma-$IRDMA_VERSION/build.sh" 332 ) 333 334 # Fetch and build the rdma-core irdma depends on 335 curl -L -o- "$RDMA_CORE" | tar -C "$GIT_REPOS" -xzf - 336 [[ -e $GIT_REPOS/irdma-$IRDMA_VERSION/libirdma-$RDMA_CORE_VERSION.patch ]] 337 338 patch --dir="$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION" -p2 \ 339 < "$GIT_REPOS/irdma-$IRDMA_VERSION/libirdma-$RDMA_CORE_VERSION.patch" 340 341 # Note that paths and the name of the package are hardcoded into .spec, hence they need to stay like this. 342 [[ -e $GIT_REPOS/rdma-core-$RDMA_CORE_VERSION/redhat/rdma-core.spec ]] 343 mkdir -p "$HOME/rpmbuild/"{SOURCES,SPECS} 344 cp "$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION/redhat/rdma-core.spec" "$HOME/rpmbuild/SPECS" 345 346 # Re-package the source 347 tar -czf "$HOME/rpmbuild/SOURCES/rdma-core-$RDMA_CORE_VERSION.tgz" -C "$GIT_REPOS" "rdma-core-$RDMA_CORE_VERSION" 348 349 # Build the rpms 350 ( 351 cd "$HOME/rpmbuild/SPECS" 352 # Make sure stock ninja-build is used 353 PATH="/usr/bin:$PATH" rpmbuild -ba rdma-core.spec 354 ) 355 356 # Now, don't install the packages since this will, most likely, conflict with packages already installed 357 # in the system. Instead, simply inform user what the next step is and note what potential issues it may 358 # have with the installation. 359 360 shopt -s nullglob 361 local rpms=("$HOME/rpmbuild/RPMS/x86_64/"*.rpm) 362 shopt -u nullglob 363 ((${#rpms[@]} > 0)) 364 365 cat <<-EOF 366 367 INFO: rdma-core-$RDMA_CORE_VERSION was successfully built, following packages are 368 available for installation: 369 370 $(printf ' - %s\n' "${rpms[@]##*/}") 371 372 Note that installing the above packages may raise conflicts with their 373 potentially newer versions already installed on the system. Dependent 374 packages may be uninstalled during the process as well. Please, run the 375 following command to finish the installation: 376 377 $package_manager install [--allowerasing] $HOME/rpmbuild/RPMS/x86_64/*.rpm 378 379 EOF 380} 381 382function install_ice() { 383 rm -rf "$GIT_REPOS/ice-$ICE_VERSION" 384 385 curl -L -o- "$ICE_DRIVER" | tar -C "$GIT_REPOS" -xzf - 386 387 ( 388 cd "$GIT_REPOS/ice-$ICE_VERSION/src" 389 sudo make -j"$(nproc)" install 390 ) 391} 392 393function install_lcov() { 394 local lcov_version=v1.15 395 396 rm -rf /usr/src/lcov 397 sudo git clone "$GIT_REPO_LCOV" --branch "$lcov_version" /usr/src/lcov 398 (cd /usr/src/lcov; sudo make install) 399} 400 401function install_bpftrace() { 402 local deps=() bcc_rev 403 404 deps+=(cereal-devel) 405 deps+=(clang-devel) 406 deps+=(cmake) 407 deps+=(dwarves) 408 deps+=(gmock-devel) 409 deps+=(gtest-devel) 410 deps+=(llvm-devel) 411 412 install "${deps[@]}" 413 414 rm -rf $GIT_REPOS/bpftrace 415 416 git clone "$GIT_REPO_BPFTRACE" "$GIT_REPOS/bpftrace" 417 git -C $GIT_REPOS/bpftrace checkout $BPFTRACE_VERSION 418 git -C "$GIT_REPOS/bpftrace" submodule update --init 419 mkdir -p $GIT_REPOS/bpftrace/build 420 mkdir -p "$GIT_REPOS/bpftrace/build/build-libs/bcc" 421 422 if ge "$(clang -dumpversion)" 16.0.0; then 423 # Make sure LLVM-Config.cmake does not trip when it's touched through bcc's find_package() 424 # calls. Do so by manually "initializing" cmake's cache dedicated for the bcc build. The 425 # "UNDEFINED" is the type cmake would select via cmake_policy(). 426 echo "CMAKE_POLICY_DEFAULT_CMP0057:UNDEFINED=NEW" > \ 427 "$GIT_REPOS/bpftrace/build/build-libs/bcc/CMakeCache.txt" 428 429 # Make sure bpftrace builds bcc at a revision which supports llvm >= 16.0.0 430 # https://github.com/iovisor/bcc/commit/daf35cdbeaeba649509d88cf1674302affa263e3 431 git -C "$GIT_REPOS/bpftrace/bcc" checkout daf35cdbeaeba649509d88cf1674302affa263e3 432 433 # As of now, the latest bpftrace revision does not support LLVM >= 16 as it hardcodes 434 # the MAJOR version inside its CMakeLists.txt. Override it. 435 sed -i -e 's/set(MAX_LLVM_MAJOR 15)/set(MAX_LLVM_MAJOR 16)/g' \ 436 "$GIT_REPOS/bpftrace/CMakeLists.txt" 437 fi 438 439 bcc_rev=$(git -C "$GIT_REPOS/bpftrace/bcc" describe --tags --abbrev=0) bcc_rev=${bcc_rev#v} 440 echo "REVISION:STRING=$bcc_rev" >> "$GIT_REPOS/bpftrace/build/build-libs/bcc/CMakeCache.txt" 441 442 443 # Use build-libs.sh to build necessary libraries in the bpftrace tree 444 (cd $GIT_REPOS/bpftrace/build && ../build-libs.sh) 445 446 cmake \ 447 -Wno-dev \ 448 -DCMAKE_BUILD_TYPE=Release \ 449 -B "$GIT_REPOS/bpftrace/build" \ 450 -S "$GIT_REPOS/bpftrace" 451 452 make -C $GIT_REPOS/bpftrace/build -j$(nproc) 453 sudo make -C $GIT_REPOS/bpftrace/build install 454} 455 456function install_sources() { 457 if [[ $ID == centos ]] && (( VERSION_ID == 7 )); then 458 # install proper version of the git first 459 install_git 460 fi 461 462 IFS="," read -ra conf_env <<< "$CONF" 463 for conf in "${conf_env[@]}"; do 464 export "INSTALL_${conf^^}=true" 465 done 466 467 if [[ $OSID == freebsd ]]; then 468 jobs=$(($(sysctl -n hw.ncpu) * 2)) 469 else 470 jobs=$(($(nproc) * 2)) 471 sources+=( 472 install_irdma 473 install_libiscsi 474 install_nvmecli 475 install_nvmecli_plugin 476 install_qat 477 install_rocksdb 478 install_flamegraph 479 install_qemu 480 install_igb_uio 481 install_ice 482 install_lcov 483 install_bpftrace 484 ) 485 install_extra_pkgs 486 fi 487 sources+=(install_fio) 488 sources+=(install_vagrant) 489 490 sudo mkdir -p /usr/{,local}/src 491 sudo mkdir -p "$GIT_REPOS" 492 493 for source in "${sources[@]}"; do 494 source_conf=${source^^} 495 if [[ ${!source_conf} == true ]]; then 496 "$source" 497 fi 498 done 499} 500 501GIT_VERSION=2.25.1 502IRDMA_VERSION=1.12.55 503ICE_VERSION=1.12.7 504 505BPFTRACE_VERSION=${BPFTRACE_VERSION:-42d55a0} 506VFIO_QEMU_BRANCH=${VFIO_QEMU_BRANCH:-vfio-user-p3.0} 507VANILLA_QEMU_BRANCH=${VANILLA_QEMU_BRANCH:-v8.0.0} 508 509: ${GIT_REPO_ROCKSDB=https://review.spdk.io/spdk/rocksdb} 510export GIT_REPO_ROCKSDB 511: ${GIT_REPO_FIO=https://github.com/axboe/fio.git} 512export GIT_REPO_FIO 513: ${GIT_REPO_FLAMEGRAPH=https://github.com/brendangregg/FlameGraph.git} 514export GIT_REPO_FLAMEGRAPH 515: ${GIT_REPO_QEMU=https://github.com/qemu/qemu} 516export GIT_REPO_QEMU 517: ${GIT_REPO_QEMU_VFIO=https://github.com/oracle/qemu} 518export GIT_REPO_QEMU_VFIO 519: ${GIT_REPO_LIBISCSI=https://github.com/sahlberg/libiscsi} 520export GIT_REPO_LIBISCSI 521: ${DRIVER_LOCATION_QAT=https://downloadmirror.intel.com/773821/QAT.L.4.21.0-00001.tar.gz} 522export DRIVER_LOCATION_QAT 523: ${GIT_REPO_GIT=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz} 524export GIT_REPO_GIT 525: ${GIT_REPO_DPDK_KMODS=http://dpdk.org/git/dpdk-kmods} 526export GIT_REPO_DPDK_KMODS 527: ${IRDMA_DRIVER=https://downloadmirror.intel.com/786088/irdma-$IRDMA_VERSION.tgz} 528export IRDMA_DRIVER 529: ${ICE_DRIVER="https://sourceforge.net/projects/e1000/files/ice%20stable/$ICE_VERSION/ice-$ICE_VERSION.tar.gz"} 530export ICE_DRIVER 531: ${GIT_REPO_LCOV=https://github.com/linux-test-project/lcov} 532export GIT_REPO_LCOV 533: ${GIT_REPO_BCC=https://github.com/iovisor/bcc.git} 534export GIT_REPO_BCC 535: ${GIT_REPO_BPFTRACE=https://github.com/iovisor/bpftrace.git} 536export GIT_REPO_BPFTRACE 537: ${GIT_REPO_NVME_CLI=https://review.spdk.io/gerrit/spdk/nvme-cli} 538export GIT_REPO_NVME_CLI 539 540GIT_REPOS=${GIT_REPOS:-$HOME} 541 542gcc_version=$(gcc -dumpversion) gcc_version=${gcc_version%%.*} 543if [[ -e /proc/sys/kernel/osrelease ]]; then 544 kernel_ver=$(< /proc/sys/kernel/osrelease) 545fi 546