diff --git a/initrd/bin/magisk.sh b/initrd/bin/magisk.sh index 957885e..d7a7f87 100644 --- a/initrd/bin/magisk.sh +++ b/initrd/bin/magisk.sh @@ -76,12 +76,14 @@ fi killall -9 magiskd } -if [ -f "/mnt/$SOURCE_OS/boot-magisk.img" ]; then - loop_setup "/mnt/$SOURCE_OS/boot-magisk.img" - BOOTIMAGE="$LOOPDEV" - debug_log "initrd-magisk: boot image = $BOOTIMAGE" +if [ -f "/mnt/$SOURCE_OS/boot/boot-magisk.img" ]; then + loop_setup "/mnt/$SOURCE_OS/boot/boot-magisk.img" + BOOTIMAGE="$LOOPDEV" + debug_log "initrd-magisk: boot image = $BOOTIMAGE" +fi +if [ -z "$BOOTIMAGE" ]; then + debug_log "initrd-magisk: boot image is not found" fi -[ -z "$BOOTIMAGE" ] && BOOTIMAGE=/dev/null ( # BEGIN : inject magisk @@ -132,7 +134,7 @@ OVERLAYDIR="/android/dev/boot-magisk/overlay.d" # if boot image contains magisk, it will be used instead of magisk.apk debug_log "initrd-magisk: parse boot image" -( cp -f "/mnt/$SOURCE_OS/boot-magisk.img" /tmp/boot.img +( cp -f "/mnt/$SOURCE_OS/boot/boot-magisk.img" /tmp/boot.img cd "$inittmp" && $MAGISKCORE/magiskboot unpack "/tmp/boot.img" cd "$inittmp/boot-magisk" && cat "$inittmp/ramdisk.cpio" | cpio -iud cp -f "$inittmp/boot-magisk/init" "$MAGISKCORE/magiskinit" diff --git a/initrd/init b/initrd/init index d701c50..55470e4 100644 --- a/initrd/init +++ b/initrd/init @@ -149,15 +149,15 @@ check_root() mkdir /mnt/iso mount -o loop /iso/$iso /mnt/iso fi - INITRD_REAL=initrd_real.img - APKFILE=/mnt/$SRC/magisk.apk + INITRD_REAL=boot/initrd_real.img + APKFILE=/mnt/$SRC/boot/magisk.apk echo "$dev" >"$MAGISKCORE/osroot_dev" if [ -e /mnt/$SRC/$INITRD_REAL ]; then zcat /mnt/$SRC/$INITRD_REAL | cpio -id > /dev/null INITRD_IMAGE="/mnt/$SRC/$INITRD_REAL" - elif [ -e /mnt/$SRC/initrd.img ]; then - zcat /mnt/$SRC/initrd.img | cpio -id > /dev/null - INITRD_IMAGE="/mnt/$SRC/initrd.img" + elif [ -e /mnt/$SRC/boot/initrd.img ]; then + zcat /mnt/$SRC/boot/initrd.img | cpio -id > /dev/null + INITRD_IMAGE="/mnt/$SRC/boot/initrd.img" elif [ -b /dev/$INITRD_REAL ]; then zcat /dev/$INITRD_REAL | cpio -id > /dev/null INITRD_IMAGE="/dev/$INITRD_REAL" @@ -165,9 +165,9 @@ check_root() return 1 fi err="$?" - if [ ! -f "/mnt/$SRC/boot-magisk.img" ]; then - rm -rf "/mnt/$SRC/boot-magisk.img" - zcat "/boot.img.gz" >"/mnt/$SRC/boot-magisk.img" + if [ ! -f "/mnt/$SRC/boot/boot-magisk.img" ]; then + rm -rf "/mnt/$SRC/boot/boot-magisk.img" + zcat "/boot.img.gz" >"/mnt/$SRC/boot/boot-magisk.img" fi return "$err" }