diff options
author | Maryam Tahhan <maryam.tahhan@intel.com> | 2017-05-06 22:44:32 +0100 |
---|---|---|
committer | Maryam Tahhan <maryam.tahhan@intel.com> | 2017-05-23 08:19:46 +0000 |
commit | db68b7e767351f8b59db586e4035f501facf92a9 (patch) | |
tree | 519f80a4bec935d62e42df1654e21f944ddf6be6 /src | |
parent | 386995473879eb0502c502ad69d06e2d5bd9d7a9 (diff) |
src: build and install collectd on centos/rhel
Modify build and dependency scripts for centos/rhel builds.
Change-Id: I1fafaf3392d9f22837ce4ed3fa0f84c13ead0698
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/build_base_machine.sh | 69 | ||||
-rwxr-xr-x | src/centos/install_build_deps.sh | 59 | ||||
-rw-r--r-- | src/collectd/Makefile | 3 | ||||
-rw-r--r-- | src/dpdk/Makefile | 54 | ||||
-rw-r--r-- | src/package-list.mk | 2 | ||||
-rwxr-xr-x | src/rhel/install_build_deps.sh | 59 | ||||
-rwxr-xr-x | src/ubuntu/install_build_deps.sh (renamed from src/install_build_deps.sh) | 9 |
7 files changed, 244 insertions, 11 deletions
diff --git a/src/build_base_machine.sh b/src/build_base_machine.sh new file mode 100755 index 00000000..dfd8e470 --- /dev/null +++ b/src/build_base_machine.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Top level scripts to build basic setup for the host +# + +# Copyright 2017 OPNFV, Intel Corporation. +# +# 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. + +# +# Contributors: +# Aihua Li, Huawei Technologies. +# Abdul Halim, Intel Corporation. +# Martin Klozik, Intel Corporation. +# Maryam Tahhan, Intel Corporation. +ROOT_UID=0 +SUDO="" + +# function to emit error message before quitting +function die() { + echo $1 + exit 1 +} + +# Detect OS name and version from systemd based os-release file +. /etc/os-release + +# Get OS name (the First word from $NAME in /etc/os-release) +OS_NAME="$ID" + +# check if root +if [ "$UID" -ne "$ROOT_UID" ] +then + # installation must be run via sudo + SUDO="sudo -E" +fi + +# If there is version specific dir available then set distro_dir to that +if [ -d "$OS_NAME/$VERSION_ID" ]; then + distro_dir="$OS_NAME/$VERSION_ID" +else + # Fallback - Default distro_dir = OS name + distro_dir="$OS_NAME" +fi + +# build base system using OS specific scripts +if [ -d "$distro_dir" ] && [ -e "$distro_dir/install_build_deps.sh" ]; then + $SUDO $distro_dir/install_build_deps.sh || die "$distro_dir/install_build_deps.sh failed" +else + die "$distro_dir is not yet supported" +fi + +# download and compile DPDK, OVS, RDT and Collectd +if [ -f Makefile ] ; then + make || die "Make failed" +else + die "Make failed; No Makefile" +fi + diff --git a/src/centos/install_build_deps.sh b/src/centos/install_build_deps.sh new file mode 100755 index 00000000..438c1435 --- /dev/null +++ b/src/centos/install_build_deps.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Build a base machine for CentOS distro +# +# Copyright 2017 OPNFV +# +# 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. +# +# Contributors: +# Aihua Li, Huawei Technologies. +# Martin Klozik, Intel Corporation. +# Maryam Tahhan, Intel Corporation. +# Synchronize package index files +yum -y update + +# For collectd +yum install -y yum-utils +yum install -y epel-release +yum-builddep -y collectd + +# Install required packages +yum -y install $(echo " + +kernel-devel +kernel-headers +make +gcc +gcc-c++ +autoconf +automake +flex +bison +libtool +pkg-config +git +rpm-build +libcap-devel +xfsprogs-devel +iptables-devel +libmemcached-devel +gtk2-devel +libvirt-devel +mcelog +wget + +# install epel release required for git-review +epel-release +" | grep -v ^#) + diff --git a/src/collectd/Makefile b/src/collectd/Makefile index 8fd78940..cf1f704b 100644 --- a/src/collectd/Makefile +++ b/src/collectd/Makefile @@ -1,7 +1,7 @@ # makefile to manage collectd package # -# Copyright 2016 OPNFV +# Copyright 2016-2017 OPNFV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ CONFIG_CMD += --with-hugepages CONFIG_CMD += --enable-exec CONFIG_CMD += --enable-python CONFIG_CMD += --enable-threshold +CONFIG_CMD += --disable-perl .PHONY: install force_install config force_make diff --git a/src/dpdk/Makefile b/src/dpdk/Makefile index a23a6290..f13449c8 100644 --- a/src/dpdk/Makefile +++ b/src/dpdk/Makefile @@ -1,7 +1,7 @@ # makefile to manage dpdk package # -# Copyright 2015-2016 OPNFV +# Copyright 2015-2017 OPNFV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,17 +19,42 @@ # Contributors: # Aihua Li, Huawei Technologies. # Martin Klozik, Intel Corporation. +# Christian Trautman, Red Hat Inc. +# Maryam Tahhan, Intel Corporation. include ../mk/master.mk include ../package-list.mk +include /etc/os-release .PHONY: install force_make WORK_DIR = dpdk TAG_DONE_FLAG = $(WORK_DIR)/.$(DPDK_TAG).tag.done -DPDK_TARGET = x86_64-native-linuxapp-gcc -CONFIG_FILE_LINUXAPP = $(WORK_DIR)/config/common_base +# VHOST configuration options are stored in different files based on DPDK version +# v1.2.3r0-v1.6.0r2 - configuration inside config/defconfig_x86_64-default-linuxapp-gcc +# v1.7.0-rc1-v2.2.0 - configuration inside config/common_linuxapp +# v16 and newer - configuration split between config/common_linuxapp and config/common_base +DPDK_TAG_MAJOR = $(shell echo $(DPDK_TAG) | cut -d. -f1) +DPDK_TAG_MINOR = $(shell echo $(DPDK_TAG) | cut -d. -f2) +ifeq ($(DPDK_TAG_MAJOR),v1) +ifeq ($(DPDK_TAG_MINOR), $(filter $(DPDK_TAG_MINOR), 7 8)) + DPDK_TARGET = x86_64-native-linuxapp-gcc + CONFIG_FILE_LINUXAPP = $(WORK_DIR)/config/common_linuxapp +else + DPDK_TARGET = x86_64-default-linuxapp-gcc + CONFIG_FILE_LINUXAPP = $(WORK_DIR)/config/defconfig_x86_64-default-linuxapp-gcc +endif +else +ifeq ($(DPDK_TAG_MAJOR),v2) + DPDK_TARGET = x86_64-native-linuxapp-gcc + CONFIG_FILE_LINUXAPP = $(WORK_DIR)/config/common_linuxapp +else + DPDK_TARGET = x86_64-native-linuxapp-gcc + CONFIG_FILE_BASE = $(WORK_DIR)/config/common_base + CONFIG_FILE_LINUXAPP = $(WORK_DIR)/config/common_linuxapp +endif +endif all: force_make install @echo "Finished making $(WORK_DIR) " @@ -39,14 +64,33 @@ INSTALL_TARGET = force_make # modify CONFIG_FILE to enable SHARED_LIB build and restore original CONFIG_FILE after the build # DPDK v16 comments: ## CONFIG_RTE_BUILD_COMBINE_LIBS has been obsoleted -## CONFIG_RTE_LIBRTE_VHOST and CONFIG_RTE_LIBRTE_KNI are listed in both config_base and config_linuxapp, +## CONFIG_RTE_LIBRTE_KNI is listed in both config_base and config_linuxapp, ## values from config_linuxapp will be used, but options are modified at both places to avoid confusion. force_make: $(TAG_DONE_FLAG) $(AT)cd $(WORK_DIR) && git pull $(DPDK_URL) $(DPDK_TAG) +ifdef CONFIG_FILE_BASE + $(AT)sed -i -e 's/CONFIG_RTE_BUILD_SHARED_LIB=./CONFIG_RTE_BUILD_SHARED_LIB=y/g' $(CONFIG_FILE_BASE) + $(AT)sed -i -e 's/CONFIG_RTE_EAL_PMD_PATH=.*/CONFIG_RTE_EAL_PMD_PATH=\"\/usr\/lib\/dpdk-pmd\/\"/g' $(CONFIG_FILE_BASE) + $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_KNI=./CONFIG_RTE_LIBRTE_KNI=n/g' $(CONFIG_FILE_BASE) +else $(AT)sed -i -e 's/CONFIG_RTE_BUILD_SHARED_LIB=./CONFIG_RTE_BUILD_SHARED_LIB=y/g' $(CONFIG_FILE_LINUXAPP) $(AT)sed -i -e 's/CONFIG_RTE_EAL_PMD_PATH=.*/CONFIG_RTE_EAL_PMD_PATH=\"\/usr\/lib\/dpdk-pmd\/\"/g' $(CONFIG_FILE_LINUXAPP) + $(AT)sed -i -e 's/CONFIG_RTE_BUILD_COMBINE_LIBS=./CONFIG_RTE_BUILD_COMBINE_LIBS=y/g' $(CONFIG_FILE_LINUXAPP) +endif +# CentOS 7.3 specific config changes to compile +ifeq ($(ID),"centos") +ifeq ($(VERSION_ID),"7") + $(AT)sed -i.bak s@'SRCS-y += ethtool/igb/igb_main.c'@'#SRCS-y += ethtool/igb/igb_main.c'@g $(WORK_DIR)/lib/librte_eal/linuxapp/kni/Makefile +endif +endif +# RHEL 7.3 specific config changes to compile +ifeq ($(ID),"rhel") +ifeq ($(VERSION_ID),"7.3") + $(AT)sed -i.bak s@'SRCS-y += ethtool/igb/igb_main.c'@'#SRCS-y += ethtool/igb/igb_main.c'@g $(WORK_DIR)/lib/librte_eal/linuxapp/kni/Makefile +endif +endif $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_KNI=./CONFIG_RTE_LIBRTE_KNI=n/g' $(CONFIG_FILE_LINUXAPP) - $(AT)cd $(WORK_DIR); make config T=$(DPDK_TARGET) -j; make -j + $(AT)cd $(WORK_DIR); make config T=$(DPDK_TARGET) -j; make -j DESTDIR=$(WORK_DIR) $(AT)cd `dirname $(CONFIG_FILE_LINUXAPP)` && git checkout `basename $(CONFIG_FILE_LINUXAPP)` && cd - @echo "Make done" diff --git a/src/package-list.mk b/src/package-list.mk index 3ec60210..df395914 100644 --- a/src/package-list.mk +++ b/src/package-list.mk @@ -16,4 +16,4 @@ COLLECTD_URL ?= https://github.com/collectd/collectd COLLECTD_TAG ?= master COLLECTD_CEILOMETER_URL ?= https://github.com/openstack/collectd-ceilometer-plugin -COLLECTD_CEILOMETER_TAG ?= stable/mitaka +COLLECTD_CEILOMETER_TAG ?= stable/ocata diff --git a/src/rhel/install_build_deps.sh b/src/rhel/install_build_deps.sh new file mode 100755 index 00000000..583089a5 --- /dev/null +++ b/src/rhel/install_build_deps.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Build a base machine for RHEL distro +# +# Copyright 2017 OPNFV +# +# 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. +# +# Contributors: +# Aihua Li, Huawei Technologies. +# Martin Klozik, Intel Corporation. +# Maryam Tahhan, Intel Corporation. +# Synchronize package index files +yum -y update + +# For collectd +yum install -y yum-utils +yum install -y epel-release +yum-builddep -y collectd + +# Install required packages +yum -y install $(echo " + +kernel-devel +kernel-headers +make +gcc +gcc-c++ +autoconf +automake +flex +bison +libtool +pkg-config +git +rpm-build +libcap-devel +xfsprogs-devel +iptables-devel +libmemcached-devel +gtk2-devel +libvirt-devel +mcelog +wget + +# install epel release required for git-review +epel-release +" | grep -v ^#) + diff --git a/src/install_build_deps.sh b/src/ubuntu/install_build_deps.sh index 7c6a89a2..119bca22 100755 --- a/src/install_build_deps.sh +++ b/src/ubuntu/install_build_deps.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2016 OPNFV +# Copyright 2016-2017 OPNFV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. set -eux -sudo apt-get -y install build-essential dh-autoreconf fakeroot devscripts dpkg-dev git wget +apt-get -y install build-essential dh-autoreconf fakeroot devscripts dpkg-dev git wget -sudo apt-get -y install \ +apt-get -y install \ debhelper dpkg-dev po-debconf dh-systemd dh-strip-nondeterminism \ bison flex autotools-dev libltdl-dev pkg-config \ iptables-dev \ @@ -70,5 +70,6 @@ sudo apt-get -y install \ default-jdk \ protobuf-c-compiler \ python-dev \ - openvswitch-switch + openvswitch-switch \ + mcelog |