Skip to content

Instantly share code, notes, and snippets.

@minhng99
Last active May 10, 2022 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minhng99/2c21663297fb9857ac4ec706993d999e to your computer and use it in GitHub Desktop.
Save minhng99/2c21663297fb9857ac4ec706993d999e to your computer and use it in GitHub Desktop.
Make vendor tree from dumped /system (without adb) with proprietary-files.txt
#!/bin/sh
SYSTEMDIR=/system
VENDOR=samsung
DEVICE=js01lte
OUTDIR=vendor/$VENDOR/$DEVICE
mkdir -p $OUTDIR/proprietary
(cat << EOF) > $OUTDIR/$DEVICE-vendor-blobs.mk
# Copyright (C) 2011 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.
# Prebuilt libraries that are needed to build open-source libraries
#PRODUCT_COPY_FILES := \\
# \$(LOCAL_PATH)/proprietary/lib/libcamera.so:obj/lib/libcamera.so \\
# \$(LOCAL_PATH)/proprietary/lib/libaudio.so:obj/lib/libaudio.so \\
# \$(LOCAL_PATH)/proprietary/lib/libaudiopolicy.so:obj/lib/libaudiopolicy.so \\
# \$(LOCAL_PATH)/proprietary/lib/libseccameraadaptor.so:obj/lib/libseccameraadaptor.so
PRODUCT_COPY_FILES += \\
EOF
LINEEND=" \\"
COUNT=`wc -l proprietary-files.txt | awk {'print $1'}`
for FILE in `cat proprietary-files.txt`; do
COUNT=`expr $COUNT - 1`
if [ $COUNT = "0" ]; then
LINEEND=""
fi
if [ -f $SYSTEMDIR/$FILE ]; then
if [ ! -d $(dirname $OUTDIR/proprietary/$FILE) ]; then
mkdir -p $(dirname $OUTDIR/proprietary/$FILE)
fi
cp $SYSTEMDIR/$FILE $OUTDIR/proprietary/$FILE
echo " \$(LOCAL_PATH)/proprietary/$FILE:system/$FILE$LINEEND" >> $OUTDIR/$DEVICE-vendor-blobs.mk
else
echo "File not exist: system/$FILE"
fi
done
(cat << EOF) > $OUTDIR/$DEVICE-vendor.mk
# Copyright (C) 2011 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.
# Pick up overlay for features that depend on non-open-source files
DEVICE_PACKAGE_OVERLAYS := \$(LOCAL_PATH)/overlay
\$(call inherit-product, \$(LOCAL_PATH)/$DEVICE-vendor-blobs.mk)
EOF
(cat << EOF) > $OUTDIR/BoardConfigVendor.mk
# Copyright (C) 2011 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.
USE_CAMERA_STUB := false
EOF
@sunmughan
Copy link

Why it says file not exist ???
Uploading Screenshot_20220511-002715_Termux.png…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment