From daa49a63ced8e1a3f7e2ddc94cd04fadd4bd0d80 Mon Sep 17 00:00:00 2001 From: Lanchon Date: Tue, 12 Jan 2016 02:44:18 -0300 Subject: IsoRec: Isolated Recovery for the Exynos 4210 family IsoRec aims to be a standard by which the monolithic kernel/recovery binaries of the S2 family of devices can invoke an alternate recovery optionally flashed separately by the user. The alternate recovery is flashed to the RECOVERY partition (/dev/block/mmcblk0p6), a seemingly vestigial partition without any real use. Only the lzop-compressed, cpio-formatted recovery ramdrive is stored there; the standard kernel image is used to run this recovery. The lzop-compressed image of the ramdrive is stored raw in the RECOVERY partition. Behavior of patch: -skip all this if not booting into recovery. -if the raw recovery partition contains valid lzop-compressed data, -and if said data is a valid cpio archive, -then use that cpio archive as the recovery ramdrive; -else use the default recovery ramdrive bundled with the kernel. More information here: http://forum.xda-developers.com/galaxy-s2/orig-development/isorec-isolated-recovery-galaxy-s2-t3291176 Change-Id: I2fa1b764b52915262374124ea28f5a2585314891 --- usr/galaxys2_initramfs_files/init | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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} -- cgit v1.1