diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 31 | ||||
-rwxr-xr-x | scripts/build_dpdk1802.sh (renamed from scripts/build_dpdk.sh) | 38 | ||||
-rwxr-xr-x | scripts/build_dpdk1805.sh | 82 | ||||
-rwxr-xr-x | scripts/generate_dmm_rpm.sh | 2 |
4 files changed, 119 insertions, 34 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index a887f9f..bae8c92 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -81,6 +81,7 @@ fi #DPDK will be having dependancy on linux headers if [ "$OS_ID" == "ubuntu" ]; then sudo apt-get -y install git build-essential linux-headers-`uname -r` + sudo apt-get install libnuma-dev elif [ "$OS_ID" == "debian" ]; then sudo apt-get -y install git build-essential linux-headers-`uname -r` elif [ "$OS_ID" == "centos" ]; then @@ -95,25 +96,28 @@ fi #===========build DPDK================ if [ "$OS_ID" == "centos" ]; then - bash -x $DMM_DIR/scripts/build_dpdk.sh + bash -x $DMM_DIR/scripts/build_dpdk1802.sh else if [ ! -d /usr/include/dpdk ] || [ ! -d /usr/share/dpdk ] || [ ! -d /usr/lib/modules/4.4.0-31-generic/extra/dpdk ]; then - mkdir -p $DPDK_DOWNLOAD_PATH + mkdir -p $DPDK_DOWNLOAD_PATH - DPDK_FOLDER=$DPDK_DOWNLOAD_PATH/dpdk-16.04-$TIMESTAMP - cd $DPDK_DOWNLOAD_PATH - mkdir $DPDK_FOLDER - wget -N https://fast.dpdk.org/rel/dpdk-16.04.tar.xz --no-check-certificate - tar xvf dpdk-16.04.tar.xz -C $DPDK_FOLDER - cd $DPDK_FOLDER/dpdk-16.04 + DPDK_FOLDER=$DPDK_DOWNLOAD_PATH/dpdk-18.02-$TIMESTAMP + cd $DPDK_DOWNLOAD_PATH + mkdir $DPDK_FOLDER + wget -N https://fast.dpdk.org/rel/dpdk-18.02.tar.xz --no-check-certificate + tar xvf dpdk-18.02.tar.xz -C $DPDK_FOLDER + cd $DPDK_FOLDER/dpdk-18.02 - sed -i 's!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1' config/common_base - sed -i 's!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1' config/common_base - sed -i 's!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1' config/common_base + sed -i 's!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1' config/common_base + sed -i 's!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1' config/common_base + sed -i 's!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1' config/common_base + sed -i 's!CONFIG_RTE_EAL_PMD_PATH=.*!CONFIG_RTE_EAL_PMD_PATH="/tmp/dpdk/drivers/"!1' config/common_base - sudo make install T=x86_64-native-linuxapp-gcc DESTDIR=${DPDK_INSTALL_PATH} -j 4 + sudo make install T=x86_64-native-linuxapp-gcc DESTDIR=${DPDK_INSTALL_PATH} -j 4 + mkdir -p /tmp/dpdk/drivers/ + cp -f /usr/lib/librte_mempool_ring.so /tmp/dpdk/drivers/ fi fi @@ -177,6 +181,9 @@ elif [ "$hugepagesize" == "1048576" ]; then fi sudo mkdir -p /var/run/ip_module/ +#disable ASLR, othewise it may have some problems when mapping memory for secondary process +echo 0 > /proc/sys/kernel/randomize_va_space + export LD_LIBRARY_PATH=$LIB_PATH export NSTACK_LOG_ON=DBG diff --git a/scripts/build_dpdk.sh b/scripts/build_dpdk1802.sh index 80a78b6..6430aed 100755 --- a/scripts/build_dpdk.sh +++ b/scripts/build_dpdk1802.sh @@ -31,41 +31,33 @@ mkdir -p rpmbuild/SOURCES cd ~/rpmbuild/SOURCES -if [ ! -s dpdk-16.04.tar.gz ]; then -wget http://dpdk.org/browse/dpdk/snapshot/dpdk-16.04.tar.gz +if [ ! -s dpdk-18.02.tar.gz ]; then +wget http://dpdk.org/browse/dpdk/snapshot/dpdk-18.02.tar.gz fi -tar xzvf dpdk-16.04.tar.gz -cp dpdk-16.04/pkg/dpdk.spec ~/rpmbuild/SOURCES/ +tar xzvf dpdk-18.02.tar.gz +cp dpdk-18.02/pkg/dpdk.spec ~/rpmbuild/SOURCES/ echo "modify the spec" -#get rid of the dependence of xen-devel -sed -i '48d' dpdk.spec -sed -i '47a BuildRequires: kernel-devel, kernel-headers, libpcap-devel' dpdk.spec - #get rid of the dependence of texlive-collection sed -i '/BuildRequires: texlive-collection/s/^/#&/' dpdk.spec -#delete something about xen -sed -i '/LIBRTE_PMD_XENVIRT/s/^/#&/' dpdk.spec -sed -i '/LIBRTE_XEN_DOM0/s/^/#&/' dpdk.spec - #delete something of generating doc sed -i '/%{target} doc/s/^/#&/' dpdk.spec -sed -i '94d' dpdk.spec -sed -i '93a datadir=%{_datadir}/dpdk' dpdk.spec -sed -i '94a # datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk' dpdk.spec +sed -i '98d' dpdk.spec +sed -i '97a datadir=%{_datadir}/dpdk' dpdk.spec +sed -i '98a # datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk' dpdk.spec sed -i '/%files doc/s/^/#&/' dpdk.spec sed -i '/%doc %{_docdir}/s/^/#&/' dpdk.spec -sed -i '76a sed -i 's!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1' config/common_base' dpdk.spec -sed -i '77a sed -i 's!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1' config/common_base' dpdk.spec -sed -i '78a sed -i 's!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1' config/common_base' dpdk.spec +sed -i '82a sed -i '\''s!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1'\'' config/common_base' dpdk.spec +sed -i '83a sed -i '\''s!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1'\'' config/common_base' dpdk.spec +sed -i '84a sed -i '\''s!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1'\'' config/common_base' dpdk.spec +sed -i '85a sed -i '\''s!CONFIG_RTE_EAL_PMD_PATH=.*!CONFIG_RTE_EAL_PMD_PATH="/tmp/dpdk/drivers/"!1'\'' config/common_base' dpdk.spec echo "build the dependence" #sudo yum-builddep -y dpdk.spec - sudo yum install -y libpcap-devel python-sphinx inkscape @@ -80,6 +72,10 @@ fi echo "install the rpm" cd ../RPMS/x86_64/ -sudo rpm -ivh dpdk-16.04-1.x86_64.rpm -sudo rpm -ivh dpdk-devel-16.04-1.x86_64.rpm +sudo rpm -ivh dpdk-18.02-1.x86_64.rpm +sudo rpm -ivh dpdk-devel-18.02-1.x86_64.rpm + +mkdir -p /tmp/dpdk/drivers/ +cp -f /usr/lib64/librte_mempool_ring.so /tmp/dpdk/drivers/ + cd ${cur_directory} diff --git a/scripts/build_dpdk1805.sh b/scripts/build_dpdk1805.sh new file mode 100755 index 0000000..0a91a8f --- /dev/null +++ b/scripts/build_dpdk1805.sh @@ -0,0 +1,82 @@ +######################################################################### +# +# Copyright (c) 2018 Huawei Technologies Co.,Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +######################################################################### +#!/bin/bash -x + +echo "check whether dpdk installed" +cur_directory=${PWD} +check_dpdk=$(rpm -qa | grep dpdk) +if [ -z "$check_dpdk" ]; then + echo "system will install the dpdk" +else + echo "system has installed the dpdk" + echo "$check_dpdk" + exit 0 +fi + +cd ~ +mkdir -p rpmbuild/SOURCES + +cd ~/rpmbuild/SOURCES + +if [ ! -s dpdk-18.05.tar.gz ]; then +wget http://dpdk.org/browse/dpdk/snapshot/dpdk-18.05.tar.gz +fi + +tar xzvf dpdk-18.05.tar.gz +cp dpdk-18.05/pkg/dpdk.spec ~/rpmbuild/SOURCES/ + +echo "modify the spec" + +#get rid of the dependence of texlive-collection +sed -i '/BuildRequires: texlive-collection/s/^/#&/' dpdk.spec + +#delete something of generating doc +sed -i '/%{target} doc/s/^/#&/' dpdk.spec +sed -i '70d' dpdk.spec +sed -i '69a datadir=%{_datadir}/dpdk' dpdk.spec +sed -i '70a # datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk' dpdk.spec +sed -i '/%files doc/s/^/#&/' dpdk.spec +sed -i '/%doc %{_docdir}/s/^/#&/' dpdk.spec + +sed -i '54a sed -i '\''s!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1'\'' config/common_base' dpdk.spec +sed -i '55a sed -i '\''s!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1'\'' config/common_base' dpdk.spec +sed -i '56a sed -i '\''s!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1'\'' config/common_base' dpdk.spec +sed -i '57a sed -i '\''s!CONFIG_RTE_EAL_PMD_PATH=.*!CONFIG_RTE_EAL_PMD_PATH="/tmp/dpdk/drivers/"!1'\'' config/common_base' dpdk.spec +sed -i '58a sed -i '\''s!CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=.*!CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n!1'\'' config/common_base' dpdk.spec + +echo "build the dependence" +#sudo yum-builddep -y dpdk.spec +sudo yum install -y libpcap-devel python-sphinx inkscape + + +echo "generate the rpm package" +rpmbuild -ba dpdk.spec --define "_sourcedir ${PWD}" +if [ $? -eq 0 ]; then + echo "rpm build success" +else + echo "rpm build error" + exit +fi + +echo "install the rpm" +cd ../RPMS/x86_64/ +sudo rpm -ivh dpdk-18.05-1.x86_64.rpm +sudo rpm -ivh dpdk-devel-18.05-1.x86_64.rpm + +mkdir -p /tmp/dpdk/drivers/ +cp -f /usr/lib64/librte_mempool_ring.so /tmp/dpdk/drivers/ + +cd ${cur_directory} diff --git a/scripts/generate_dmm_rpm.sh b/scripts/generate_dmm_rpm.sh index bce4580..711f475 100755 --- a/scripts/generate_dmm_rpm.sh +++ b/scripts/generate_dmm_rpm.sh @@ -22,7 +22,7 @@ version="18.04" mkdir -p ~/rpmbuild/SOURCES cd ../ -git archive --format=tar.gz -o ~/rpmbuild/SOURCES/${name}-${version}.tar.gz --prefix=${name}-${version}/ master +git archive --format=tar.gz -o ~/rpmbuild/SOURCES/${name}-${version}.tar.gz --prefix=${name}-${version}/ HEAD cd ~/rpmbuild/SOURCES tar xzvf ${name}-${version}.tar.gz |