Skip to content

Commit

Permalink
Move boot image path to /boot/boot-magisk.img
Browse files Browse the repository at this point in the history
  • Loading branch information
1457384613gh authored and HuskyDG committed Feb 5, 2023
1 parent 9d38ac4 commit 0d94b73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 7 additions & 5 deletions initrd/bin/magisk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions initrd/init
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,25 @@ 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"
else
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"
}
Expand Down

0 comments on commit 0d94b73

Please sign in to comment.