AArch64: fuel-plugin-ovs enable 15/16015/9
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 20 Jun 2016 17:28:17 +0000 (19:28 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 14 Sep 2016 14:46:17 +0000 (16:46 +0200)
OVS-DPDK-NSH is not supported on arm64 for now, see [1]

Closes: ARMBAND-46

[1] https://jira.opnfv.org/browse/ARMBAND-86

Change-Id: I79b33bab7348e297c06ff4bb2bf7cc23f21eb7e3
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
patches/fuel-plugin-ovs/0002-Cleanup-Use-dget-instead-of-wget-dpkg-source.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0003-Cleanup-Drop-git-dependency.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0004-build-apt-force-yes.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0005-pre_build_hook-Introduce-USE_DOCKER-option.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0006-build-install-pre_build_hook-Prepare-multiarch.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0007-AArch64-Add-native-build-support.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch [new file with mode: 0644]
patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch [new file with mode: 0644]
patches/opnfv-fuel/0043-build-Add-armband.mk-config.patch

diff --git a/patches/fuel-plugin-ovs/0002-Cleanup-Use-dget-instead-of-wget-dpkg-source.patch b/patches/fuel-plugin-ovs/0002-Cleanup-Use-dget-instead-of-wget-dpkg-source.patch
new file mode 100644 (file)
index 0000000..e9b90be
--- /dev/null
@@ -0,0 +1,48 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Fri, 24 Jun 2016 16:51:41 +0200
+Subject: [PATCH] Cleanup: Use dget instead of wget+dpkg-source.
+
+We already install devscripts, which provides dget.
+
+See [1] for using `dget -x -u` to accelerate/simplify code dev.
+
+FIXME: Remove `-u` when we add Ubuntu signing keys to builder
+docker keyring.
+
+[1] https://debian-administration.org/article/
+    504/Downloading_Debian_source_packages_easily
+
+Change-Id: Ifbcac2a14c7b34216894adb7c5c4e921bf556e33
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ovs_build/build-ovs-nsh-dpdk.sh | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
+index 1b42df1..3d7edea 100755
+--- a/ovs_build/build-ovs-nsh-dpdk.sh
++++ b/ovs_build/build-ovs-nsh-dpdk.sh
+@@ -17,10 +17,7 @@ sudo apt-get -y install devscripts dpkg-dev git wget
+ rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}
+ cd ${BUILD_HOME}
+-wget -c https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
+-wget -c https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0.orig.tar.gz
+-wget -c https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.debian.tar.xz
+-dpkg-source -x dpdk_2.2.0-0ubuntu8.dsc
++dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
+ # copy from debian/control
+ sudo apt-get install -y debhelper \
+@@ -49,10 +46,7 @@ cd ${BUILD_HOME}; sudo dpkg -i *.deb
+ apt-get download libxenstore3.0
+ cd ${BUILD_HOME}
+-wget -c https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0.orig.tar.gz
+-wget -c https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
+-wget -c https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.debian.tar.xz
+-dpkg-source -x openvswitch-dpdk_2.4.0-0ubuntu1.dsc
++dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
+ # copy from debian/control
+ sudo apt-get install -y autoconf \
diff --git a/patches/fuel-plugin-ovs/0003-Cleanup-Drop-git-dependency.patch b/patches/fuel-plugin-ovs/0003-Cleanup-Drop-git-dependency.patch
new file mode 100644 (file)
index 0000000..89cab56
--- /dev/null
@@ -0,0 +1,99 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Sat, 3 Sep 2016 20:42:06 +0200
+Subject: [PATCH] Cleanup: Drop git dependency
+
+We only use git to fetch upstream contents, this can be achieved
+with a simple wget.
+
+Change-Id: I07f681e44253cc1f390943eb121a694bf2c9d95f
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ovs_build/build-ovs-dpdk.sh     | 10 +++++-----
+ ovs_build/build-ovs-nsh-dpdk.sh | 12 ++++++------
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
+index aeb5eb7..9e92014 100755
+--- a/ovs_build/build-ovs-dpdk.sh
++++ b/ovs_build/build-ovs-dpdk.sh
+@@ -3,14 +3,14 @@
+ set -eux
+ OVS_COMMIT=9f4ecd654dbcb88b15a424445184591fc887537e
+-URL_OVS=https://github.com/openvswitch/ovs.git
++URL_OVS_ARCHIVE=https://github.com/openvswitch/ovs/archive
+ BUILD_DEB=${BUILD_DEB:-/deb}
+ BUILD_SRC="$(dirname `readlink -f $0`)"
+ BUILD_DEST=${BUILD_DEST:-/tmp/ovs-dpdk}
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+-sudo apt-get -y install devscripts dpkg-dev git wget
++sudo apt-get -y install devscripts dpkg-dev wget
+ rm -rf ${BUILD_DEST}; mkdir -p ${BUILD_DEST}
+@@ -62,9 +62,9 @@ sudo apt-get install -y autoconf \
+                python-zopeinterface \
+                python-six
+-git clone https://github.com/openvswitch/ovs.git
+-cd ovs; git checkout ${OVS_COMMIT}; rm -rf .git
+-cd ${BUILD_DEST}; cp -r ovs ovs-dpdk
++wget -c ${URL_OVS_ARCHIVE}/${OVS_COMMIT}.tar.gz
++tar xzf ${OVS_COMMIT}.tar.gz; mv ovs-${OVS_COMMIT} ovs
++cp -r ovs ovs-dpdk
+ cd ovs-dpdk
+ cp -r ${BUILD_SRC}/openvswitch-dpdk_2.5.90/debian .
+diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
+index 3d7edea..ec5eef4 100755
+--- a/ovs_build/build-ovs-nsh-dpdk.sh
++++ b/ovs_build/build-ovs-nsh-dpdk.sh
+@@ -3,7 +3,7 @@
+ set -eux
+ OVS_COMMIT=7d433ae57ebb90cd68e8fa948a096f619ac4e2d8
+-URL_OVS=https://github.com/openvswitch/ovs.git
++URL_OVS_ARCHIVE=https://github.com/openvswitch/ovs/archive
+ OVS_VER=${OVS_VER:-2.5.90}
+ BUILD_HOME=$HOME/nsh
+ BUILD_DEST=${BUILD_DEST:-/deb}
+@@ -12,7 +12,7 @@ DIR="$(dirname `readlink -f $0`)"
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+ sudo apt-get build-dep openvswitch -y
+-sudo apt-get -y install devscripts dpkg-dev git wget
++sudo apt-get -y install devscripts dpkg-dev wget
+ rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}
+@@ -35,7 +35,7 @@ sudo apt-get install -y debhelper \
+                texlive-fonts-recommended  \
+                texlive-latex-extra
+-cd dpdk-2.2.0; rm -rf debian/patches/;
++cd dpdk-2.2.0; rm -rf debian/patches/
+ cat << EOF > debian/changelog
+ dpdk (2.2.0-1) unstable; urgency=low
+   * DPDK 2.2.0
+@@ -68,8 +68,8 @@ sudo apt-get install -y autoconf \
+                python-zopeinterface \
+                python-six
+-git clone https://github.com/openvswitch/ovs.git
+-cd ovs; git checkout ${OVS_COMMIT}
++wget -c ${URL_OVS_ARCHIVE}/${OVS_COMMIT}.tar.gz
++tar xzf ${OVS_COMMIT}.tar.gz; mv ovs-${OVS_COMMIT} ovs
+ PATCHES=$(cd ${DIR}/patches; echo *patch)
+ for patch in ${PATCHES}
+ do
+@@ -82,7 +82,7 @@ cd ../openvswitch-dpdk-${OVS_VER}
+ sed -i "s/include\/rte_config.h/include\/dpdk\/rte_config.h/" acinclude.m4
+ sed -i 's/DPDK_INCLUDE=.*/DPDK_INCLUDE=$RTE_SDK\/include\/dpdk/'  acinclude.m4
+ autoreconf --install
+-rm -rf debian/patches/ .git;
++rm -rf debian/patches/
+ cat << EOF > debian/changelog
+ openvswitch-dpdk (${OVS_VER}-1.nsh) unstable; urgency=low
+   * Support NSH
diff --git a/patches/fuel-plugin-ovs/0004-build-apt-force-yes.patch b/patches/fuel-plugin-ovs/0004-build-apt-force-yes.patch
new file mode 100644 (file)
index 0000000..5b5712d
--- /dev/null
@@ -0,0 +1,87 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Sat, 3 Sep 2016 20:52:05 +0200
+Subject: [PATCH] build: apt: --force-yes.
+
+For arm64 builds, some packages are fetched from linux.enea.com,
+leading to package version being reported as "older", although in
+fact it is newer (dpkg version comparison is not that great with
+suffixes). Also, since we don't explicitly add the GPG key of
+the linux.enea.com repo yet, apt is complaining about unverified
+package sources.
+
+Bypass the above by using "--force-yes", next to "-y".
+
+Change-Id: I4899fe62aaad9a13f8b2f9ffbdf2f3631ecba164
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ovs_build/build-ovs-dpdk.sh     | 8 ++++----
+ ovs_build/build-ovs-nsh-dpdk.sh | 8 ++++----
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
+index 9e92014..75904f2 100755
+--- a/ovs_build/build-ovs-dpdk.sh
++++ b/ovs_build/build-ovs-dpdk.sh
+@@ -10,7 +10,7 @@ BUILD_DEST=${BUILD_DEST:-/tmp/ovs-dpdk}
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+-sudo apt-get -y install devscripts dpkg-dev wget
++sudo apt-get -y --force-yes install devscripts dpkg-dev wget
+ rm -rf ${BUILD_DEST}; mkdir -p ${BUILD_DEST}
+@@ -21,7 +21,7 @@ cd dpdk-16.07
+ cp -r ${BUILD_SRC}/dpdk_16.07/debian .
+ # copy from debian/control
+-sudo apt-get install -y debhelper \
++sudo apt-get install -y --force-yes debhelper \
+                dh-python \
+                dh-systemd \
+                doxygen  \
+@@ -41,9 +41,9 @@ cd ${BUILD_DEST}
+ sudo dpkg -i *.deb
+ apt-get download libxenstore3.0
+-sudo apt-get build-dep openvswitch -y
++sudo apt-get build-dep openvswitch -y --force-yes
+ # copy from debian/control
+-sudo apt-get install -y autoconf \
++sudo apt-get install -y --force-yes autoconf \
+                automake \
+                bzip2 \
+                debhelper \
+diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
+index ec5eef4..3b84f4c 100755
+--- a/ovs_build/build-ovs-nsh-dpdk.sh
++++ b/ovs_build/build-ovs-nsh-dpdk.sh
+@@ -11,8 +11,8 @@ DIR="$(dirname `readlink -f $0`)"
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+-sudo apt-get build-dep openvswitch -y
+-sudo apt-get -y install devscripts dpkg-dev wget
++sudo apt-get build-dep openvswitch -y --force-yes
++sudo apt-get -y --force-yes install devscripts dpkg-dev wget
+ rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}
+@@ -20,7 +20,7 @@ cd ${BUILD_HOME}
+ dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
+ # copy from debian/control
+-sudo apt-get install -y debhelper \
++sudo apt-get install -y --force-yes debhelper \
+                dh-python \
+                dh-systemd \
+                doxygen  \
+@@ -49,7 +49,7 @@ cd ${BUILD_HOME}
+ dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
+ # copy from debian/control
+-sudo apt-get install -y autoconf \
++sudo apt-get install -y --force-yes autoconf \
+                automake \
+                bzip2 \
+                debhelper \
diff --git a/patches/fuel-plugin-ovs/0005-pre_build_hook-Introduce-USE_DOCKER-option.patch b/patches/fuel-plugin-ovs/0005-pre_build_hook-Introduce-USE_DOCKER-option.patch
new file mode 100644 (file)
index 0000000..dbbfefc
--- /dev/null
@@ -0,0 +1,77 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Sun, 26 Jun 2016 20:00:22 +0200
+Subject: [PATCH] pre_build_hook: Introduce USE_DOCKER option
+
+The build system uses Ubuntu Trusty, which is not properly supported
+by Docker on AArch64 architecture.
+Introduce a new environment variable for enabling/disabling build
+containerization, and disable by default said variable for AArch64.
+
+This requires a slight rework of the pre_build_hook script.
+
+NOTE: Setting USE_DOCKER to false will build the packages on the host
+machine directly.
+
+AArch64 WARNING: This build will install packages automatically!
+
+Change-Id: Ib1294949ecc1767f12631a82e2c7099c45fcb615
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ pre_build_hook | 33 +++++++++++++++++++++++----------
+ 1 file changed, 23 insertions(+), 10 deletions(-)
+
+diff --git a/pre_build_hook b/pre_build_hook
+index 63cf7b4..b9ae6bb 100755
+--- a/pre_build_hook
++++ b/pre_build_hook
+@@ -3,27 +3,40 @@
+ set -eux
+ BUILD_FOR=${BUILD_FOR:-ubuntu}
++USE_DOCKER=${USE_DOCKER:-true}
+ DIR="$(dirname `readlink -f $0`)"
++if [ `uname -m` = 'aarch64' ]; then
++  USE_DOCKER=false
++fi
++
+ function build_pkg {
+   case $1 in
+     ubuntu)
+-      rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu
++      DEB_DIR=${DIR}/deb-ovs-dpdk
++      DEB_DIR_NSH=${DIR}/deb-ovs-nsh-dpdk
++
++      rm -rf ${DIR}/repositories/ubuntu ${DEB_DIR} ${DEB_DIR_NSH}
++      mkdir -p ${DIR}/repositories/ubuntu ${DEB_DIR} ${DEB_DIR_NSH}
++      sudo chmod -R 777 ${DEB_DIR} ${DEB_DIR_NSH}
+       cd ${DIR}/ovs_build
+-      sudo docker build -t ovs_build .
++      if [ "${USE_DOCKER}" = true ]; then
++        sudo docker build -t ovs_build .
++        sudo docker run -v ${DEB_DIR}:/deb -t ovs_build /ovs_build/build-ovs-dpdk.sh
++        sudo docker run -v ${DEB_DIR_NSH}:/deb -t ovs_build /ovs_build/build-ovs-nsh-dpdk.sh
++      else
++        rm -rf /tmp/ovs-build-{,nsh-}dpdk; mkdir -p /tmp/ovs-build-{,nsh-}dpdk
++        BUILD_HOME=/tmp/ovs-build-dpdk BUILD_DEB=${DEB_DIR} ./build-ovs-dpdk.sh
++        BUILD_HOME=/tmp/ovs-build-nsh-dpdk BUILD_DEST=${DEB_DIR_NSH} ./build-ovs-nsh-dpdk.sh
++        rm -rf /tmp/ovs-build-{,nsh-}dpdk
++      fi
+-      DEB_DIR=${DIR}/deb-ovs-dpdk
+-      rm -rf ${DEB_DIR};  mkdir -p ${DEB_DIR}; chmod 777 ${DEB_DIR};
+-      sudo docker run -v ${DEB_DIR}:/deb -t  ovs_build /ovs_build/build-ovs-dpdk.sh
+       cd ${DEB_DIR}; tar czvf ../repositories/ubuntu/ovs-dpdk.tar.gz .;
+       cd ..; rm -rf ${DEB_DIR}
+-      DEB_DIR=${DIR}/deb-ovs-nsh-dpdk
+-      rm -rf ${DEB_DIR};  mkdir -p ${DEB_DIR}; chmod 777 ${DEB_DIR};
+-      sudo docker run -v ${DEB_DIR}:/deb -t  ovs_build /ovs_build/build-ovs-nsh-dpdk.sh
+-      cd ${DEB_DIR}; tar czvf ../repositories/ubuntu/ovs-nsh-dpdk.tar.gz .;
+-      cd ..; rm -rf ${DEB_DIR}
++      cd ${DEB_DIR_NSH}; tar czvf ../repositories/ubuntu/ovs-nsh-dpdk.tar.gz .;
++      cd ..; rm -rf ${DEB_DIR_NSH}
+       ;;
+     *) echo "Not supported system"; exit 1;;
diff --git a/patches/fuel-plugin-ovs/0006-build-install-pre_build_hook-Prepare-multiarch.patch b/patches/fuel-plugin-ovs/0006-build-install-pre_build_hook-Prepare-multiarch.patch
new file mode 100644 (file)
index 0000000..8ba8dd2
--- /dev/null
@@ -0,0 +1,381 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Sun, 26 Jun 2016 20:17:59 +0200
+Subject: [PATCH] build, install, pre_build_hook: Prepare multiarch
+
+install.sh: Factor out dpkg arch into var, read it from dpkg.
+install.sh: Relax DPDK/OVS/OVS-DPDK version hardcodes
+
+Instead of putting all debs in one archive, and possibly wasting
+bandwidth / space with unused foreign packages, split plugin
+archive(s) into arch-specific archives, with <_${arch}> suffix.
+E.g. <ovs-dpdk.tar.gz> for <amd64> becomes <ovs-dpdk_amd64.tar.gz>
+
+Since only one (DPDK/OVS/OVS-DPDK) set of packages is shipped per
+archive, we can safely wildcard the installed version of libdpdk,
+which previously hardcoded 2.2.0 and 16.04 for NSH/non-NSH.
+
+This is helpful for arm64, which has a custom deb subversion
+for DPDK16.07 and also requires DPDK16.07 for OVS-DPDK-NSH, instead
+of 2.2.0.
+
+Pass UBUNTU_ARCH from pre_build_hook and make install.sh more
+arch-independant.
+
+CHANGE:
+ UBUNTU_ARCH specifies the complete list of supported architectures
+ of the resulting RPM, in `dpkg --print-architecture` format.
+ e.g. UBUNTU_ARCH='arm64 amd64' will result in x86 + AArch64 support
+
+Change-Id: I04ac0a78319b460270545708efc4b53f02f7dd05
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ deployment_scripts/install.sh   | 51 +++++++++++-----------
+ ovs_build/build-ovs-dpdk.sh     | 64 ++++++++++++++++------------
+ ovs_build/build-ovs-nsh-dpdk.sh | 93 ++++++++++++++++++++++++-----------------
+ pre_build_hook                  | 24 +++++++----
+ 4 files changed, 136 insertions(+), 96 deletions(-)
+
+diff --git a/deployment_scripts/install.sh b/deployment_scripts/install.sh
+index efbed72..46d74bb 100644
+--- a/deployment_scripts/install.sh
++++ b/deployment_scripts/install.sh
+@@ -9,34 +9,33 @@ host=$1
+ nsh=$2
+ dpdk=$3
+ dpdk_socket_mem=${4:-''}
++arch=$(dpkg --print-architecture)
++ovs="ovs-dpdk_${arch}.tar.gz"
+-if [ $nsh = 'true' ]
+-then
+-    curl  http://$host:8080/plugins/fuel-plugin-ovs-0.9/repositories/ubuntu/ovs-nsh-dpdk.tar.gz | tar -xzv
+-    dpkg -i openvswitch-datapath-dkms_2.5.90-1.nsh_all.deb
+-    dpkg -i openvswitch-common_2.5.90-1.nsh_amd64.deb
+-    dpkg -i openvswitch-switch_2.5.90-1.nsh_amd64.deb
+-    dpkg -i python-openvswitch_2.5.90-1.nsh_all.deb
+-    if [ $dpdk = 'true' ]
+-    then
++if [ $nsh = 'true' ]; then
++    ovs="ovs-nsh-dpdk_${arch}.tar.gz"
++fi
++ 
++curl  http://$host:8080/plugins/fuel-plugin-ovs-0.9/repositories/ubuntu/${ovs} | tar -xzv
++dpkg -i openvswitch-datapath-dkms_*.deb
++dpkg -i openvswitch-common_*.deb
++dpkg -i openvswitch-switch_*.deb
++dpkg -i python-openvswitch_*.deb
++if [ $dpdk = 'true' ]; then
++    if [ $nsh = 'true' -o -n $dpdk_socket_mem ]; then
+         dpkg -i libxenstore3.0*.deb
+-        dpkg -i libdpdk0_2.2.0-1_amd64.deb
+-        dpkg -i dpdk_2.2.0-1_amd64.deb
+-        dpkg -i openvswitch-switch-dpdk_2.5.90-1.nsh_amd64.deb
++        if [ $arch = 'arm64' ]; then
++          # FIXME(armband): arm64 DPDK ships individual libs, install them all
++          dpdk_deb_name=$(ls dpdk_*)
++          dpdk_deb_suffix=${dpdk_deb_name#dpdk_}
++          dpkg -i *${dpdk_deb_suffix%_*}*.deb
++        else
++          dpkg -i libdpdk0_*.deb
++          dpkg -i dpdk_*.deb
++        fi
++        dpkg -i openvswitch-switch-dpdk_*.deb
+     fi
+-else
+-    curl  http://$host:8080/plugins/fuel-plugin-ovs-0.9/repositories/ubuntu/ovs-dpdk.tar.gz | tar -xzv
+-    dpkg -i openvswitch-datapath-dkms_2.5.90-1_all.deb
+-    dpkg -i openvswitch-common_2.5.90-1_amd64.deb
+-    dpkg -i openvswitch-switch_2.5.90-1_amd64.deb
+-    dpkg -i python-openvswitch_2.5.90-1_all.deb
+-    if [[ $dpdk = 'true' && -n $dpdk_socket_mem ]]
+-    then
+-        dpkg -i libxenstore3.0*.deb
+-        dpkg -i libdpdk0_16.07-1_amd64.deb
+-        dpkg -i dpdk_16.07-1_amd64.deb
+-        dpkg -i openvswitch-switch-dpdk_2.5.90-1_amd64.deb
+-
++    if ! [ $nsh = 'true' -a -n $dpdk_socket_mem ]; then
+         #Set to 0, dpdk init script mount hugepages but don't change current allocation
+         sed -i "s/[# ]*\(NR_2M_PAGES=\).*/\10/" /etc/dpdk/dpdk.conf
+         service dpdk start
+@@ -47,3 +46,5 @@ else
+         service openvswitch-switch restart
+     fi
+ fi
++
++rm -rf $INSTALL_HOME
+diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
+index dd9c6ff..a14f5fd 100755
+--- a/ovs_build/build-ovs-dpdk.sh
++++ b/ovs_build/build-ovs-dpdk.sh
+@@ -10,18 +10,27 @@ BUILD_DEST=${BUILD_DEST:-/tmp/ovs-dpdk}
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+-sudo apt-get -y --force-yes install devscripts dpkg-dev wget
++# Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
++# All archs should be represented in `dpkg --print-architecture` format
++# UBUNTU_ARCH holds a space-separated list of target arch(s)
++# FIXME(armband): For now, only native building is supported!
++BUILD_ARCH=$(dpkg --print-architecture)
++UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}}
+-rm -rf ${BUILD_DEST}; mkdir -p ${BUILD_DEST}
++# Build and/or fetch precompiled packages for all arch(s) in UBUNTU_ARCH
++for ARCH in ${UBUNTU_ARCH}; do
++  rm -rf ${BUILD_DEST}; mkdir -p ${BUILD_DEST}; cd ${BUILD_DEST}
++  if [ ${ARCH} = ${BUILD_ARCH} ]; then
++    # Native building for: DPDK, OVS-DPDK, OVS
++    sudo apt-get -y --force-yes install devscripts dpkg-dev wget
+-cd ${BUILD_DEST}
+-wget -c http://fast.dpdk.org/rel/dpdk-16.07.tar.xz
+-xz -d dpdk-16.07.tar.xz; tar xvf dpdk-16.07.tar
+-cd dpdk-16.07
+-cp -r ${BUILD_SRC}/dpdk_16.07/debian .
++    wget -c http://fast.dpdk.org/rel/dpdk-16.07.tar.xz
++    xz -d dpdk-16.07.tar.xz; tar xvf dpdk-16.07.tar
++    cd dpdk-16.07
++    cp -r ${BUILD_SRC}/dpdk_16.07/debian .
+-# copy from debian/control
+-sudo apt-get install -y --force-yes debhelper \
++    # DPDK build-dep install: copy from debian/control
++    sudo apt-get install -y --force-yes debhelper \
+                dh-python \
+                dh-systemd \
+                doxygen  \
+@@ -35,15 +44,15 @@ sudo apt-get install -y --force-yes debhelper \
+                python-sphinx  \
+                texlive-fonts-recommended  \
+                texlive-latex-extra
+-debian/rules build; fakeroot debian/rules binary
++    debian/rules build; fakeroot debian/rules binary
+-cd ${BUILD_DEST}
+-sudo dpkg -i *.deb
+-apt-get download libxenstore3.0
++    cd ${BUILD_DEST}
++    sudo dpkg -i *.deb
++    apt-get download libxenstore3.0
+-sudo apt-get build-dep openvswitch -y --force-yes
+-# copy from debian/control
+-sudo apt-get install -y --force-yes autoconf \
++    sudo apt-get build-dep openvswitch -y --force-yes
++    # OVS-DPDK build-dep install: copy from debian/control
++    sudo apt-get install -y --force-yes autoconf \
+                automake \
+                bzip2 \
+                debhelper \
+@@ -62,16 +71,19 @@ sudo apt-get install -y --force-yes autoconf \
+                python-zopeinterface \
+                python-six
+-wget -c ${URL_OVS_ARCHIVE}/${OVS_COMMIT}.tar.gz
+-tar xzf ${OVS_COMMIT}.tar.gz; mv ovs-${OVS_COMMIT} ovs
+-cp -r ovs ovs-dpdk
++    wget -c ${URL_OVS_ARCHIVE}/${OVS_COMMIT}.tar.gz
++    tar xzf ${OVS_COMMIT}.tar.gz; mv ovs-${OVS_COMMIT} ovs
++    cp -r ovs ovs-dpdk
+-cd ovs-dpdk
+-cp -r ${BUILD_SRC}/openvswitch-dpdk_2.5.90/debian .
+-debian/rules build; fakeroot debian/rules binary
++    cd ovs-dpdk
++    cp -r ${BUILD_SRC}/openvswitch-dpdk_2.5.90/debian .
++    debian/rules build; fakeroot debian/rules binary
+-cd ${BUILD_DEST}/ovs
+-debian/rules build; fakeroot debian/rules binary
++    cd ${BUILD_DEST}/ovs
++    debian/rules build; fakeroot debian/rules binary
++  fi
+-cp -r ${BUILD_DEST}/*.deb ${BUILD_DEB}
+-rm -rf ${BUILD_DEST}
++  # Store DEBs in <${BUILD_DEB}/${ARCH}/> dir and cleanup
++  rm -rf ${BUILD_DEB}/${ARCH}; mkdir -p ${BUILD_DEB}/${ARCH}; cd ${BUILD_DEB}/${ARCH}
++  cp ${BUILD_DEST}/*.deb .; rm -rf ${BUILD_DEST}
++done
+diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
+index 3751c02..a65a2bb 100755
+--- a/ovs_build/build-ovs-nsh-dpdk.sh
++++ b/ovs_build/build-ovs-nsh-dpdk.sh
+@@ -11,16 +11,24 @@ DIR="$(dirname `readlink -f $0`)"
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+-sudo apt-get build-dep openvswitch -y --force-yes
+-sudo apt-get -y --force-yes install devscripts dpkg-dev wget
++# Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
++# All archs should be represented in `dpkg --print-architecture` format
++# UBUNTU_ARCH holds a space-separated list of target arch(s)
++# FIXME(armband): For now, only native building is supported!
++BUILD_ARCH=$(dpkg --print-architecture)
++UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}}
+-rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}
++# Build and/or fetch precompiled packages for all arch(s) in UBUNTU_ARCH
++for ARCH in ${UBUNTU_ARCH}; do
++  rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}; cd ${BUILD_HOME}
++  if [ ${ARCH} = ${BUILD_ARCH} ]; then
++    # Native building for: DPDK, OVS-DPDK, OVS
++    sudo apt-get build-dep openvswitch -y --force-yes
++    sudo apt-get -y --force-yes install devscripts dpkg-dev wget
++    dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
+-cd ${BUILD_HOME}
+-dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
+-
+-# copy from debian/control
+-sudo apt-get install -y --force-yes debhelper \
++    # DPDK build-dep install: copy from debian/control
++    sudo apt-get install -y --force-yes debhelper \
+                dh-python \
+                dh-systemd \
+                doxygen  \
+@@ -35,21 +43,22 @@ sudo apt-get install -y --force-yes debhelper \
+                texlive-fonts-recommended  \
+                texlive-latex-extra
+-cd dpdk-2.2.0; rm -rf debian/patches/
+-cat << EOF > debian/changelog
++    cd dpdk-2.2.0; rm -rf debian/patches/
++    cat << EOF > debian/changelog
+ dpdk (2.2.0-1) unstable; urgency=low
+   * DPDK 2.2.0
+  -- DPDK team <dev@dpdk.org>  $(date --rfc-2822)
+ EOF
+-debian/rules build; fakeroot debian/rules binary
+-cd ${BUILD_HOME}; sudo dpkg -i *.deb
+-apt-get download libxenstore3.0
++    # DPDK build & install (required for following native build of OVS-NSH)
++    debian/rules build; fakeroot debian/rules binary
++    cd ${BUILD_HOME}; sudo dpkg -i *.deb
++    apt-get download libxenstore3.0
+-cd ${BUILD_HOME}
+-dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
++    cd ${BUILD_HOME}
++    dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
+-# copy from debian/control
+-sudo apt-get install -y --force-yes autoconf \
++    # OVS-NSH build-dep install: copy from debian/control
++    sudo apt-get install -y --force-yes autoconf \
+                automake \
+                bzip2 \
+                debhelper \
+@@ -68,33 +77,41 @@ sudo apt-get install -y --force-yes autoconf \
+                python-zopeinterface \
+                python-six
+-wget -c ${URL_OVS_ARCHIVE}/${OVS_COMMIT}.tar.gz
+-tar xzf ${OVS_COMMIT}.tar.gz; mv ovs-${OVS_COMMIT} ovs
+-PATCHES=$(cd ${DIR}/patches; echo *patch)
+-for patch in ${PATCHES}
+-do
+-    patch -p1 < ${DIR}/patches/${patch}
+-done
+-cd ${BUILD_HOME}; tar czvf ovs.tar.gz ovs
+-rm -rf openvswitch-dpdk-${OVS_VER}*
+-cd openvswitch-dpdk-2.4.0; uupdate -v ${OVS_VER} ../ovs.tar.gz
+-cd ../openvswitch-dpdk-${OVS_VER}
+-sed -i "s/include\/rte_config.h/include\/dpdk\/rte_config.h/" acinclude.m4
+-sed -i 's/DPDK_INCLUDE=.*/DPDK_INCLUDE=$RTE_SDK\/include\/dpdk/'  acinclude.m4
+-autoreconf --install
+-rm -rf debian/patches/
+-cat << EOF > debian/changelog
++    # OVS-NSH build preparations: download sources, patch if needed
++    wget -c ${URL_OVS_ARCHIVE}/${OVS_COMMIT}.tar.gz
++    tar xzf ${OVS_COMMIT}.tar.gz; mv ovs-${OVS_COMMIT} ovs; cd ovs
++
++    # Apply OVS-NSH patches, create a new orig tar archive
++    PATCHES=$(cd ${DIR}/patches; echo *patch)
++    for patch in ${PATCHES}
++    do
++      patch -p1 < ${DIR}/patches/${patch}
++    done
++    cd ${BUILD_HOME}; tar czvf ovs.tar.gz ovs
++    rm -rf openvswitch-dpdk-${OVS_VER}*
++    cd openvswitch-dpdk-2.4.0; uupdate -v ${OVS_VER} ../ovs.tar.gz
++    cd ../openvswitch-dpdk-${OVS_VER}
++    sed -i "s/include\/rte_config.h/include\/dpdk\/rte_config.h/" acinclude.m4
++    sed -i 's/DPDK_INCLUDE=.*/DPDK_INCLUDE=$RTE_SDK\/include\/dpdk/'  acinclude.m4
++    autoreconf --install
++    rm -rf debian/patches/
++    cat << EOF > debian/changelog
+ openvswitch-dpdk (${OVS_VER}-1.nsh) unstable; urgency=low
+   * Support NSH
+  -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
+ EOF
+-debian/rules build; fakeroot debian/rules binary
++    debian/rules build; fakeroot debian/rules binary
+-cd ${BUILD_HOME}/ovs
+-cat << EOF > debian/changelog
++    cd ${BUILD_HOME}/ovs
++    cat << EOF > debian/changelog
+ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low
+   * Support NSH
+  -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
+ EOF
+-debian/rules build; fakeroot debian/rules binary
+-cp ${BUILD_HOME}/*.deb ${BUILD_DEST}
++    debian/rules build; fakeroot debian/rules binary
++  fi
++
++  # Store DEBs in <${BUILD_DEST}/${ARCH}/> dir and cleanup
++  rm -rf ${BUILD_DEST}/${ARCH}; mkdir -p ${BUILD_DEST}/${ARCH}; cd ${BUILD_DEST}/${ARCH}
++  cp ${BUILD_HOME}/*.deb .
++done
+diff --git a/pre_build_hook b/pre_build_hook
+index b9ae6bb..3e46a37 100755
+--- a/pre_build_hook
++++ b/pre_build_hook
+@@ -10,6 +10,11 @@ if [ `uname -m` = 'aarch64' ]; then
+   USE_DOCKER=false
+ fi
++# Pass target arch(s) (UBUNTU_ARCH) to build scripts.
++# All archs should be represented in `dpkg --print-architecture` format
++# UBUNTU_ARCH holds a space-separated list of target arch(s)
++export UBUNTU_ARCH=${UBUNTU_ARCH:-$(dpkg --print-architecture)}
++
+ function build_pkg {
+   case $1 in
+     ubuntu)
+@@ -23,8 +28,10 @@ function build_pkg {
+       cd ${DIR}/ovs_build
+       if [ "${USE_DOCKER}" = true ]; then
+         sudo docker build -t ovs_build .
+-        sudo docker run -v ${DEB_DIR}:/deb -t ovs_build /ovs_build/build-ovs-dpdk.sh
+-        sudo docker run -v ${DEB_DIR_NSH}:/deb -t ovs_build /ovs_build/build-ovs-nsh-dpdk.sh
++        sudo docker run -e "UBUNTU_ARCH=${UBUNTU_ARCH}" -v ${DEB_DIR}:/deb \
++          -t ovs_build /ovs_build/build-ovs-dpdk.sh
++        sudo docker run -e "UBUNTU_ARCH=${UBUNTU_ARCH}" -v ${DEB_DIR_NSH}:/deb \
++          -t ovs_build /ovs_build/build-ovs-nsh-dpdk.sh
+       else
+         rm -rf /tmp/ovs-build-{,nsh-}dpdk; mkdir -p /tmp/ovs-build-{,nsh-}dpdk
+         BUILD_HOME=/tmp/ovs-build-dpdk BUILD_DEB=${DEB_DIR} ./build-ovs-dpdk.sh
+@@ -32,11 +39,14 @@ function build_pkg {
+         rm -rf /tmp/ovs-build-{,nsh-}dpdk
+       fi
+-      cd ${DEB_DIR}; tar czvf ../repositories/ubuntu/ovs-dpdk.tar.gz .;
+-      cd ..; rm -rf ${DEB_DIR}
+-
+-      cd ${DEB_DIR_NSH}; tar czvf ../repositories/ubuntu/ovs-nsh-dpdk.tar.gz .;
+-      cd ..; rm -rf ${DEB_DIR_NSH}
++      # Gather packages for each arch(s) in UBUNTU_ARCH in a separate archive
++      for ARCH in ${UBUNTU_ARCH}; do
++        cd ${DEB_DIR}/${ARCH}
++        tar czvf ../../repositories/ubuntu/ovs-dpdk_${ARCH}.tar.gz .
++        cd ${DEB_DIR_NSH}/${ARCH}
++        tar czvf ../../repositories/ubuntu/ovs-nsh-dpdk_${ARCH}.tar.gz .
++      done
++      cd ${DIR}; sudo rm -rf ${DEB_DIR} ${DEB_DIR_NSH}
+       ;;
+     *) echo "Not supported system"; exit 1;;
diff --git a/patches/fuel-plugin-ovs/0007-AArch64-Add-native-build-support.patch b/patches/fuel-plugin-ovs/0007-AArch64-Add-native-build-support.patch
new file mode 100644 (file)
index 0000000..1ea672b
--- /dev/null
@@ -0,0 +1,150 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 5 Sep 2016 18:56:46 +0200
+Subject: [PATCH] AArch64: Add native build support
+
+FIXME: OVS-NSH-DPDK is not yet supported on arm64, see [1].
+
+[1] https://jira.opnfv.org/browse/ARMBAND-86
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ovs_build/build-ovs-dpdk.sh                      | 19 ++++++++--
+ ovs_build/build-ovs-nsh-dpdk.sh                  | 48 ++++++++++++++----------
+ ovs_build/openvswitch-dpdk_2.5.90/debian/control |  2 +-
+ 3 files changed, 45 insertions(+), 24 deletions(-)
+
+diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
+index a14f5fd..a0c50e3 100755
+--- a/ovs_build/build-ovs-dpdk.sh
++++ b/ovs_build/build-ovs-dpdk.sh
+@@ -10,6 +10,10 @@ BUILD_DEST=${BUILD_DEST:-/tmp/ovs-dpdk}
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
++# AArch64 specifics, repository base URL, debian build versions
++AARCH64_REPO=${AARCH64_REPO:-'https://linux.enea.com/mos-repos/ubuntu/9.0'}
++AARCH64_DPDK_DEBV=${AARCH64_DPDK_DEBV:-'0~u14.04+mos1+mos9.0+amos1'}
++
+ # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
+ # All archs should be represented in `dpkg --print-architecture` format
+ # UBUNTU_ARCH holds a space-separated list of target arch(s)
+@@ -24,10 +28,17 @@ for ARCH in ${UBUNTU_ARCH}; do
+     # Native building for: DPDK, OVS-DPDK, OVS
+     sudo apt-get -y --force-yes install devscripts dpkg-dev wget
+-    wget -c http://fast.dpdk.org/rel/dpdk-16.07.tar.xz
+-    xz -d dpdk-16.07.tar.xz; tar xvf dpdk-16.07.tar
+-    cd dpdk-16.07
+-    cp -r ${BUILD_SRC}/dpdk_16.07/debian .
++    if [ ${ARCH} = 'arm64' ]; then
++      # Armband: arm64 already has debian control archive for DPDK 16.07
++      dget -x -u ${AARCH64_REPO}/pool/main/d/dpdk/dpdk_16.07-${AARCH64_DPDK_DEBV}.dsc
++      cd dpdk-16.07
++    else
++      # Other archs will use the debian control archive in this repo
++      wget -c http://fast.dpdk.org/rel/dpdk-16.07.tar.xz
++      xz -d dpdk-16.07.tar.xz; tar xvf dpdk-16.07.tar
++      cd dpdk-16.07
++      cp -r ${BUILD_SRC}/dpdk_16.07/debian .
++    fi
+     # DPDK build-dep install: copy from debian/control
+     sudo apt-get install -y --force-yes debhelper \
+diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
+index a65a2bb..59d8a79 100755
+--- a/ovs_build/build-ovs-nsh-dpdk.sh
++++ b/ovs_build/build-ovs-nsh-dpdk.sh
+@@ -25,10 +25,12 @@ for ARCH in ${UBUNTU_ARCH}; do
+     # Native building for: DPDK, OVS-DPDK, OVS
+     sudo apt-get build-dep openvswitch -y --force-yes
+     sudo apt-get -y --force-yes install devscripts dpkg-dev wget
+-    dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
++    # FIXME(armband): OVS-NSH-DPDK is not yet supported on arm64
+     # DPDK build-dep install: copy from debian/control
+-    sudo apt-get install -y --force-yes debhelper \
++    if [ ! ${ARCH} = 'arm64' ]; then
++      dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/dpdk_2.2.0-0ubuntu8.dsc
++      sudo apt-get install -y --force-yes debhelper \
+                dh-python \
+                dh-systemd \
+                doxygen  \
+@@ -43,19 +45,20 @@ for ARCH in ${UBUNTU_ARCH}; do
+                texlive-fonts-recommended  \
+                texlive-latex-extra
+-    cd dpdk-2.2.0; rm -rf debian/patches/
+-    cat << EOF > debian/changelog
++      cd dpdk-2.2.0; rm -rf debian/patches/
++      cat << EOF > debian/changelog
+ dpdk (2.2.0-1) unstable; urgency=low
+   * DPDK 2.2.0
+  -- DPDK team <dev@dpdk.org>  $(date --rfc-2822)
+ EOF
+-    # DPDK build & install (required for following native build of OVS-NSH)
+-    debian/rules build; fakeroot debian/rules binary
+-    cd ${BUILD_HOME}; sudo dpkg -i *.deb
+-    apt-get download libxenstore3.0
++      # DPDK build & install (required for following native build of OVS-NSH)
++      debian/rules build; fakeroot debian/rules binary
++      cd ${BUILD_HOME}; sudo dpkg -i *.deb
++      apt-get download libxenstore3.0
+-    cd ${BUILD_HOME}
+-    dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
++      # OVS-NSH-DPDK build preparations: download sources, patch if needed
++      dget -x -u https://launchpad.net/ubuntu/+archive/primary/+files/openvswitch-dpdk_2.4.0-0ubuntu1.dsc
++    fi
+     # OVS-NSH build-dep install: copy from debian/control
+     sudo apt-get install -y --force-yes autoconf \
+@@ -88,20 +91,27 @@ EOF
+       patch -p1 < ${DIR}/patches/${patch}
+     done
+     cd ${BUILD_HOME}; tar czvf ovs.tar.gz ovs
+-    rm -rf openvswitch-dpdk-${OVS_VER}*
+-    cd openvswitch-dpdk-2.4.0; uupdate -v ${OVS_VER} ../ovs.tar.gz
+-    cd ../openvswitch-dpdk-${OVS_VER}
+-    sed -i "s/include\/rte_config.h/include\/dpdk\/rte_config.h/" acinclude.m4
+-    sed -i 's/DPDK_INCLUDE=.*/DPDK_INCLUDE=$RTE_SDK\/include\/dpdk/'  acinclude.m4
+-    autoreconf --install
+-    rm -rf debian/patches/
+-    cat << EOF > debian/changelog
++
++    # FIXME(armband): OVS-NSH-DPDK is not yet supported on arm64
++    if [ ! ${ARCH} = 'arm64' ]; then
++      rm -rf openvswitch-dpdk-${OVS_VER}{,.orig*}
++      cd openvswitch-dpdk-2.4.0
++      uupdate -v ${OVS_VER} ../ovs.tar.gz
++      cd ${BUILD_HOME}/openvswitch-dpdk-${OVS_VER}
++      sed -i "s/include\/rte_config.h/include\/dpdk\/rte_config.h/" acinclude.m4
++      sed -i 's/DPDK_INCLUDE=.*/DPDK_INCLUDE=$RTE_SDK\/include\/dpdk/'  acinclude.m4
++      rm -rf debian/patches/
++      autoreconf --install
++      # OVS-NSH-DPDK build
++      cat << EOF > debian/changelog
+ openvswitch-dpdk (${OVS_VER}-1.nsh) unstable; urgency=low
+   * Support NSH
+  -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
+ EOF
+-    debian/rules build; fakeroot debian/rules binary
++      debian/rules build; fakeroot debian/rules binary
++    fi
++    # OVS-NSH build
+     cd ${BUILD_HOME}/ovs
+     cat << EOF > debian/changelog
+ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low
+diff --git a/ovs_build/openvswitch-dpdk_2.5.90/debian/control b/ovs_build/openvswitch-dpdk_2.5.90/debian/control
+index e7171b9..e0c27c5 100644
+--- a/ovs_build/openvswitch-dpdk_2.5.90/debian/control
++++ b/ovs_build/openvswitch-dpdk_2.5.90/debian/control
+@@ -27,7 +27,7 @@ Homepage: http://openvswitch.org/
+ XS-Testsuite: autopkgtest
+ Package: openvswitch-switch-dpdk
+-Architecture: i386 amd64
++Architecture: i386 amd64 arm64
+ Depends: dpdk,
+          openvswitch-switch (>= 2.4.0),
+          ${misc:Depends},
diff --git a/patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch b/patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch
new file mode 100644 (file)
index 0000000..70ea6fa
--- /dev/null
@@ -0,0 +1,144 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 12 Sep 2016 18:02:42 +0200
+Subject: [PATCH] AArch64: Add support for downloading prebuilt DEBs
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ovs_build/build-ovs-armband-fetch.sh | 45 ++++++++++++++++++++++++++++++++++++
+ ovs_build/build-ovs-dpdk.sh          | 21 ++++++++++++++++-
+ ovs_build/build-ovs-nsh-dpdk.sh      | 17 +++++++++++++-
+ 3 files changed, 81 insertions(+), 2 deletions(-)
+ create mode 100755 ovs_build/build-ovs-armband-fetch.sh
+
+diff --git a/ovs_build/build-ovs-armband-fetch.sh b/ovs_build/build-ovs-armband-fetch.sh
+new file mode 100755
+index 0000000..2a041e2
+--- /dev/null
++++ b/ovs_build/build-ovs-armband-fetch.sh
+@@ -0,0 +1,45 @@
++#!/bin/bash
++
++set -eux
++
++# armband_fetch will download all binaries for one debian source package
++#
++# Usage:
++#   armband_fetch <src_deb_name> <src_deb_version> \
++#                 [<repo_base_url> \
++#                 [<repo_Sources_relative_url> \
++#                 [<repo_Packages_relative_url>]]] \
++#
++# e.g.:
++#   armband_fetch dpdk 16.07-0~u14.04+mos1+mos9.0+amos1 \
++#     https://linux.enea.com/mos-repos/ubuntu/9.0 \
++#     dists/mos9.0-fuel-plugin-ovs/main/source/Sources \
++#     dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages
++function armband_fetch() {
++  local name=$1
++  local ver=${2//\+/\\\+}
++  local repo_base_url=${3:-https://linux.enea.com/mos-repos/ubuntu/9.0}
++  local repo_Sources_url=${4:-dists/mos9.0-fuel-plugin-ovs/main/source/Sources}
++  local repo_Packages_url=${5:-dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages}
++  local found=false
++
++  # Fetch Sources & Packages files if not already present
++  if [ ! -f Sources -o ! -f Packages ]; then
++    sudo apt-get -y --force-yes install wget
++    wget -c "${repo_base_url}/${repo_Sources_url}"
++    wget -c "${repo_base_url}/${repo_Packages_url}"
++  fi
++
++  L=$(grep -Pzo "(?s)(?<=^Package: ${name}\n^Binary: )(\N*?)(?=\n^Version: ${ver})" \
++    Sources | tr -d ',')
++  for deb_binary in ${L}; do
++    D=$(grep -Po "(?<=^Filename: )(.*?\/${deb_binary}_${ver}_.*?\.deb)" Packages) || true
++    if [ -n "${D}" ]; then
++      wget -c "${repo_base_url}/${D}" && found=true
++    fi
++  done
++  if [ ${found} = false ]; then
++    echo "ERROR: Could not find DEBs for pkg/ver: ${name}/${ver}"
++    exit 1
++  fi
++}
+diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
+index f3c2e5b..ed8f126 100755
+--- a/ovs_build/build-ovs-dpdk.sh
++++ b/ovs_build/build-ovs-dpdk.sh
+@@ -13,11 +13,16 @@ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
+ # AArch64 specifics, repository base URL, debian build versions
+ AARCH64_REPO=${AARCH64_REPO:-'https://linux.enea.com/mos-repos/ubuntu/9.0'}
+ AARCH64_DPDK_DEBV=${AARCH64_DPDK_DEBV:-'0~u14.04+mos1+mos9.0+amos1'}
++AARCH64_OVS_DEBV=${AARCH64_OVS_DEBV:-'1+amos1'}
++AARCH64_OVS_DPDK_DEBV=${AARCH64_OVS_DPDK_DEBV:-${AARCH64_OVS_DEBV}}
++# AArch64 original source version for prebuilt OVS (~MM.DD suffixed)
++AARCH64_OVS_VER=${AARCH64_OVS_VER:-'2.5.90~08.08'}
+ # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
+ # All archs should be represented in `dpkg --print-architecture` format
+ # UBUNTU_ARCH holds a space-separated list of target arch(s)
+-# FIXME(armband): For now, only native building is supported!
++# FIXME(armband): For now, only native building and/or downloading prebuilt
++# debian binaries is supported!
+ BUILD_ARCH=$(dpkg --print-architecture)
+ UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}}
+@@ -91,6 +96,20 @@ for ARCH in ${UBUNTU_ARCH}; do
+     cd ${BUILD_DEST}/ovs
+     debian/rules build; fakeroot debian/rules binary
++  else
++    # FIXME(armband): No cross-build support yet, download prebuilt DEBs
++    if [ ${ARCH} = 'arm64' ]; then
++      source ${BUILD_SRC}/build-ovs-armband-fetch.sh
++      # Fetch Sources/Packages from Armband and construct list of packages to download
++      armband_fetch 'dpdk' "16.07-${AARCH64_DPDK_DEBV}"
++      armband_fetch 'openvswitch-dpdk' "${AARCH64_OVS_VER}-${AARCH64_OVS_DPDK_DEBV}"
++      armband_fetch 'openvswitch' "${AARCH64_OVS_VER}-${AARCH64_OVS_DEBV}"
++      # libxenstore (equivalent to `apt-get download` for native build)
++      AARCH64_LIBXENSTORE='libxenstore3.0_4.4.2-0ubuntu0.14.04.6_arm64.deb'
++      wget -c "http://ports.ubuntu.com/pool/main/x/xen/${AARCH64_LIBXENSTORE}"
++    else
++      echo "WARNING: Architecture [${ARCH}] does not provide precompiled DEBs, skipping!"
++    fi
+   fi
+   # Store DEBs in <${BUILD_DEB}/${ARCH}/> dir and cleanup
+diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
+index 59d8a79..9f026ac 100755
+--- a/ovs_build/build-ovs-nsh-dpdk.sh
++++ b/ovs_build/build-ovs-nsh-dpdk.sh
+@@ -11,10 +11,16 @@ DIR="$(dirname `readlink -f $0`)"
+ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
++# AArch64 specifics, repository base URL, debian build versions
++AARCH64_OVS_DEBV=${AARCH64_OVS_DEBV:-'1.nsh+amos2'}
++# AArch64 original source version for prebuilt OVS (~MM.DD suffixed)
++AARCH64_OVS_VER=${AARCH64_OVS_VER:-'2.5.90~04.05'}
++
+ # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
+ # All archs should be represented in `dpkg --print-architecture` format
+ # UBUNTU_ARCH holds a space-separated list of target arch(s)
+-# FIXME(armband): For now, only native building is supported!
++# FIXME(armband): For now, only native building and/or downloading prebuilt
++# debian binaries is supported!
+ BUILD_ARCH=$(dpkg --print-architecture)
+ UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}}
+@@ -119,6 +125,15 @@ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low
+  -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
+ EOF
+     debian/rules build; fakeroot debian/rules binary
++  else
++    # FIXME(armband): No cross-build support yet, download prebuilt DEBs
++    if [ ${ARCH} = 'arm64' ]; then
++      source ${DIR}/build-ovs-armband-fetch.sh
++      # FIXME(armband): https://jira.opnfv.org/browse/ARMBAND-86
++      armband_fetch 'openvswitch' "${AARCH64_OVS_VER}-${AARCH64_OVS_DEBV}"
++    else
++      echo "WARNING: Architecture [${ARCH}] does not provide precompiled DEBs, skipping!"
++    fi
+   fi
+   # Store DEBs in <${BUILD_DEST}/${ARCH}/> dir and cleanup
diff --git a/patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch b/patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch
new file mode 100644 (file)
index 0000000..8f7a259
--- /dev/null
@@ -0,0 +1,82 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Wed, 14 Sep 2016 16:42:48 +0200
+Subject: [PATCH] install.sh: AArch64: Fix dpkg installation issues
+
+There are 2 minor issues with our Armband version string of
+openvswitch packages shipped for fuel-plugin-ovs:
+
+1. Setting up openvswitch-datapath-dkms (2.5.90~08.08-1+amos1)
+   ... Error! Could not find module source directory.
+
+This happens because our version string has a "+" char in it,
+and the /usr/src path looked for is trimmed at that char,
+hence dkms installation is looking for
+"/usr/src/openvswitch-2.5.90~08.08" directory instead of
+"/usr/src/openvswitch-2.5.90~08.08+amos1".
+
+Temporary fix will be to add the following to install.sh:
+ln -s openvswitch-2.5.90~08.08+amos1/ openvswitch-2.5.90~08.08
+
+2. dpkg -i complains about "breaks" dependencies in debian/control
+when reinstalling OVS 2.5.90.
+
+This happens because of faulty dpkg version comparison algorithm:
+$ dpkg --compare-versions 2.5.90~08.08-1+amos1
+  gt 2.5.90 && echo "This should work!"
+$
+
+The temporary fix will be to add --force-breaks to dpkg invocation.
+
+Related-bug: ARMBAND-89
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ deployment_scripts/install.sh | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/deployment_scripts/install.sh b/deployment_scripts/install.sh
+index 46d74bb..169c64a 100644
+--- a/deployment_scripts/install.sh
++++ b/deployment_scripts/install.sh
+@@ -17,10 +17,20 @@ if [ $nsh = 'true' ]; then
+ fi
+  
+ curl  http://$host:8080/plugins/fuel-plugin-ovs-0.9/repositories/ubuntu/${ovs} | tar -xzv
+-dpkg -i openvswitch-datapath-dkms_*.deb
+-dpkg -i openvswitch-common_*.deb
+-dpkg -i openvswitch-switch_*.deb
+-dpkg -i python-openvswitch_*.deb
++
++# FIXME(armband): https://jira.opnfv.org/browse/ARMBAND-89
++# e.g.: ln -s openvswitch-2.5.90~08.08+amos1 openvswitch-2.5.90~08.08
++for usr_src_ovs in /usr/src/openvswitch-*+*; do
++    echo ${usr_src_ovs}
++    if [ -d ${usr_src_ovs} ]; then
++        ln -sf ${usr_src_ovs} ${usr_src_ovs%+*}
++    fi
++done
++
++dpkg -i --force-breaks openvswitch-datapath-dkms_*.deb
++dpkg -i --force-breaks openvswitch-common_*.deb
++dpkg -i --force-breaks openvswitch-switch_*.deb
++dpkg -i --force-breaks python-openvswitch_*.deb
+ if [ $dpdk = 'true' ]; then
+     if [ $nsh = 'true' -o -n $dpdk_socket_mem ]; then
+         dpkg -i libxenstore3.0*.deb
+@@ -28,12 +38,12 @@ if [ $dpdk = 'true' ]; then
+           # FIXME(armband): arm64 DPDK ships individual libs, install them all
+           dpdk_deb_name=$(ls dpdk_*)
+           dpdk_deb_suffix=${dpdk_deb_name#dpdk_}
+-          dpkg -i *${dpdk_deb_suffix%_*}*.deb
++          dpkg -i --force-breaks *${dpdk_deb_suffix%_*}*.deb
+         else
+-          dpkg -i libdpdk0_*.deb
+-          dpkg -i dpdk_*.deb
++          dpkg -i --force-breaks libdpdk0_*.deb
++          dpkg -i --force-breaks dpdk_*.deb
+         fi
+-        dpkg -i openvswitch-switch-dpdk_*.deb
++        dpkg -i --force-breaks openvswitch-switch-dpdk_*.deb
+     fi
+     if ! [ $nsh = 'true' -a -n $dpdk_socket_mem ]; then
+         #Set to 0, dpdk init script mount hugepages but don't change current allocation
index fee234d..cb07c9f 100644 (file)
@@ -62,7 +62,7 @@ index 0000000..1e772f0
 +# Only configure Armband stuff when ARMBAND_BASE is set
 +ifdef ARMBAND_BASE
 +    # Armband plugins, supported archs & specific info
-+    export PLUGINS           := f_odlpluginbuild f_bgpvpn-pluginbuild
++    export PLUGINS           := f_odlpluginbuild f_bgpvpn-pluginbuild f_ovs-nsh-dpdk-pluginbuild
 +    export UBUNTU_ARCH       := amd64 arm64
 +    export PRODNO            := OPNFV_A_FUEL
 +    export MIRROR_MOS_UBUNTU := linux.enea.com