diff --git a/build.sh b/build.sh index 6ac7140..4a8cda5 100755 --- a/build.sh +++ b/build.sh @@ -2,5 +2,6 @@ rm "LogDisablerLite.zip" pushd src || exit 1 +mkdir -p ./system/lib64 zip -r "../LogDisablerLite.zip" ./* popd || exit 2 diff --git a/src/customize.sh b/src/customize.sh index ad7efd5..71c95cc 100755 --- a/src/customize.sh +++ b/src/customize.sh @@ -12,6 +12,12 @@ PATCHED_LIB="liblog_patched.so" # echo "$*" # } + +READELF="${MODPATH}/toybox-aarch64 readelf" +if ! chmod a+x "${MODPATH}/toybox-aarch64"; then + abort "Failed to chmod a+x ${MODPATH}/toybox-aarch64" +fi + # copy to TMPDIR if ! cp -f "${TARGET_DIR}/${TARGET_LIB}" "${TMPDIR}/${TARGET_LIB}"; then abort "Failed to copy ${TARGET_DIR}/${TARGET_LIB} to ${TMPDIR}/${TARGET_LIB}" @@ -19,8 +25,8 @@ fi ui_print "Success to copy ${TARGET_DIR}/${TARGET_LIB} to ${TMPDIR}/${TARGET_LIB}" # parse liblog.so to get the virtual address of __android_log_is_loggable -TARGET_FUNC_VADDR=$(readelf -sW "${TMPDIR}/${TARGET_LIB}" | grep -w __android_log_is_loggable | awk '{print $2}') -if [ -z "$TARGET_FUNC_VADDR" ]; then +TARGET_FUNC_VADDR=$($READELF -sW "${TMPDIR}/${TARGET_LIB}" | grep -w __android_log_is_loggable | awk '{print $2}') +if [ $? -ne 0 ] || [ -z "$TARGET_FUNC_VADDR" ]; then abort "Failed to get virtual address of __android_log_is_loggable from ${TMPDIR}/${TARGET_LIB}" fi ui_print "Success to get virtual address of __android_log_is_loggable: ${TARGET_FUNC_VADDR}" @@ -28,8 +34,8 @@ ui_print "Success to get virtual address of __android_log_is_loggable: ${TARGET_ TARGET_FUNC_VADDR=$(printf "%ld" "0x${TARGET_FUNC_VADDR}") # parse liblog.so to get elf headers -HEADERS=$(readelf -l "${TMPDIR}/${TARGET_LIB}" | sed '/Program Headers/,/Section to Segment mapping/!d;/Program Headers/d;/Section to Segment mapping/d') -if [ -z "$HEADERS" ]; then +HEADERS=$($READELF -l "${TMPDIR}/${TARGET_LIB}" | sed '/Program Headers/,/Section to Segment mapping/!d;/Program Headers/d;/Section to Segment mapping/d') +if [ $? -ne 0 ] || [ -z "$HEADERS" ]; then abort "Failed to parse program headers from ${TMPDIR}/${TARGET_LIB}" fi diff --git a/src/module.prop b/src/module.prop index 8889a87..b49cc05 100644 --- a/src/module.prop +++ b/src/module.prop @@ -1,6 +1,6 @@ id=logddisablerlite name=LogDisablerLite -version=1.2 -versionCode=3 +version=1.3 +versionCode=4 author=shizhx@github description=Disable Logging to logcat \ No newline at end of file diff --git a/src/toybox-aarch64 b/src/toybox-aarch64 new file mode 100755 index 0000000..fa92f06 Binary files /dev/null and b/src/toybox-aarch64 differ