From dff2bf9c5b568ca11f4f13e72f1ad8fa80e58738 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 25 May 2018 09:46:05 -0300 Subject: [PATCH] Make sure core packages are built with proper ABI information --- build/scripts/create_core_pkg.sh | 16 ++++++++++++++- tools/builder_common.sh | 35 +++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/build/scripts/create_core_pkg.sh b/build/scripts/create_core_pkg.sh index 786a9ea33e..b0f912999e 100755 --- a/build/scripts/create_core_pkg.sh +++ b/build/scripts/create_core_pkg.sh @@ -41,6 +41,8 @@ Options: -s search -- search path -F filter -- filter pattern to exclude files from plist -d destdir -- Destination directory to create package + -a ABI -- Package ABI + -A ALTABI -- Package ALTABI (aka arch) -h -- Show this help and exit Environment: @@ -51,7 +53,7 @@ END exit 1 } -while getopts s:t:f:v:r:F:d:h opt; do +while getopts s:t:f:v:r:F:d:ha:A: opt; do case "$opt" in t) template=$OPTARG @@ -74,6 +76,12 @@ while getopts s:t:f:v:r:F:d:h opt; do d) destdir=$OPTARG ;; + a) + ABI=$OPTARG + ;; + A) + ALTABI=$OPTARG + ;; *) usage ;; @@ -177,6 +185,12 @@ if [ -d "${template_licensedir}" ]; then done fi +# Force desired ABI and arch +[ -n "${ABI}" ] \ + && echo "abi: ${ABI}" >> ${manifest} +[ -n "${ALTABI}" ] \ + && echo "arch: ${ALTABI}" >> ${manifest} + run "Creating core package ${template_name}" \ "pkg create -o ${destdir} -p ${plist} -r ${root} -m ${metadir}" diff --git a/tools/builder_common.sh b/tools/builder_common.sh index 1e6c2f9d38..6baa87edc4 100644 --- a/tools/builder_common.sh +++ b/tools/builder_common.sh @@ -82,6 +82,13 @@ core_pkg_create() { local _template_path=${BUILDER_TOOLS}/templates/core_pkg/${_template} + # Use default pkg repo to obtain ABI and ALTABI + local _abi=$(sed -e "s/%%ARCH%%/${TARGET_ARCH}/g" \ + ${PKG_REPO_DEFAULT%%.conf}.abi) + local _altabi_arch=$(get_altabi_arch ${TARGET_ARCH}) + local _altabi=$(sed -e "s/%%ARCH%%/${_altabi_arch}/g" \ + ${PKG_REPO_DEFAULT%%.conf}.altabi) + ${BUILDER_SCRIPTS}/create_core_pkg.sh \ -t "${_template_path}" \ -f "${_flavor}" \ @@ -90,6 +97,8 @@ core_pkg_create() { -s "${_findroot}" \ -F "${_filter}" \ -d "${CORE_PKG_REAL_PATH}/All" \ + -a "${_abi}" \ + -A "${_altabi}" \ || print_error_pfS } @@ -970,6 +979,21 @@ create_memstick_adi_image() { echo ">>> MEMSTICKADI created: $(LC_ALL=C date)" | tee -a ${LOGFILE} } +get_altabi_arch() { + local _target_arch="$1" + + if [ "${_target_arch}" = "amd64" ]; then + echo "x86:64" + elif [ "${_target_arch}" = "i386" ]; then + echo "x86:32" + elif [ "${_target_arch}" = "armv6" ]; then + echo "32:el:eabi:hardfp" + else + echo ">>> ERROR: Invalid arch" + print_error_pfS + fi +} + # Create pkg conf on desired place with desired arch/branch setup_pkg_repo() { if [ -z "${4}" ]; then @@ -1014,16 +1038,7 @@ setup_pkg_repo() { ${_template} \ > ${_target} - if [ "${_target_arch}" = "amd64" ]; then - ALTABI_ARCH="x86:64" - elif [ "${_target_arch}" = "i386" ]; then - ALTABI_ARCH="x86:32" - elif [ "${_target_arch}" = "armv6" ]; then - ALTABI_ARCH="32:el:eabi:hardfp" - else - echo ">>> ERROR: Invalid arch" - print_error_pfS - fi + local ALTABI_ARCH=$(get_altabi_arch ${_target_arch}) ABI=$(cat ${_template%%.conf}.abi 2>/dev/null \ | sed -e "s/%%ARCH%%/${_target_arch}/g")