Santosh Kumar | aff594a | 2017-12-14 18:56:26 +0530 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright 2017-present Open Networking Foundation |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # |
| 18 | # Run from OpenNetworkLinux top directory |
| 19 | # |
| 20 | |
| 21 | # override shell variables to match custom local build environment |
| 22 | |
| 23 | : ${ONL_DIR=`pwd`} |
| 24 | : ${ASFVOLT16_RSD_DIR:=${ONL_DIR}/asfvolt16-driver/asfvolt16_redfish_service} |
| 25 | : ${RSD_TOPDIR:=${ASFVOLT16_RSD_DIR}/rsd_org} |
| 26 | : ${PSM_TOPDIR:=${RSD_TOPDIR}/PSME} |
| 27 | : ${RMM_TOPDIR:=${RSD_TOPDIR}/RMM} |
| 28 | : ${PSM_DEPDIR:=${PSM_TOPDIR}/third_party} |
| 29 | : ${RMM_DEPDIR:=${RMM_TOPDIR}/src/deps} |
| 30 | : ${PKG_TOPDIR:=${RSD_TOPDIR}/asfvolt16_rf_packages} |
| 31 | : ${RMM_UUID:=${RMM_DEPDIR}/uuid} |
| 32 | : ${RMM_CURL:=${RMM_DEPDIR}/libcurl} |
| 33 | : ${RMM_OSSL:=${RMM_DEPDIR}/openssl} |
| 34 | |
| 35 | |
| 36 | cd ${ASFVOLT16_RSD_DIR} |
| 37 | #Remove exisiting IntelRSD Source Code and download from google drive |
| 38 | rm -rf rsd_org rsd_org.tar.gz |
| 39 | wget -O rsd_org.tar.gz 'https://drive.google.com/uc?export=download&id=1vIbd_yGVyuLaWK0nUwm6H3xy1XLDDkR8' |
| 40 | tar -xf rsd_org.tar.gz |
| 41 | cd rsd_org |
| 42 | |
| 43 | #Download accton patch from google drive and apply to IntelRSD |
| 44 | echo "Downloading and Applying accton.patch" |
| 45 | wget -O ${ASFVOLT16_RSD_DIR}/accton.patch 'https://drive.google.com/uc?export=download&id=191UUhYbqnDTuwrSl2S9P8D7fNoMQw1YE' |
| 46 | patch -p1 < ${ASFVOLT16_RSD_DIR}/accton.patch |
| 47 | |
| 48 | #Apply Calsoft patch |
| 49 | echo "Applying calsoft.patch" |
| 50 | patch -p1 < ${ASFVOLT16_RSD_DIR}/calsoft.patch |
| 51 | |
| 52 | #Install cmake version to 3.5.2 required for IntelRSD build |
| 53 | CMAKE_VER=`cmake -version | grep "cmake version" | awk '{print $3}'` |
| 54 | if [ "${CMAKE_VER}" != "3.5.2" ]; then |
| 55 | sudo apt-get purge cmake |
| 56 | wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz |
| 57 | tar xzvf cmake-3.5.2.tar.gz |
| 58 | cd cmake-3.5.2/ |
| 59 | ./bootstrap |
| 60 | make -j4 |
| 61 | sudo make install |
| 62 | if [ -e /usr/bin/cmake ]; then |
| 63 | sudo rm /usr/bin/cmake |
| 64 | fi |
| 65 | sudo ln -s /usr/local/bin/cmake /usr/bin/cmake |
| 66 | fi |
| 67 | |
| 68 | echo "Cmake Version ${CMAKE_VER} installed" |
| 69 | |
| 70 | #Download 3rd party code required for PSME |
| 71 | cd ${PSM_DEPDIR} |
| 72 | wget https://github.com/open-source-parsers/jsoncpp/archive/1.7.2.zip |
| 73 | mv 1.7.2.zip jsoncpp-1.7.2.zip |
| 74 | |
| 75 | wget https://github.com/cinemast/libjson-rpc-cpp/archive/v0.6.0.zip |
| 76 | mv v0.6.0.zip jsonrpccpp-0.6.0.zip |
| 77 | |
| 78 | wget http://downloads.sourceforge.net/project/ipmitool/ipmitool/1.8.17/ipmitool-1.8.17.tar.bz2 |
| 79 | |
| 80 | wget https://github.com/01org/safestringlib/archive/master.zip |
| 81 | mv master.zip safestring-0.0.1.zip |
| 82 | |
| 83 | wget https://github.com/google/googletest/archive/release-1.7.0.zip |
| 84 | mv release-1.7.0.zip gtest-1.7.0.zip |
| 85 | |
| 86 | wget https://github.com/google/googlemock/archive/release-1.7.0.zip |
| 87 | mv release-1.7.0.zip gmock-1.7.0.zip |
| 88 | |
| 89 | cd - |
| 90 | |
| 91 | cd ${RMM_UUID} |
| 92 | wget http://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz |
| 93 | |
| 94 | cd ${RMM_CURL} |
| 95 | wget https://curl.haxx.se/download/curl-7.40.0.tar.bz2 |
| 96 | |
| 97 | cd ${RMM_OSSL} |
| 98 | wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz |
| 99 | |
| 100 | cd ${RSD_TOPDIR} |
| 101 | |
| 102 | #Build PSME |
| 103 | echo "" |
| 104 | echo "Building PSME" |
| 105 | echo "" |
| 106 | chmod 777 ${PSM_TOPDIR}/agent/network/acc_sw/psme.sh |
| 107 | chmod 777 ${RMM_TOPDIR}/utils/deb_maker/install/multi-deb/rmm-all/etc/init.d/psme |
| 108 | cd ${PSM_TOPDIR} |
| 109 | if [ ! -d "build" ]; then |
| 110 | mkdir build |
| 111 | fi |
| 112 | cd build; cmake ../ |
| 113 | grep -rl Werror . | grep flags.make | xargs sed -i 's/-Werror//g' |
| 114 | make psme-rest-server psme-chassis -j8 |
| 115 | |
| 116 | |
| 117 | #Create Debian Packages |
| 118 | echo "" |
| 119 | echo "Creating Debian Package" |
| 120 | echo "" |
| 121 | cd ${RMM_TOPDIR}/utils |
| 122 | ./rmm_release.sh <<! |
| 123 | A |
| 124 | ! |
| 125 | |
| 126 | #Copying generated packages to $BIN_DIRECTORY |
| 127 | echo "PSME debian packages are created in ${RMM_TOPDIR}/build/install/multi-deb/bin/rmm-bin-2.1.3.38.0/" |
| 128 | echo "Copying Debian packages to ${PKG_TOPDIR}" |
| 129 | if [ ! -d ${PKG_TOPDIR} ]; then |
| 130 | mkdir ${PKG_TOPDIR} |
| 131 | fi |
| 132 | |
| 133 | `cp -a ${RMM_TOPDIR}/build/install/multi-deb/bin/rmm-bin-2.1.3.38.0/* ${PKG_TOPDIR}` |
| 134 | `cp ${ASFVOLT16_RSD_DIR}/remove.sh ${PKG_TOPDIR}` |
| 135 | echo "" |
| 136 | echo "ASFVOLT16 Redfish service build finished !!!" |
| 137 | echo "Packages are available in ${PKG_TOPDIR}" |
| 138 | |
| 139 | cd ${ONL_DIR} |
| 140 | |