Last active
November 1, 2016 11:53
-
-
Save aarani/5ca8e64cd212fa5167c6f0d457cfcc80 to your computer and use it in GitHub Desktop.
Binary Patcher for k3gxx Camera blobs :P
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURRENT_DIR=$(dirname $(readlink -f $0)) | |
CM_BASE_DIR=$CURRENT_DIR/../../../.. | |
# replace_all <old> <new> <file> | |
# binary string replacement | |
function replace_all { | |
echo "Patching: $(basename $3)" | |
perl -pi -e "s/$1/$2/g" $3 | |
} | |
for device in k3gxx; do | |
VENDOR_DIR=${CM_BASE_DIR}/vendor/samsung/${device}/proprietary | |
echo "Applying patches for device: ${device}" | |
if [ ! -d "${VENDOR_DIR}" ]; then | |
echo "Device sources missing, skipped" | |
continue | |
fi | |
# LP camera hal has a reference to libion.so, although it is not using it. | |
# libexynoscamera.so wants to use ion_alloc()/... of libion_exynos.so but as | |
# libion.so (with the functions of the same name) is already referenced, | |
# the functions of libion.so are erroneously used instead of the libion_exynos.so ones. | |
# This causes crashes whenever the camera is used (in ion_alloc). | |
# Solution: replace libion.so with liblog.so which is already referenced by the lib (-> no-op) | |
replace_all 'libion.so' 'liblog.so' ${VENDOR_DIR}/lib/hw/camera.universal5422.so | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment