aboutsummaryrefslogtreecommitdiffstats
path: root/usr/galaxys2_initramfs_files/init
blob: cb3da8efdd2fa21eeffedefb54207690631885a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/stage1/busybox sh
_PATH="$PATH"
export PATH=/stage1

busybox cd /
busybox date >>boot.txt
exec >>boot.txt 2>&1
busybox rm init
busybox mount -t proc proc /proc
busybox mount -t sysfs sysfs /sys

load_image=/stage1/boot.cpio

if busybox grep -q bootmode=2 /proc/cmdline ; then

    # 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}

busybox umount /sys
busybox umount /proc
busybox date >>boot.txt
busybox rm -fr /stage1 /dev/*
export PATH="${_PATH}"
exec /init