Added Support for LD_PRELOAD of init

This commit is contained in:
newbit
2024-10-04 22:12:28 +02:00
parent bc49e6ef53
commit 613caa4437
2 changed files with 27 additions and 9 deletions
+1
View File
@@ -384,6 +384,7 @@ rootAVD.bat system-images\android-25\google_apis_playstore\armeabi-v7a\ramdisk.i
### Change Logs
#### [Oct 2024]
* [rootAVD.sh] - Added Support for LD_PRELOAD of init
* [General] - Updated to Magisk v26.4
* [rootAVD.sh] - Removed Magisk Alpha as it moved to App Center and TG
+26 -9
View File
@@ -67,6 +67,7 @@ copyARCHfiles() {
BINDIR=$BASEDIR/lib/$ABI
ASSETSDIR=$BASEDIR/assets
STUBAPK=false
INITLD=false
if [ -e $BINDIR/libstub.so ]; then
ABI=$ARCH32
@@ -89,6 +90,11 @@ copyARCHfiles() {
STUBAPK=true
fi
if [ -e $BASEDIR/init-ld ]; then
echo "[*] init LD_PRELOAD is present"
INITLD=true
fi
chmod -R 755 $BASEDIR
export STUBAPK
}
@@ -1235,7 +1241,7 @@ FindWorkingBusyBox() {
for file in $(ls $BASEDIR/lib/*/*busybox*); do
chmod +x "$file"
bbversion=$($file | $file head -n 1)>/dev/null 2>&1
if [[ $bbversion == *"BusyBox"*"Magisk"*"multi-call"* ]]; then
if [[ $bbversion == *"BusyBox"* ]]; then
TestingBusyBoxVersion "$file"
RESULT="$?"
if [[ "$RESULT" == "0" ]]; then
@@ -1692,16 +1698,23 @@ patching_ramdisk(){
echo "[-] Patching ramdisk"
# Compress to save precious ramdisk space
if ! $INITLD ; then
if $IS32BITONLY || ! $IS64BITONLY ; then
PREINITDEVICE=$($BASEDIR/magisk32 --preinit-device)
$BASEDIR/magiskboot compress=xz magisk32 magisk32.xz
fi
if $IS32BITONLY || ! $IS64BITONLY ; then
PREINITDEVICE=$($BASEDIR/magisk32 --preinit-device)
$BASEDIR/magiskboot compress=xz magisk32 magisk32.xz
if $IS64BITONLY || ! $IS32BITONLY ; then
PREINITDEVICE=$($BASEDIR/magisk64 --preinit-device)
$BASEDIR/magiskboot compress=xz magisk64 magisk64.xz
fi
else
PREINITDEVICE=$($BASEDIR/magisk --preinit-device)
$BASEDIR/magiskboot compress=xz magisk magisk.xz
$BASEDIR/magiskboot compress=xz init-ld init-ld.xz
fi
if $IS64BITONLY || ! $IS32BITONLY ; then
PREINITDEVICE=$($BASEDIR/magisk64 --preinit-device)
$BASEDIR/magiskboot compress=xz magisk64 magisk64.xz
fi
$INITLD && SKIPLD="" || SKIPLD="#"
echo "KEEPVERITY=$KEEPVERITY" > config
echo "KEEPFORCEENCRYPT=$KEEPFORCEENCRYPT" >> config
@@ -1719,6 +1732,9 @@ patching_ramdisk(){
$IS64BITONLY && SKIP32="#" || SKIP32=""
$IS64BIT && SKIP64="" || SKIP64="#"
$INITLD && SKIP32="#"
$INITLD && SKIP64="#"
if $STUBAPK; then
echo "[!] stub.apk is present, compress and add it to ramdisk"
$BASEDIR/magiskboot compress=xz stub.apk stub.xz
@@ -1740,14 +1756,15 @@ patching_ramdisk(){
"add 0750 init magiskinit" \
"$SKIP32 add 0644 overlay.d/sbin/magisk32.xz magisk32.xz" \
"$SKIP64 add 0644 overlay.d/sbin/magisk64.xz magisk64.xz" \
"$SKIPLD add 0644 overlay.d/sbin/magisk.xz magisk.xz" \
"$SKIPSTUB add 0644 overlay.d/sbin/stub.xz stub.xz" \
"$SKIPLD add 0644 overlay.d/sbin/init-ld.xz init-ld.xz" \
"patch" \
"backup ramdisk.cpio.orig" \
"mkdir 000 .backup" \
"add 000 .backup/.magisk config"
}
rename_copy_magisk() {
if ( "$MAGISKVERCHOOSEN" ); then
echo "[!] Copy Magisk.zip to Magisk.apk"