From 5800480aca29930ad19b9c875b016296b52c9c77 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 25 Feb 2020 10:56:04 -0800 Subject: Add support for floral path sytem_ext BUG: 149760649 TEST: generated vendor blobs on rvc-release Change-Id: Ie35edada9900ec120c7b24d36af7bd63aa3444fd --- generate-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-packages.sh b/generate-packages.sh index 7a853ad..ca5d53f 100755 --- a/generate-packages.sh +++ b/generate-packages.sh @@ -59,7 +59,7 @@ do do if test ${ZIP_TYPE} = target_files then - ONE_FILE=`echo $ONE_FILE | sed 's/system\//SYSTEM\//g'` + ONE_FILE=`echo $ONE_FILE | sed -e 's/system\//SYSTEM\//g' -e 's/system_ext\//SYSTEM_EXT\//g'` fi if [[ $ONE_FILE == */lib64/* ]] -- cgit v1.2.3 From 47704561dfd4c0e98679ee378acbfcc3237d6f71 Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Tue, 24 Mar 2020 19:31:42 +0800 Subject: Add script to generate Android.bp for AOSP blob The Android.bp checked in to the device/../self-extractors directory must be renamed to something like Android.bp.txt so that it don't pollute normal build environments. Bug: 152277096 Test: $ SYSTEM_EXT_SPECIFIC=true \ ./generate-android-bp.sh > Android.bp.txt Change-Id: I0f3abbfc6092ed61ddcef5971bbfebed4cbc1a91 --- generate-android-bp-for-blobs.sh | 122 +++++++++++++++++++++++++++++++++++++++ generate-packages.sh | 4 ++ 2 files changed, 126 insertions(+) create mode 100755 generate-android-bp-for-blobs.sh diff --git a/generate-android-bp-for-blobs.sh b/generate-android-bp-for-blobs.sh new file mode 100755 index 0000000..5708c7a --- /dev/null +++ b/generate-android-bp-for-blobs.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# Copyright 2020 The Android Open Source Project +# +# 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. +# +# Generate Android.bp for AOSP blob self-extractors. +# +# For example, a blob package may contain: +# ./vendor +# └── qcom +# └── coral +# └── proprietary +# ├── lib64 +# | ├── libfoo.so +# | └── libbar.so +# ├── libfoo.so +# └── libbar.so +# +# Generate prebuilt modules for these blobs: +# $ export SYSTEM_EXT_SPECIFIC=true # If installing prebuilts to system_ext/ partition +# $ ./generate-android-bp-for-blobs.sh ./vendor/qcom/coral/proprietary > Android.bp.txt +# $ mv Android.bp.txt ${ANDROID_BUILD_TOP}/device/google/coral/self-extractors/qcom/staging/ +# +# You may need to review the contents of Android.bp.txt as some of the blobs may +# have unsatisfied dependencies. Add `check_elf_files: false` to bypass this +# kind of build errors. + +set -e + +readonly PREBUILT_DIR="$1" + +readonly elf_files=$( + for file in $(find "$PREBUILT_DIR" -type f); do + if readelf -h "$file" 2>/dev/null 1>&2; then + basename "$file" + fi + done | sort | uniq | xargs +) + +echo "// Copyright (C) $(date +%Y) The Android Open Source Project" +echo "//" +echo "// Licensed under the Apache License, Version 2.0 (the \"License\");" +echo "// you may not use this file except in compliance with the License." +echo "// You may obtain a copy of the License at" +echo "//" +echo "// http://www.apache.org/licenses/LICENSE-2.0" +echo "//" +echo "// Unless required by applicable law or agreed to in writing, software" +echo "// distributed under the License is distributed on an \"AS IS\" BASIS," +echo "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." +echo "// See the License for the specific language governing permissions and" +echo "// limitations under the License." +echo "" +echo "soong_namespace {" +echo "}" + +for file in $elf_files; do + file32=$(find "$PREBUILT_DIR" -type f -name "$file" | grep -v 'lib64' | head) + file64=$(find "$PREBUILT_DIR" -type f -name "$file" | grep 'lib64' | head) + if [[ -n "$file32" ]] && [[ -n "$file64" ]]; then + multilib="both" + elif [[ -n "$file32" ]]; then + multilib="32" + else + multilib="64" + fi + +echo "" +echo "cc_prebuilt_library_shared {" +echo " name: \"${file%.so}\"," +echo " arch: {" + + if [[ -f "$file32" ]]; then + NEEDED=$(readelf -d "$file32" | sed -n -E 's/^.*\(NEEDED\).*\[(.+)\]$/\1/p' | xargs) +echo " arm: {" +echo " srcs: [\"$(realpath --relative-to="$PREBUILT_DIR" "$file32")\"]," + if [[ -n "$NEEDED" ]]; then +echo " shared_libs: [" + for entry in $NEEDED; do +echo " \"${entry%.so}\"," + done +echo " ]," + fi +echo " }," + fi + + if [[ -f "$file64" ]]; then + NEEDED=$(readelf -d "$file64" | sed -n -E 's/^.*\(NEEDED\).*\[(.+)\]$/\1/p' | xargs) +echo " arm64: {" +echo " srcs: [\"$(realpath --relative-to="$PREBUILT_DIR" "$file64")\"]," + if [[ -n "$NEEDED" ]]; then +echo " shared_libs: [" + for entry in $NEEDED; do +echo " \"${entry%.so}\"," + done +echo " ]," + fi +echo " }," + fi + +echo " }," +echo " compile_multilib: \"$multilib\"," + if [[ -n "$SYSTEM_EXT_SPECIFIC" ]]; then +echo " system_ext_specific: true," + fi +echo " strip: {" +echo " none: true," +echo " }," +echo "}" + +done diff --git a/generate-packages.sh b/generate-packages.sh index ca5d53f..dff6aeb 100755 --- a/generate-packages.sh +++ b/generate-packages.sh @@ -160,6 +160,10 @@ do mv ${MAKEFILEDIR}/Android.mk ${FILEDIR}/ fi + if [[ -e "${MAKEFILEDIR}/Android.bp.txt" ]]; then + mv "${MAKEFILEDIR}/Android.bp.txt" "${FILEDIR}/Android.bp" + fi + echo \ \ Generating self-extracting script SCRIPT=extract-$COMPANY-$DEVICE.sh cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script -- cgit v1.2.3 From be215f3e48f96b9edcc9e2c55f8ac3b015a4e3c9 Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Tue, 31 Mar 2020 14:54:47 +0800 Subject: generate-android-bp-for-blobs.sh: Add module owner Optionally specify owner so PRODUCT_RESTRICT_VENDOR_FILES don't break. Bug: 152277096 Test: None. Change-Id: Ifef8865745443b9c9f394a7ee560a9ea17439c46 --- generate-android-bp-for-blobs.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generate-android-bp-for-blobs.sh b/generate-android-bp-for-blobs.sh index 5708c7a..3d0660c 100755 --- a/generate-android-bp-for-blobs.sh +++ b/generate-android-bp-for-blobs.sh @@ -29,6 +29,7 @@ # # Generate prebuilt modules for these blobs: # $ export SYSTEM_EXT_SPECIFIC=true # If installing prebuilts to system_ext/ partition +# $ export OWNER=qcom # Owner is relevant if PRODUCT_RESTRICT_VENDOR_FILES is set # $ ./generate-android-bp-for-blobs.sh ./vendor/qcom/coral/proprietary > Android.bp.txt # $ mv Android.bp.txt ${ANDROID_BUILD_TOP}/device/google/coral/self-extractors/qcom/staging/ # @@ -114,6 +115,9 @@ echo " compile_multilib: \"$multilib\"," if [[ -n "$SYSTEM_EXT_SPECIFIC" ]]; then echo " system_ext_specific: true," fi + if [[ -n "$OWNER" ]]; then +echo " owner: \"${OWNER}\"," + fi echo " strip: {" echo " none: true," echo " }," -- cgit v1.2.3 From 8e956296565605e731d0e6191e01d4264105c5f6 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Thu, 9 Apr 2020 00:09:58 -0700 Subject: Add product partition file support TEST: build and flashed coral. Made phone call and text message. BUG: 152444305 Change-Id: I2e86176285b888a923cb44278767af9f16710635 --- generate-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-packages.sh b/generate-packages.sh index dff6aeb..adcf05c 100755 --- a/generate-packages.sh +++ b/generate-packages.sh @@ -59,7 +59,7 @@ do do if test ${ZIP_TYPE} = target_files then - ONE_FILE=`echo $ONE_FILE | sed -e 's/system\//SYSTEM\//g' -e 's/system_ext\//SYSTEM_EXT\//g'` + ONE_FILE=`echo $ONE_FILE | sed -e 's/system\//SYSTEM\//g' -e 's/system_ext\//SYSTEM_EXT\//g' -e 's/product\//PRODUCT\//g'` fi if [[ $ONE_FILE == */lib64/* ]] -- cgit v1.2.3 From 9feca325c68d4f50e9b5742b92569a628494c82f Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 8 Apr 2020 23:35:51 -0700 Subject: Add product partition file support This is needed for Sunfish too. TEST: build and flashed coral. Made phone call and text message. BUG: 145289377 BUG: 152444305 Merged-In: I201ac6c73a3658b38ae3790d9a90c9805f656ad5 Merged-In: I2e86176285b888a923cb44278767af9f16710635 Change-Id: I201ac6c73a3658b38ae3790d9a90c9805f656ad5 (cherry picked from commit 38ff933a4ea9dc8b8b96ad91b33c7851e220c693) --- generate-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-packages.sh b/generate-packages.sh index ce4964d..55d41f2 100755 --- a/generate-packages.sh +++ b/generate-packages.sh @@ -59,7 +59,7 @@ do do if test ${ZIP_TYPE} = target_files then - ONE_FILE=`echo $ONE_FILE | sed 's/system\//SYSTEM\//g'` + ONE_FILE=`echo $ONE_FILE | sed -e 's/system\//SYSTEM\//g' -e 's/product\//PRODUCT\//g'` fi if [[ $ONE_FILE == */lib64/* ]] -- cgit v1.2.3