aboutsummaryrefslogtreecommitdiffstats
path: root/usr/fascinatemtd_initramfs_files/init
blob: c987b80c0d24ecfc2a004ea34d5aaf1fae82ffad (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/stage1/busybox sh
export _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

while ! busybox test -d /sys/devices/platform/s3c-sdhci.0/mmc_host/mmc0/mmc0:0001 ; do
	echo "Waiting for internal mmc..."
	busybox sleep 1
done

/lvm/sbin/lvm vgscan --mknodes --ignorelockingfailure
/lvm/sbin/lvm vgchange -aly --ignorelockingfailure

busybox mount -t ext4 /dev/lvpool/system /system
busybox mount -t ext4 /dev/block/mmcblk0p3 /cache

image=/stage1/ramdisk.img

if busybox test -e /cache/.startrecovery || \
	busybox grep -q bootmode=2 /proc/cmdline ; then
	# recovery boot
	busybox rm -fr /cache/.startrecovery
	image=/stage1/ramdisk-recovery.img

	# disable lpm
	busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting
elif ! busybox test -e /system/build.prop ; then
	# emergency boot
	busybox umount /cache
	make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /cache /dev/block/mmcblk0p3
	busybox mount -t ext4 /dev/block/mmcblk0p3 /cache
	busybox mkdir /cache/recovery

	busybox mount -t vfat /dev/block/mmcblk1p1 /sdcard

	UPDATE=$(busybox cat /sdcard/cyanogenmod.cfg)

	if busybox test -n "$UPDATE" && busybox test -e $UPDATE ; then
		busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand
	fi

	image=/stage1/ramdisk-recovery.img

	# disable lpm
	busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting
fi

busybox umount /cache
busybox umount /system
busybox umount /sdcard
busybox rmdir /sdcard

busybox zcat $image | busybox cpio -i

if busybox grep -q 1 /sys/class/power_supply/battery/charging_mode_booting ; then
	# low power mode
	busybox cp lpm.rc init.rc
	busybox rm init.aries.rc
fi

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