diff options
author | Aihua Li <aihua.li@huawei.com> | 2015-03-11 14:12:41 -0700 |
---|---|---|
committer | Aihua Li <aihua.li@huawei.com> | 2015-03-12 10:21:34 -0700 |
commit | b4b06d27b062a65ef98753d7f1d9d340fa773329 (patch) | |
tree | d454fdd1a6361ede58c6412a6e6c88eddc22e199 /src | |
parent | bde8e3211f4e80cce5c6521a09528a9cc403d6d2 (diff) |
added mechanism to pull upstream packages and provided single top-level make
Change-Id: I13bcce3104377cac84a736cfd9a3d9df208e91f0
JIRA: VSPERF-25
Signed-off-by: Aihua Li <aihua.li@huawei.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Gene Snider <eugene.snider@huawei.com>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 32 | ||||
-rw-r--r-- | src/README | 28 | ||||
-rw-r--r-- | src/dpdk/Makefile | 61 | ||||
-rw-r--r-- | src/mk/README | 3 | ||||
-rw-r--r-- | src/mk/make-subsys.mk | 20 | ||||
-rw-r--r-- | src/mk/master.mk | 40 | ||||
-rw-r--r-- | src/ovs/Makefile | 86 | ||||
-rw-r--r-- | src/package-list.mk | 13 |
8 files changed, 283 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 00000000..5326e468 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,32 @@ +# Top Makefile to build upstream packages. +# + +# Copyright 2015 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. + +include mk/master.mk + +# specify upstream package as SUBDIRS - common terms as suggest by gnu-make +SUBDIRS = +SUBDIRS += dpdk +SUBDIRS += ovs + +# specify package dependency here if needed +ovs: dpdk + +include mk/make-subsys.mk diff --git a/src/README b/src/README new file mode 100644 index 00000000..ff1a1b8e --- /dev/null +++ b/src/README @@ -0,0 +1,28 @@ +### Purpose of this folder - Quickview + +1. contains place holders for upstream source code package. +2. manages the package dependency +3. provides simple one-button build for test developers + +### Motivation Explained + +There are multiple goals for the project vswitch performance characterization. +First, it is a generic test framework that can be used to characterize any vswitch solution. +Second, it is to be as CI tool to validate any change during development. + +For the first goal, it would be nice to get all the relevant upstream source package and +to provide a easy build environment for a given test developer. Obviously we don't want to +rewrite the makefile system from upstream project. However we need to add a wrapper to the +individual packages to manage package dependecy. For example, to test ovs-dpdk vswitch solution, +the build of ovs would depend on the build result of dpdk. +This dependency is never explicitly specified in the individual package. + +For the second goal as a CI tool, it may not be needed to pull the upstream package. +So this whole folder can be ignored. + +### Files and subfolders + +* package-list: contains list of packages and their associated tags +* mk: contains top level makefiles +* dpdk: place holder for dpdk package +* ovs: place holder for ovs package. diff --git a/src/dpdk/Makefile b/src/dpdk/Makefile new file mode 100644 index 00000000..65a634b7 --- /dev/null +++ b/src/dpdk/Makefile @@ -0,0 +1,61 @@ +# makefile to manage dpdk package +# +# Copyright (C) 2015 OPNFV +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. +# +# Contributors: +# Aihua Li, Huawei Technologies. + +include ../mk/master.mk +include ../package-list.mk + +.PHONY: install force_make + +WORK_DIR = dpdk +TAG_DONE_FLAG = $(WORK_DIR)/.$(DPDK_TAG).tag.done + +# the name has been changed from version to version +ifeq ($(DPDK_TAG),v1.6.0r0) + DPDK_TARGET = x86_64-default-linuxapp-gcc + CONFIG_FILE = $(WORK_DIR)/config/defconfig_x86_64-default-linuxapp-gcc +else + DPDK_TARGET = x86_64-native-linuxapp-gcc + CONFIG_FILE = $(WORK_DIR)/config/common_linuxapp +endif + +all: force_make + @echo "Finished making $(WORK_DIR) " + +INSTALL_TARGET = force_make + +force_make: $(TAG_DONE_FLAG) + $(AT)cd $(WORK_DIR); make config T=$(DPDK_TARGET) && make + @echo "Make done" + +install: $(INSTALL_TARGET) + $(AT)sudo cp -a $(WORK_DIR)/$(DPDK_TARGET)/kmod $(INSTALL_DIR)/lib/modules/$(KERNEL_VERSION) + @echo "install done" + +# hard way to clean and clobber +clean: +clobber: + $(AT)rm -rf $(WORK_DIR) + +# cleanse is for developer who would like to keep the +# clone git repo, saving time to fetch again from url +cleanse: + $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f + +$(WORK_DIR): + $(AT)git clone $(DPDK_URL) + +$(TAG_DONE_FLAG): $(WORK_DIR) + $(AT)cd $(WORK_DIR); git checkout $(DPDK_TAG) + $(AT)sed -i 's/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/g' $(CONFIG_FILE) + # KNI was causing the 1.6.0 build to fail + $(AT)sed -i 's/CONFIG_RTE_LIBRTE_KNI=y /CONFIG_RTE_LIBRTE_KNI=n/g' $(CONFIG_FILE) + $(AT)touch $@ diff --git a/src/mk/README b/src/mk/README new file mode 100644 index 00000000..52f83600 --- /dev/null +++ b/src/mk/README @@ -0,0 +1,3 @@ + +This folder contains top level makefile defintions + diff --git a/src/mk/make-subsys.mk b/src/mk/make-subsys.mk new file mode 100644 index 00000000..6a616c3d --- /dev/null +++ b/src/mk/make-subsys.mk @@ -0,0 +1,20 @@ +# Master makefile definitions for project opnfv vswitchperf +# +# Copyright (C) 2015 OPNFV +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. +# +# Contributors: +# Aihua Li, Huawei Technologies. + +.PHONY: $(SUBDIRS) + +all clean cleanse clobber install uninstall: $(SUBDIRS) + $(AT)echo "finished making $@" + +$(SUBDIRS): + $(AT)echo "Enter directory $@" + $(AT)$(MAKE) -C $@ $(MAKECMDGOALS) diff --git a/src/mk/master.mk b/src/mk/master.mk new file mode 100644 index 00000000..f61be7b1 --- /dev/null +++ b/src/mk/master.mk @@ -0,0 +1,40 @@ +# Master makefile definitions for project opnfv vswitchperf +# +# Copyright (C) 2015 OPNFV +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. +# +# Contributors: +# Aihua Li, Huawei Technologies. + +# user has the full control to decide where to put the build by +# specifying INSTALL_DIR from the make input + +# try to read it in from environment +INSTALL_DIR ?= $(shell echo $$INSTALL_DIR) + +# if it is still not set, then set it to default +ifeq ($(INSTALL_DIR),) +INSTALL_DIR = /opt/opnfv +endif + +# for debugging Makefile +# Make V as a synonum for VERBOSE +ifdef V +VERBOSE = $(V) +endif + +VERBOSE ?= 0 + +ifeq ($(VERBOSE),0) + AT = @ +else + BASH_X = -x +endif + +.DEFAULT_GOAL := all + +.PHONY: all clean cleanse clobber diff --git a/src/ovs/Makefile b/src/ovs/Makefile new file mode 100644 index 00000000..9052d341 --- /dev/null +++ b/src/ovs/Makefile @@ -0,0 +1,86 @@ +# makefile to manage ovs package +# +# Copyright (C) 2015 OPNFV +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without warranty of any kind. +# +# Contributors: +# Aihua Li, Huawei Technologies. + +include ../mk/master.mk +include ../package-list.mk + +# DPDK_DIR is the top directory for dpdk source tree +# it can be passed in from Makefile command +# if it is not set, try to read it in from environment +# if it is still not set, then set it using relative path + +DPDK_DIR ?= $(shell echo $$DPDK_DIR) +ifeq ($(DPDK_DIR),) +DPDK_DIR = ../../dpdk/dpdk +endif + +.PHONY: install force_install config force_make + +# install depends on make +force_install: force_make + +WORK_DIR = ovs +TAG_DONE_FLAG = $(WORK_DIR)/.$(OVS_TAG).done +CONFIG_CMD = +CONFIG_CMD += ./configure +CONFIG_CMD += --with-linux=$(LINUX_BUILD) +CONFIG_CMD += --prefix=$(INSTALL_DIR)/usr +CONFIG_CMD += --localstatedir=$(INSTALL_DIR)/usr/local +CONFIG_CMD += --with-dpdk=$(DPDK_DIR)/build + +all: force_make + @echo "Finished making $(WORK_DIR) " + +config $(WORK_DIR)/Makefile: $(WORK_DIR)/configure + $(AT)cd $(WORK_DIR); $(CONFIG_CMD) + @echo "Configure done" + +INSTALL_TARGET = force_install force_make + +force_make: $(WORK_DIR)/Makefile + $(AT)$(MAKE) -C $(WORK_DIR) $(MORE_MAKE_FLAGS) + @echo "Make done" + +force_install: + $(AT)sudo make -C $(WORK_DIR) modules_install + $(AT)sudo $(MAKE) -C $(WORK_DIR) install + +install: $(INSTALL_TARGET) + +# hard way to clean and clobber +clean: +clobber: + $(AT)rm -rf $(WORK_DIR) + +# cleanse is for developer who would like to keep the +# clone git repo, saving time to fetch again from url +cleanse: + $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f + +.PHONY: boot +# boot ovs is the process to produce the script 'configure' +boot $(WORK_DIR)/configure: + @echo "booting up ovs" + $(AT)cd $(WORK_DIR); ./boot.sh + @echo "done booting ovs" + +boot $(WORK_DIR)/configure: $(TAG_DONE_FLAG) + +$(WORK_DIR): + $(AT)git clone $(OVS_URL) + +$(TAG_DONE_FLAG): $(WORK_DIR) + $(AT)cd ovs; git checkout $(OVS_TAG) +ifneq ($(PATCH_FILE),) + $(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE) +endif + $(AT)touch $@ diff --git a/src/package-list.mk b/src/package-list.mk new file mode 100644 index 00000000..0e64457b --- /dev/null +++ b/src/package-list.mk @@ -0,0 +1,13 @@ +# Upstream Package List +# +# Everything here is defined as its suggested default +# value, it can always be overriden when invoking Make + +# dpdk section +# DPDK_URL ?= git://dpdk.org/dpdk +DPDK_URL ?= http://dpdk.org/git/dpdk +DPDK_TAG ?= v1.6.0r0 + +# OVS section +OVS_URL ?= https://github.com/openvswitch/ovs +OVS_TAG ?= v2.3.1 |