Skip to content

Instantly share code, notes, and snippets.

@Lanchon
Created January 12, 2016 03:17
Show Gist options
  • Save Lanchon/80719e0e66cdb7276778 to your computer and use it in GitHub Desktop.
Save Lanchon/80719e0e66cdb7276778 to your computer and use it in GitHub Desktop.
IsoRec Patch - Isolated Recovery for the Galaxy S2 Family - CM/android_kernel_samsung_smdk4412
diff --git a/usr/galaxys2_initramfs_files/init b/usr/galaxys2_initramfs_files/init
index 32eacfb..cb3da8e 100755
--- a/usr/galaxys2_initramfs_files/init
+++ b/usr/galaxys2_initramfs_files/init
@@ -12,8 +12,24 @@ busybox mount -t sysfs sysfs /sys
load_image=/stage1/boot.cpio
if busybox grep -q bootmode=2 /proc/cmdline ; then
- # recovery boot
- load_image=/stage1/recovery.cpio
+
+ # recovery boot
+
+ # default to recovery ramdisk bundled with kernel
+ load_image=/stage1/recovery.cpio
+
+ # attempt isorec (isolated recovery) boot
+
+ # if the raw /dev/block/platform/dw_mmc/by-name/RECOVERY
+ # partition contains valid lzop-compressed data
+ if busybox lzop -dc /dev/block/mmcblk0p6 > /stage1/isorec.cpio ; then
+ # and if said data is a valid cpio archive
+ if busybox cpio -t < /stage1/isorec.cpio ; then
+ # then use it as the recovery ramdisk
+ load_image=/stage1/isorec.cpio
+ fi
+ fi
+
fi
busybox cpio -i < ${load_image}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment