aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-08-05 18:39:04 +0200
committerdesaishivam26 <shivamdesaixda@gmail.com>2016-08-20 17:18:59 +0530
commit91d034dcbfb83e451ead97034c6049f03a05b761 (patch)
tree485378c4608d0d7d08546298e2be7509083ea723
parenta81b91037eb6f781b0f091887f6a4c80fd8c5ab6 (diff)
msm8226-common: Update how we generate our blob lists
* Use the new generic extract utils in vendor/cm! Change-Id: I2ee9b98142f77f061f57495610b327dba0c1c11f
-rwxr-xr-xextract-files.sh119
-rwxr-xr-xsetup-makefiles.sh264
2 files changed, 98 insertions, 285 deletions
diff --git a/extract-files.sh b/extract-files.sh
index 802c196..f34eace 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -1,58 +1,77 @@
#!/bin/bash
+#
+# Copyright (C) 2016 The CyanogenMod 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.
+#
-function extract() {
- for FILE in `egrep -v '(^#|^$)' $1`; do
- OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
- FILE=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"`
- DEST=${PARSING_ARRAY[1]}
- if [ -z $DEST ]; then
- DEST=$FILE
- fi
- DIR=`dirname $FILE`
- if [ ! -d $2/$DIR ]; then
- mkdir -p $2/$DIR
- fi
- if [ "$SRC" = "adb" ]; then
- # Try CM target first
- adb pull /system/$DEST $2/$DEST
- # if file does not exist try OEM target
- if [ "$?" != "0" ]; then
- adb pull /system/$FILE $2/$DEST
- fi
- else
- cp $SRC/system/$FILE $2/$DEST
- # if file dot not exist try destination
- if [ "$?" != "0" ]
- then
- cp $SRC/system/$DEST $2/$DEST
- fi
- fi
- done
-}
-
-if [ $# -eq 0 ]; then
- SRC=adb
-else
- if [ $# -eq 1 ]; then
- SRC=$1
- else
- echo "$0: bad number of arguments"
- echo ""
- echo "usage: $0 [PATH_TO_EXPANDED_ROM]"
- echo ""
- echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from"
- echo "the device using adb pull."
+set -e
+
+# Load extractutils and do some sanity checks
+MY_DIR="${BASH_SOURCE%/*}"
+if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
+
+CM_ROOT="$MY_DIR"/../../..
+
+HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
+if [ ! -f "$HELPER" ]; then
+ echo "Unable to find helper script at $HELPER"
exit 1
- fi
fi
+. "$HELPER"
-BASE=../../../vendor/$VENDOR/msm8226-common/proprietary
-rm -rf $BASE/*
+while getopts ":nhsd:" options
+do
+ case $options in
+ n ) CLEANUP="false" ;;
+ d ) SRC=$OPTARG ;;
+ s ) SETUP=1 ;;
+ h ) echo "Usage: `basename $0` [OPTIONS] "
+ echo " -n No cleanup"
+ echo " -d Fetch blob from filesystem"
+ echo " -s Setup only, no extraction"
+ echo " -h Show this help"
+ exit ;;
+ * ) ;;
+ esac
+done
-DEVBASE=../../../vendor/$VENDOR/$DEVICE/proprietary
-rm -rf $DEVBASE/*
+if [ -z $SRC ]; then
+ SRC=adb
+fi
-extract ../../$VENDOR/msm8226-common/proprietary-files.txt $BASE
-extract ../../$VENDOR/$DEVICE/proprietary-files.txt $DEVBASE
+if [ -n "$SETUP" ]; then
+ # Initialize the helper for common
+ setup_vendor "$DEVICE_COMMON" "$VENDOR" "$CM_ROOT" true false
+ "$MY_DIR"/setup-makefiles.sh false
-./setup-makefiles.sh
+ if [ -s "$MY_DIR"/../$DEVICE/proprietary-files.txt ]; then
+ # Initalize the helper for device
+ setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" false false
+ "$MY_DIR"/setup-makefiles.sh false
+ fi
+else
+ # Initialize the helper for common
+ setup_vendor "$DEVICE_COMMON" "$VENDOR" "$CM_ROOT" true "$CLEANUP"
+
+ extract "$MY_DIR"/proprietary-files.txt "$SRC"
+
+ if [ -s "$MY_DIR"/../$DEVICE/proprietary-files.txt ]; then
+ # Reinitialize the helper for device
+ setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" false "$CLEANUP"
+
+ extract "$MY_DIR"/../$DEVICE/proprietary-files.txt "$SRC"
+ fi
+
+ "$MY_DIR"/setup-makefiles.sh "$CLEANUP"
+fi
diff --git a/setup-makefiles.sh b/setup-makefiles.sh
index 73caee2..be9a8ef 100755
--- a/setup-makefiles.sh
+++ b/setup-makefiles.sh
@@ -1,136 +1,5 @@
#!/bin/bash
-
-OUTDIR=vendor/$VENDOR/$DEVICE
-MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
-
-(cat << EOF) > $MAKEFILE
-# Copyright (C) 2016 The CyanogenMod 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.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-
-PRODUCT_COPY_FILES += \\
-EOF
-
-LINEEND=" \\"
-COUNT=`wc -l proprietary-files.txt | awk {'print $1'}`
-DISM=`egrep -c '(^#|^$)' proprietary-files.txt`
-COUNT=`expr $COUNT - $DISM`
-for FILE in `egrep -v '(^#|^$)' proprietary-files.txt`; do
- COUNT=`expr $COUNT - 1`
- if [ $COUNT = "0" ]; then
- LINEEND=""
- fi
- # Split the file from the destination (format is "file[:destination]")
- OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
- if [[ ! "$FILE" =~ ^-.* ]]; then
- FILE=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"`
- DEST=${PARSING_ARRAY[1]}
- if [ -n "$DEST" ]; then
- FILE=$DEST
- fi
- echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
- fi
-done
-
-(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
-# Copyright (C) 2016 The CyanogenMod 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.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-
-# Pick up overlay for features that depend on non-open-source files
-
-\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk)
-EOF
-
-(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk
-# Copyright (C) 2016 The CyanogenMod 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.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-EOF
-
-export DEVICE=msm8226-common
-
-OUTDIR=vendor/$VENDOR/$DEVICE
-MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
-
-(cat << EOF) > $MAKEFILE
-# Copyright (C) 2016 The CyanogenMod 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.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-
-PRODUCT_COPY_FILES += \\
-EOF
-
-LINEEND=" \\"
-COUNT=`wc -l ../msm8226-common/proprietary-files.txt | awk {'print $1'}`
-DISM=`egrep -c '(^#|^$)' ../msm8226-common/proprietary-files.txt`
-COUNT=`expr $COUNT - $DISM`
-for FILE in `egrep -v '(^#|^$)' ../msm8226-common/proprietary-files.txt`; do
- COUNT=`expr $COUNT - 1`
- if [ $COUNT = "0" ]; then
- LINEEND=""
- fi
- # Split the file from the destination (format is "file[:destination]")
- OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
- if [[ ! "$FILE" =~ ^-.* ]]; then
- FILE=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"`
- DEST=${PARSING_ARRAY[1]}
- if [ -n "$DEST" ]; then
- FILE=$DEST
- fi
- echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
- fi
-done
-
-(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
# Copyright (C) 2016 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -144,120 +13,45 @@ done
# 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.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-
-# Pick up overlay for features that depend on non-open-source files
-PRODUCT_PACKAGES += \\
- com.qualcomm.location \\
- com.qualcomm.services.location \\
- TimeService \\
- qcrilmsgtunnel \\
- qcnvitems \\
- qcrilhook
-
-\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk)
-EOF
-
-(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk
-# Copyright (C) 2016 The CyanogenMod 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.
-
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
-EOF
-(cat << EOF) > ../../../$OUTDIR/Android.mk
-# Copyright (C) 2016 The CyanogenMod 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.
+set -e
-# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
+# Load extractutils and do some sanity checks
+MY_DIR="${BASH_SOURCE%/*}"
+if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
-LOCAL_PATH := \$(call my-dir)
+CM_ROOT="$MY_DIR"/../../..
-ifneq (\$(filter falcon peregrine thea titan,\$(TARGET_DEVICE)),)
+HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
+if [ ! -f "$HELPER" ]; then
+ echo "Unable to find helper script at $HELPER"
+ exit 1
+fi
+. "$HELPER"
-include \$(CLEAR_VARS)
-LOCAL_MODULE := com.qualcomm.location
-LOCAL_MODULE_OWNER := $VENDOR
-LOCAL_SRC_FILES := proprietary/app/\$(LOCAL_MODULE)/\$(LOCAL_MODULE).apk
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
-LOCAL_MODULE_CLASS := APPS
-LOCAL_CERTIFICATE := platform
-include \$(BUILD_PREBUILT)
+# Initialize the helper for common
+setup_vendor "$DEVICE_COMMON" "$VENDOR" "$CM_ROOT" "true" "$1"
-include \$(CLEAR_VARS)
-LOCAL_MODULE := com.qualcomm.services.location
-LOCAL_MODULE_OWNER := $VENDOR
-LOCAL_SRC_FILES := proprietary/app/\$(LOCAL_MODULE)/\$(LOCAL_MODULE).apk
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
-LOCAL_MODULE_CLASS := APPS
-LOCAL_CERTIFICATE := platform
-include \$(BUILD_PREBUILT)
+# Copyright headers and guards
+write_headers "falcon peregrine thea titan"
-include \$(CLEAR_VARS)
-LOCAL_MODULE := TimeService
-LOCAL_MODULE_OWNER := $VENDOR
-LOCAL_SRC_FILES := proprietary/app/\$(LOCAL_MODULE)/\$(LOCAL_MODULE).apk
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
-LOCAL_MODULE_CLASS := APPS
-LOCAL_CERTIFICATE := platform
-include \$(BUILD_PREBUILT)
+# The standard common blobs
+write_makefiles "$MY_DIR"/proprietary-files.txt
-include \$(CLEAR_VARS)
-LOCAL_MODULE := qcrilmsgtunnel
-LOCAL_MODULE_OWNER := $VENDOR
-LOCAL_SRC_FILES := proprietary/app/\$(LOCAL_MODULE)/\$(LOCAL_MODULE).apk
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
-LOCAL_MODULE_CLASS := APPS
-LOCAL_CERTIFICATE := platform
-include \$(BUILD_PREBUILT)
+# We are done!
+write_footers
-include \$(CLEAR_VARS)
-LOCAL_MODULE := qcnvitems
-LOCAL_MODULE_OWNER := $VENDOR
-LOCAL_SRC_FILES := proprietary/framework/qcnvitems.jar
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_SUFFIX := \$(COMMON_JAVA_PACKAGE_SUFFIX)
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_CERTIFICATE := PRESIGNED
-include \$(BUILD_PREBUILT)
+if [ -s "$MY_DIR"/../$DEVICE/proprietary-files.txt ]; then
+ # Reinitialize the helper for device
+ setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" "false" "$1"
-include \$(CLEAR_VARS)
-LOCAL_MODULE := qcrilhook
-LOCAL_MODULE_OWNER := $VENDOR
-LOCAL_SRC_FILES := proprietary/framework/qcrilhook.jar
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_SUFFIX := \$(COMMON_JAVA_PACKAGE_SUFFIX)
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_CERTIFICATE := PRESIGNED
-include \$(BUILD_PREBUILT)
+ # Copyright headers and guards
+ write_headers
-endif
+ # The standard device blobs
+ write_makefiles "$MY_DIR"/../$DEVICE/proprietary-files.txt
-EOF
+ # We are done!
+ write_footers
+fi