Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 180 lines (164 sloc) 4.04 KB
#!/sbin/busybox sh
cd /
busybox mount -t proc proc /proc
busybox mount -t sysfs sysfs /sys
if grep -q bootmode=2 /proc/cmdline ; then
cp -a /res/misc/init.40/* /
echo 0 > /proc/sys/kernel/rom_feature_set
cp -a /recovery.rc /init.rc
exec /sbin/init2
fi
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.40/* /
cp lpm.rc init.rc
rm init.smdk4210.rc
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 61
mknod /dev/block/mmcblk0p7 b 179 7
mknod /dev/block/mmcblk0p9 b 259 1
mknod /dev/block/mmcblk0p10 b 259 2
mknod /dev/block/mmcblk0p11 b 259 3
mknod /dev/block/mmcblk0p12 b 259 4
mknod /dev/block/loop0 b 7 0
mkdir -p /mnt/.secondrom
chmod 755 /mnt
mkdir /preload
mount -t ext4 -o ro /dev/block/mmcblk0p12 /preload
mount -t vfat /dev/block/mmcblk0p11 /mnt
NEXTBOOT=`cat /mnt/.nextboot`
rm -f /mnt/.nextboot
DEFAULTROM=`cat /mnt/.defaultrom`
SECONDROM=1
NOBOOTLOGO=0
[ -f /preload/build.prop ] || SECONDROM=0
[ -f /mnt/.secondrom/data.img ] || SECONDROM=0
[ -f /mnt/.secondrom/cache.img ] || SECONDROM=0
[ -f /mnt/.nobootlogo ] && NOBOOTLOGO=1
umount /preload
umount /mnt
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
rm -rf /res/dev
mkdir -p /res/dev
ln -s /mnt/.secondrom/.secondrom/data.img /res/dev/data
ln -s /dev/block/mmcblk0p12 /res/dev/system
ln -s /mnt/.secondrom/.secondrom/cache.img /res/dev/cache
else
rm -rf /res/dev
mkdir -p /res/dev
ln -s /dev/block/mmcblk0p10 /res/dev/data
ln -s /dev/block/mmcblk0p9 /res/dev/system
ln -s /dev/block/mmcblk0p7 /res/dev/cache
fi
mount -t ext4 /res/dev/system /system
AOSP=0
MIUI=0
B2G=0
CM10=0
JB=0
[ -d /system/b2g ] && B2G=1
[ -f /system/framework/framework2.jar ] || AOSP=1
[ -f /system/framework/framework-miui.jar ] && MIUI=1
[ -f /system/lib/ssl/engines/libkeystore.so ] && JB=1
[ -f /system/framework/seccamera.jar ] || CM10=1
if [ "$JB" == 1 ];
then
mv -f /sbin/adbd.jb /sbin/adbd
if [ "$CM10" == 1 ];
then
echo 3 > /proc/sys/kernel/rom_feature_set
rm -rf /vendor
mv -f /res/misc/init.cm10/* /
else
echo 2 > /proc/sys/kernel/rom_feature_set
mv -f /res/misc/init.41/* /
fi
else
if [ "$B2G" == 1 ];
then
echo 0 > /proc/sys/kernel/rom_feature_set
rm -rf /vendor
cp -a /res/misc/init.b2g/* /
else
if [ "$AOSP" == "1" ];
then
echo 1 > /proc/sys/kernel/rom_feature_set
mv -f /res/misc/init.cm9/* /
rm -rf /vendor
else
echo 0 > /proc/sys/kernel/rom_feature_set
mv -f /res/misc/init.40/* /
fi;
if [ "$MIUI" == 1 ];
then
cp -a /res/misc/init.miui/* /
fi
fi;
fi
if [ "$SECONDROM" == "1" ];then
mv /init.smdk4210.rc.2 /init.smdk4210.rc
mv /init.rc.2 /init.rc
else
rm -f /init.rc.2 /init.smdk4210.rc.2
fi
umount /system
rm -rf /res/misc/init*
chmod 755 /innt
chmod 644 /*.rc
chmod 644 /*.prop
chmod -R 755 /lib
# 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
exec /sbin/init2