diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2014-11-30 02:15:14 +0100 |
---|---|---|
committer | Anders Roxell <anders.roxell@linaro.org> | 2015-01-03 02:06:51 +0100 |
commit | c5523da4eaf0dcad0994d1be5b7185bbc24dc2df (patch) | |
tree | baa5c27edd968b9cc431cbbcfe21587d03811b0e | |
parent | 638309ad1092c2dc18b823a98602286a4cd3677d (diff) |
working refactoring for dpdk, netmap and keystone2
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rwxr-xr-x | build-dpdk.sh | 31 | ||||
-rwxr-xr-x | build-ks2.sh | 32 | ||||
-rwxr-xr-x | build-netmap.sh | 31 | ||||
-rwxr-xr-x | build.sh | 49 | ||||
-rw-r--r-- | helper/coverity | 17 | ||||
-rw-r--r-- | helper/dpdk | 17 | ||||
-rw-r--r-- | helper/generic | 23 | ||||
-rw-r--r-- | helper/keystone2 | 70 | ||||
-rw-r--r-- | helper/ks2 | 75 | ||||
-rw-r--r-- | helper/netmap | 12 |
10 files changed, 168 insertions, 189 deletions
diff --git a/build-dpdk.sh b/build-dpdk.sh index 3dbe849..153d77b 100755 --- a/build-dpdk.sh +++ b/build-dpdk.sh @@ -1,37 +1,12 @@ #!/bin/bash set -e +export PLATFORM=${PLATFORM:-linux-dpdk} export ROOT_DIR=$(readlink -f $(dirname $0)) -export CLEANUP="${CLEANUP:-1}" -export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp-dpdk.git}" -source ${ROOT_DIR}/helper/dpdk - -usage() { - ./build.sh -h - dpdk_usage -} - -if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then - usage - exit 0 -fi - -trap cleanup_exit INT TERM EXIT - -cleanup_exit() -{ - if [[ ${CLEANUP} -eq 1 ]]; then - dpdk_cleanup - fi -} - -prepare_dpdk - -cd $ROOT_DIR #common ODP build script -./build.sh +${ROOT_DIR}/build.sh [[ $? -eq 1 ]] && exit 1 -cd - + ## vim: set sw=4 sts=4 et foldmethod=syntax : ## diff --git a/build-ks2.sh b/build-ks2.sh index bf6a7d8..9e9b68d 100755 --- a/build-ks2.sh +++ b/build-ks2.sh @@ -1,37 +1,11 @@ #!/bin/bash set -e +export PLATFORM=${PLATFORM:-linux-keystone2} export ROOT_DIR=$(readlink -f $(dirname $0)) -source ${ROOT_DIR}/helper/ks2 - -export CLEANUP="${CLEANUP:-1}" -export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp-keystone2.git}" - -usage() { - ./build.sh -h - ks2_usage -} - -if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then - usage - exit 0 -fi - -trap cleanup_exit INT TERM EXIT - -cleanup_exit() -{ - if [[ ${CLEANUP} -eq 1 ]]; then - ks2_cleanup - fi -} - -prepare_ks2_build - -cd ${ROOT_DIR} -./build.sh +${ROOT_DIR}/build.sh "$@" [[ $? -eq 1 ]] && exit 1 -cd - + ## vim: set sw=4 sts=4 et foldmethod=syntax : ## diff --git a/build-netmap.sh b/build-netmap.sh index 27e90bf..c33558f 100755 --- a/build-netmap.sh +++ b/build-netmap.sh @@ -1,36 +1,11 @@ #!/bin/bash set -e +export PLATFORM=${PLATFORM:-linux-netmap} export ROOT_DIR=$(readlink -f $(dirname $0)) -source ${ROOT_DIR}/helper/netmap +${ROOT_DIR}/build.sh -export CLEANUP="${CLEANUP:-1}" -export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp-netmap.git}" - -usage() { - ./build.sh -h - netmap_usage -} - -if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then - usage - exit 0 -fi - -trap cleanup_exit INT TERM EXIT - -cleanup_exit() -{ - if [[ ${CLEANUP} -eq 1 ]]; then - netmap_cleanup - fi -} - -prepare_netmap - -#common ODP build script -cd ${ROOT_DIR} -./build.sh +[[ $? -eq 1 ]] && exit 1 ## vim: set sw=4 sts=4 et foldmethod=syntax : ## @@ -14,9 +14,7 @@ source ${ROOT_DIR}/helper/coverity # EXTRA_FLAGS need to be exported #Environment vars that affect the build -export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp.git}" export GIT_BRANCH="${GIT_BRANCH:-master}" -export COV_DIR="${COV_DIR:-""}" export CLEANUP="${CLEANUP:-1}" export GCOV="${GCOV:-0}" export BUILD_OPENSSL=${BUILD_OPENSSL:-0} @@ -29,6 +27,17 @@ GPLATFORM="--with-platform=${PLATFORM}" GLOBAL_DSTDIRPATH="$ROOT_DIR/new-build" DSTDIR="--prefix=${GLOBAL_DSTDIRPATH}" +prepare_platform() { + export PLATFORM_SHORT=${PLATFORM##*-} + if [[ -f helper/${PLATFORM_SHORT} ]]; then + source helper/${PLATFORM_SHORT} + ${PLATFORM_SHORT}_prepare + else + echo "We don't support ${PLATFORM_SHORT}" + exit 1 + fi +} + usage() { echo -e "\tARCH:\t\t which arch to build (arm, armeb, arm64, arm64be), default: not set" echo -e "\tGIT_ODP:\t which ODP git repo to use, default: ${GIT_ODP}" @@ -41,13 +50,9 @@ usage() { echo -e "\tBUILD_OPENSSL:\t build custom openssl, default: ${BUILD_OPENSSL}" echo -e "\tNUM_CPUS:\t add parallel make, default: _NPROCESSORS_ONLN" echo -e "\tCLEANUP:\t to save workspace set CLEANUP=0, default: ${CLEANUP}" + ${PLATFORM_SHORT}_usage } -if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then - usage - exit 0 -fi - trap cleanup_exit INT TERM EXIT cleanup_exit() @@ -63,16 +68,36 @@ cleanup_exit() tc_cleanup openssl_cleanup coverity_cleanup + ${PLATFORM_SHORT}_cleanup fi } +###### +# Main execution + +prepare_platform + +if [[ "x$1" = "x-h" || "x$1" = "x--help" ]]; then + usage + exit 0 +fi + +echo "Preparing platform" +${PLATFORM_SHORT}_get + +echo "Preparing toolchain" toolchain_prepare +echo "Building platform" +${PLATFORM_SHORT}_build + +echo "Building OpenSSL" build_openssl + +echo "Building CUnit" build_cunit -echo "pulling from $GIT_ODP" -echo "branch $GIT_BRANCH" +echo "Pulling from ${GIT_ODP}, branch ${GIT_BRANCH}" git clone --depth 1 -b ${GIT_BRANCH} ${GIT_ODP} ${ODP_DIR} # Run cross compile coverty @@ -82,9 +107,9 @@ pushd ${ODP_DIR} ./bootstrap ./configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} -if [ "$COV_DIR" != "" ]; then +if [[ -n ${COV_DIR} ]]; then coverity_build -elif [ "$GCOV" == "1" ]; then +elif [[ ${GCOV} -eq 1 ]]; then make check CFLAGS="-fprofile-arcs -ftest-coverage" lcov -c -d ${ROOT_DIR}/odp/platform/${PLATFORM} --output-file ${ROOT_DIR}/${PLATFORM}-coverage.info genhtml ${ROOT_DIR}/${PLATFORM}-coverage.info --output-directory ${ROOT_DIR}/${PLATFORM}-gcov-html @@ -98,9 +123,11 @@ else ../configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} make -j ${NUM_CPUS} make install + ret_val=$? popd fi popd +exit $ret_val ## vim: set sw=4 sts=4 et foldmethod=syntax : ## diff --git a/helper/coverity b/helper/coverity index fe4ea12..416c948 100644 --- a/helper/coverity +++ b/helper/coverity @@ -5,8 +5,11 @@ coverity_usage() { } coverity_prepare() { - PATH="$COV_DIR:$PATH" + export COV_DIR="${COV_DIR:-""}" + if [[ -n ${COV_DIR} && -n ${ARCH} ]]; then + PATH="$COV_DIR:$PATH" + pushd ${ROOT_DIR} cov-configure --comptype gcc --compiler ${tcbindir}/${compiler_prefix}-gcc popd @@ -14,10 +17,14 @@ coverity_prepare() { } coverity_build() { - cov-build --dir ${ROOT_DIR}/cov-int make - pushd ${ROOT_DIR} - tar -czvf ${ROOT_DIR}/${PLATFORM}-cov-int.tgz ./cov-int - popd + if [[ -n ${COV_DIR} ]]; then + PATH="${COV_DIR}:${PATH}" + + cov-build --dir ${ROOT_DIR}/cov-int make + pushd ${ROOT_DIR} + tar -czvf ${ROOT_DIR}/${PLATFORM}-cov-int.tgz ./cov-int + popd + fi } coverity_cleanup() { diff --git a/helper/dpdk b/helper/dpdk index 7555594..ea9b849 100644 --- a/helper/dpdk +++ b/helper/dpdk @@ -9,11 +9,13 @@ dpdk_usage(){ echo -e "\tGIT_DPDK:\t which DPDK git repo to use" } -dpdk_cleanup(){ - rm -rf $ROOT_DIR_DPDK +dpdk_prepare(){ + export DPDK_DIR=$ROOT_DIR_DPDK/dpdk/build + export EXTRA_FLAGS="${EXTRA_FLAGS} --with-sdk-install-path=${ROOT_DIR_DPDK}/dpdk/x86_64-default-linuxapp-gcc" + export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp-dpdk.git}" } -get_dpdk(){ +dpdk_get(){ mkdir $ROOT_DIR_DPDK cd $ROOT_DIR_DPDK @@ -37,16 +39,15 @@ get_dpdk(){ else echo "No need to patch" fi +} +dpdk_build() { #build DPDK so that ODP can see the incudes and get the lib to link to make -j ${NUM_CPUS} install T=x86_64-default-linuxapp-gcc CONFIG_RTE_BUILD_COMBINE_LIBS=y EXTRA_CFLAGS="-fPIC" } -prepare_dpdk(){ - get_dpdk - export DPDK_DIR=$ROOT_DIR_DPDK/dpdk/build - export PLATFORM=linux-dpdk - export EXTRA_FLAGS="${EXTRA_FLAGS} --with-sdk-install-path=${ROOT_DIR_DPDK}/dpdk/x86_64-default-linuxapp-gcc" +dpdk_cleanup(){ + rm -rf $ROOT_DIR_DPDK } ## vim: set ft=sh sw=4 sts=4 et foldmethod=syntax : ## diff --git a/helper/generic b/helper/generic new file mode 100644 index 0000000..191e709 --- /dev/null +++ b/helper/generic @@ -0,0 +1,23 @@ +[ -n "$GENERIC_HELPER" ] && return || readonly GENERIC_HELPER=1 + +generic_usage() { + : +} + +generic_prepare() { + export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp.git}" +} + +generic_get() { + : +} + +generic_build() { + : +} + +generic_cleanup() { + : +} + +## vim: set ft=sh sw=4 sts=4 et foldmethod=syntax : ## diff --git a/helper/keystone2 b/helper/keystone2 new file mode 100644 index 0000000..dfbf618 --- /dev/null +++ b/helper/keystone2 @@ -0,0 +1,70 @@ +[ -n "$KS2_HELPER" ] && return || readonly KS2_HELPER=1 + +KS2_MANIFEST_GIT=${KS2_MANIFEST_GIT:-git://git.linaro.org/people/taras.kondratiuk/ks2-odp-manifest.git} + +keystone2_usage(){ + echo -e "\tKS2_MANIFEST_GIT: which KS manifest git repo to use, default: ${KS2_MANIFEST_GIT}" +} + +keystone2_prepare(){ + export KS2_ROOT_DIR=${ROOT_DIR}/KS2 + export KS2_ROOT_DIR=$(readlink -f $KS2_ROOT_DIR) + export KDIR=$KS2_ROOT_DIR/lh/usr/src/linux-headers-3.10.34-linaro-keystone2 + export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp-keystone2.git}" + + export ARCH=arm + + export EXTRA_FLAGS="${EXTRA_FLAGS} --with-sdk-install-path=${KS2_ROOT_DIR}/ks2_odp/build/sdk_sysroot --enable-static --disable-shared" + export CROSS_HOST="--host=${compiler_prefix}" +} + +keystone2_get_linux_headers() { + L_HEADERS=${KS2_ROOT_DIR}/lh + #get TI kernel pre built + mkdir -p ${L_HEADERS} + pushd ${L_HEADERS} + S_L_O="http://snapshots.linaro.org/kernel-hwpack/linux-lng-keystone2/latest" + TO_DOWNLOAD=$(curl -sS ${S_L_O} | grep "linux-headers.*armhf\.deb" | head -n1 | sed -e 's|.*/||;s|\.deb.*|.deb|') + curl -sSO ${S_L_O}/${TO_DOWNLOAD} + ar vx ${TO_DOWNLOAD} + tar -xzf data.tar.gz + popd +} + +keystone2_get_scripts(){ + if [ ! -f ${ROOT_DIR}/bin/repo ]; then + # Get latest repo script and install it in PATH + test -d ${ROOT_DIR}/bin || mkdir -p ${ROOT_DIR}/bin + wget -q --no-check-certificate "http://android.git.linaro.org/gitweb?p=tools/repo.git;a=blob_plain;f=repo;hb=refs/heads/stable" -O ${ROOT_DIR}/bin/repo + chmod a+x ${ROOT_DIR}/bin/repo + fi +} + +keystone2_get(){ + keystone2_get_linux_headers + keystone2_get_scripts + + #build TI msdk + [[ -d ${KS2_ROOT_DIR}/ks2_odp ]] && ls -R ${KS2_ROOT_DIR}/ks2_odp + mkdir -p ${KS2_ROOT_DIR}/ks2_odp + pushd ${KS2_ROOT_DIR}/ks2_odp + ${ROOT_DIR}/bin/repo init -u ${KS2_MANIFEST_GIT} + ${ROOT_DIR}/bin/repo sync + popd +} + +keystone2_build() { + keystone2_get + + pushd ${KS2_ROOT_DIR}/ks2_odp + # KDIR is used under the hood here. + make -C build sdk_install + #make -C build rmserver_install + popd +} + +keystone2_cleanup(){ + rm -rf ${KS2_ROOT_DIR} +} + +## vim: set ft=sh sw=4 sts=4 et foldmethod=syntax : ## diff --git a/helper/ks2 b/helper/ks2 deleted file mode 100644 index a2e90d6..0000000 --- a/helper/ks2 +++ /dev/null @@ -1,75 +0,0 @@ -[ -n "$KS2_HELPER" ] && return || readonly KS2_HELPER=1 - -source ${ROOT_DIR}/helper/toolchain -source ${ROOT_DIR}/helper/openssl -source ${ROOT_DIR}/helper/cunit -source ${ROOT_DIR}/helper/coverity - -export ROOT_DIR_KS=${ROOT_DIR}/KS2 -export ROOT_DIR_KS=$(readlink -f $ROOT_DIR_KS) -export KDIR=$ROOT_DIR_KS/lh/usr/src/linux-headers-3.10.34-linaro-keystone2 -L_HEADERS=${ROOT_DIR_KS}/lh -GIT_KS_MANIFEST=${GIT_KS_MANIFEST:-git://git.linaro.org/people/taras.kondratiuk/ks2-odp-manifest.git} - -ks2_cleanup(){ - rm -rf ${ROOT_DIR_KS} -} - -ks2_usage(){ - echo -e "\tGIT_KS_MANIFEST: which KS manifest git repo to use" -} - -get_ks2_linux_headers() { - #get TI kernel pre built - mkdir -p ${L_HEADERS} - cd ${L_HEADERS} - S_L_O="http://snapshots.linaro.org/kernel-hwpack/linux-lng-keystone2/latest" - TO_DOWNLOAD=$(curl -sS ${S_L_O} | grep "linux-headers.*armhf\.deb" | head -n1 | sed -e 's|.*/||;s|\.deb.*|.deb|') - curl -sSO ${S_L_O}/${TO_DOWNLOAD} - ar vx ${TO_DOWNLOAD} - tar -xzf data.tar.gz - cd - -} - -get_repo(){ - if [ ! -f ${ROOT_DIR}/bin/repo ]; then - # Get latest repo script and install it in PATH - test -d ${ROOT_DIR}/bin || mkdir -p ${ROOT_DIR}/bin - wget -q --no-check-certificate "http://android.git.linaro.org/gitweb?p=tools/repo.git;a=blob_plain;f=repo;hb=refs/heads/stable" -O ${ROOT_DIR}/bin/repo - chmod a+x ${ROOT_DIR}/bin/repo - fi - PATH="${ROOT_DIR}/bin:$PATH" -} - -get_ti_msdk(){ - #build TI msdk - mkdir ${ROOT_DIR_KS}/ks2_odp - cd ${ROOT_DIR_KS}/ks2_odp - repo init -u ${GIT_KS_MANIFEST} - repo sync - make -j ${NUM_CPUS} -C build sdk_install - #make -C build rmserver_install - cd ${ROOT_DIR} -} - -prepare_ks2_build(){ - find_toolchain_to_download - install_custom_toolchain - setup_compiler_prefix - get_ks2_linux_headers - get_repo - - get_ti_msdk - build_openssl - build_cunit - - if [ "$COV_DIR" != "" ]; then - get_coverity - fi - - export PLATFORM=linux-keystone2 - export EXTRA_FLAGS="${EXTRA_FLAGS} --with-sdk-install-path=${ROOT_DIR_KS}/ks2_odp/build/sdk_sysroot --enable-static --disable-shared" - export CROSS_HOST="--host=${compiler_prefix}" -} - -## vim: set ft=sh sw=4 sts=4 et foldmethod=syntax : ## diff --git a/helper/netmap b/helper/netmap index fa4fd1c..4f877b5 100644 --- a/helper/netmap +++ b/helper/netmap @@ -2,7 +2,7 @@ export NETMAP_SRCDIR=$ROOT_DIR/netmap -get_netmap(){ +netmap_get(){ GIT_NETMAP=${GIT_NETMAP:-https://code.google.com/p/netmap} NETMAP_REV=${NETMAP_REV:-ca3cb7d9a4fe6b08d1b63be7ea0c77c815821eb2} @@ -12,13 +12,15 @@ get_netmap(){ popd } -prepare_netmap(){ - get_netmap - +netmap_prepare(){ #configure the build for ODP export NETMAP_DIR=${NETMAP_SRCDIR} - export PLATFORM=linux-netmap export EXTRA_FLAGS="${EXTRA_FLAGS} --with-sdk-install-path=${NETMAP_DIR}" + export GIT_ODP="${GIT_ODP:-git://git.linaro.org/lng/odp-netmap.git}" +} + +netmap_build() { + : } netmap_cleanup() |