forked from gokhanmoral/ramfs-sgs3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init
executable file
·158 lines (138 loc) · 3.46 KB
/
init
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/sbin/busybox sh
cd /
busybox mount -t proc proc /proc
busybox mount -t sysfs sysfs /sys
if busybox grep -q 1 /sys/class/power_supply/battery/batt_lp_charging ; then
# low power mode
echo 0 > /proc/sys/kernel/rom_feature_set
cp -a /res/misc/init.41/* /
chmod 755 /innt
chmod 644 /*.rc
chmod 644 /*.prop
exec /sbin/init2
fi
SECONDROM=1
NOBOOTLOGO=0
mkdir -p /dev/block
mkdir /dev/input
mkdir /dev/graphics
mknod /dev/graphics/fb0 c 29 0
mknod /dev/input/event1 c 13 65
mknod /dev/input/event2 c 13 66
mknod /dev/input/event8 c 13 72
mknod /dev/input/event9 c 13 73
mknod /dev/ashmem c 10 60
mknod /dev/block/mmcblk0p9 b 179 9
mknod /dev/block/mmcblk0p12 b 179 12
mknod /dev/block/loop0 b 7 0
mkdir /mnt
chmod 755 /mnt
mkdir /.secondrom
mount -t ext4 /dev/block/mmcblk0p12 /.secondrom
NEXTBOOT=`cat /.secondrom/media/.nextboot`
rm -f /.secondrom/media/.nextboot
DEFAULTROM=`cat /.secondrom/media/.defaultrom`
if grep -q bootmode=2 /proc/cmdline ; then
NEXTBOOT=0
fi
if [ "$NEXTBOOT" == "0" ]; then
mv -f /res/etc /
umount /.secondrom
echo 0 > /proc/sys/kernel/rom_feature_set
mv -f /res/misc/init.41/* /
mv -f /res/misc/recovery/* /
chmod 755 /innt
chmod 644 /*.smdk4x12
chmod 644 /*.rc
chmod 644 /*.prop
chmod -R 755 /lib
exec /sbin/init2
fi
SECONDROM=1
NOBOOTLOGO=0
[ -f /.secondrom/media/.secondrom/system.img ] || SECONDROM=0
[ -f /.secondrom/media/.nobootlogo ] && NOBOOTLOGO=1
if [ "$SECONDROM" == "0" ];then
if [ "$NOBOOTLOGO" == "0" ];then
/sbin/choose_rom $SECONDROM
fi
else
if [ "$NEXTBOOT" == "1" ];then
SECONDROM=0;
elif [ "$NEXTBOOT" == "2" ];then
SECONDROM=1;
else
if [ "$NOBOOTLOGO" == "1" ];then
SECONDROM=$DEFAULTROM
elif [ "$DEFAULTROM" == "1" ];then
/sbin/choose_rom $SECONDROM
if [ "$?" == "1" ]; then
SECONDROM=0
else
SECONDROM=1
fi
else
/sbin/choose_rom $SECONDROM
if [ "$?" == "1" ]; then
SECONDROM=1
else
SECONDROM=0
fi
fi
fi
fi
if [ "$SECONDROM" == "1" ]; then
mount -t ext4 /.secondrom/media/.secondrom/system.img /system
else
mount -t ext4 /dev/block/mmcblk0p9 /system
fi
AOSP=0
MIUI=0
CM10=0
JB=0
[ -f /system/framework/framework2.jar ] || AOSP=1
[ -f /system/framework/miui-framework.jar ] && MIUI=1
[ -f /system/lib/ssl/engines/libkeystore.so ] && JB=1
[ -f /system/framework/seccamera.jar ] || CM10=1
if [ "$JB" == 1 ];
then
if [ "$CM10" == 1 ];
then
echo 3 > /proc/sys/kernel/rom_feature_set
mv -f /lib/modules/dhd_cm.ko /lib/modules/dhd.ko
mv -f /res/misc/init.cm10/* /
else
echo 2 > /proc/sys/kernel/rom_feature_set
mv -f /res/misc/init.41/* /
fi
fi
if [ "$SECONDROM" == "1" ];then
mv /init.smdk4x12.rc.2 /init.smdk4x12.rc
mv /init.rc.2 /init.rc
mv /fstab.smdk4x12.2 /fstab.smdk4x12
else
rm -f /init.rc.2 /init.smdk4x12.rc.2 /fstab.smdk4x12.2
fi
umount -f /system
umount -f /.secondrom
rm -rf /res/misc/init*
chmod 755 /innt
chmod 644 /*.smdk4x12
chmod 644 /*.rc
chmod 644 /*.prop
chmod -R 755 /lib
# misc mods for i9300
insmod /lib/modules/m0_mods.ko
# cpu undervolting interfaces
insmod /lib/modules/cpu_undervolting.ko
# mali (gpu) interfaces
insmod /lib/modules/mali_control.ko
# additional CPU governors
insmod /lib/modules/cpufreq_hotplug.ko
insmod /lib/modules/cpufreq_lulzactiveq.ko
# additional I/O schedulers
insmod /lib/modules/sio-iosched.ko
insmod /lib/modules/vr-iosched.ko
# audio enhancements
insmod /lib/modules/kscoobydoo.ko devicename=scoobydoo_sound
exec /sbin/init2