|
|
|
@ -1,172 +0,0 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
fail() {
|
|
|
|
|
echo "Failed"
|
|
|
|
|
echo "$1"
|
|
|
|
|
exec /bin/sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boot_normal()
|
|
|
|
|
{
|
|
|
|
|
# cleanup
|
|
|
|
|
umount /bootsdcard
|
|
|
|
|
rmdir /bootsdcard
|
|
|
|
|
mount -o remount,ro /
|
|
|
|
|
# exit script normally, and continue on
|
|
|
|
|
exit 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mount -t proc proc /proc
|
|
|
|
|
mount -t sysfs sys /sys
|
|
|
|
|
mkdir -m 0777 /dev/block
|
|
|
|
|
mknod -m 0666 /dev/block/mmcblk0 b 179 0
|
|
|
|
|
mknod -m 0666 /dev/block/mmcblk0p1 b 179 1
|
|
|
|
|
mknod -m 0666 /dev/block/mmcblk0p2 b 179 2
|
|
|
|
|
mount -o remount,rw /
|
|
|
|
|
# wait for sdcard
|
|
|
|
|
while [ ! -b /dev/block/mmcblk0 ]; do
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
|
|
#Configure Devices
|
|
|
|
|
MAKEDEVS
|
|
|
|
|
|
|
|
|
|
PATH=/sbin:/bin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Mounting debugfs"
|
|
|
|
|
mount -t debugfs none /dbgfs
|
|
|
|
|
echo "Activating backlight control..."
|
|
|
|
|
echo 3 > /sys/class/htc_hw/test
|
|
|
|
|
echo "Enabling smooth scrolling..."
|
|
|
|
|
echo 40 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
|
|
|
|
|
echo "Activating full charging..."
|
|
|
|
|
echo 2 > /dbgfs/htc_battery/charger_state
|
|
|
|
|
echo 1024 > /dbgfs/micropklt_dbg/sleep_leds
|
|
|
|
|
echo "+++++++ Tweaking MMC read-ahead by Rafpigna +++++++"
|
|
|
|
|
mmcfolder="/sys/devices/platform/msm_sdcc.2/mmc_host/mmc1"
|
|
|
|
|
cd $mmcfolder
|
|
|
|
|
folderlist=`ls -1`
|
|
|
|
|
mmcresult=`echo $folderlist | grep -o '\bmmc1:\w*' | sed 's/mmc1://'`
|
|
|
|
|
echo 32 > /sys/devices/platform/msm_sdcc.2/mmc_host/mmc1/mmc1:$mmcresult/block/mmcblk0/queue/read_ahead_kb
|
|
|
|
|
echo "+++++++ Auto-off keyled backlight by Rafpigna +++++++"
|
|
|
|
|
echo 0 > /sys/devices/platform/btn_backlight_manager/auto_off
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################################################
|
|
|
|
|
###### configs on boot ############################
|
|
|
|
|
###### idea by Dandiest, modified by me (rafpigna) #
|
|
|
|
|
####################################################
|
|
|
|
|
|
|
|
|
|
#first, mount sd card
|
|
|
|
|
# assume single partition, if found partition 1 use that
|
|
|
|
|
echo "+++++++ STARTING UPDATE SCRIPT +++++++"
|
|
|
|
|
echo "+++++++ MOUNTING SD CARD +++++++"
|
|
|
|
|
sdcard_partition=mmcblk0
|
|
|
|
|
[ -d /sys/block/mmcblk0/mmcblk0p1 ] && sdcard_partition=mmcblk0p1
|
|
|
|
|
# run fsck
|
|
|
|
|
# dosfsck -y /dev/block/$sdcard_partition
|
|
|
|
|
# mount sdcard
|
|
|
|
|
mkdir -m 0700 /bootsdcard
|
|
|
|
|
mount -t vfat -o fmask=0111,dmask=0000,rw,utf8,noatime,nodiratime /dev/block/$sdcard_partition /bootsdcard || bootsdcard=0
|
|
|
|
|
sleep 1
|
|
|
|
|
if [ $bootsdcard -eq 0 ]; then
|
|
|
|
|
# cleanup
|
|
|
|
|
rmdir /bootsdcard
|
|
|
|
|
rm -f /dev/block/mmcblk0
|
|
|
|
|
rm -f /dev/block/mmcblk0p1
|
|
|
|
|
rm -f /dev/block/mmcblk0p2
|
|
|
|
|
# boot normally
|
|
|
|
|
boot_normal
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# prepare
|
|
|
|
|
data_dir=/bootsdcard
|
|
|
|
|
init_log=/bootsdcard/init.log
|
|
|
|
|
update_dir=/bootsdcard/updates
|
|
|
|
|
|
|
|
|
|
# clear previous init.log
|
|
|
|
|
if [ -f $init_log ]; then
|
|
|
|
|
rm -f $init_log
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "+++++++ READING CONFIG FILE +++++++"
|
|
|
|
|
# read config file
|
|
|
|
|
config_file=$data_dir/config.txt
|
|
|
|
|
if [ -f $config_file ]; then
|
|
|
|
|
config=`awk -v RS='\r\n' -v ORS=' ' 1 $config_file`
|
|
|
|
|
gps_zone=`echo $config | grep -o '\bgps_zone=\w*' | sed 's/gps_zone=//'`
|
|
|
|
|
a2sd_mode=`echo $config | grep -o '\ba2sd_mode=\w*' | sed 's/a2sd_mode=//'`
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#write the values to logfile to have possibility to check if they are right
|
|
|
|
|
echo "gps_zone" >> $init_log
|
|
|
|
|
echo $gps_zone >> $init_log
|
|
|
|
|
echo "a2sd_mode" >> $init_log
|
|
|
|
|
echo $a2sd_mode >> $init_log
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# load default value
|
|
|
|
|
[ -z $a2sd_mode ] && a2sd_mode="none"
|
|
|
|
|
|
|
|
|
|
#20 jan 2011
|
|
|
|
|
#ext3 can be mounted as ext4 with that option improving performances without major drawbacks
|
|
|
|
|
#reference: https://wiki.archlinux.org/index.php/Ext4#Mounting_ext3_Partitions_as_ext4_Without_Converting
|
|
|
|
|
|
|
|
|
|
#if second partition exists, mount it as data. if not exists, uncomment line in init.rc to mount data on yaffs
|
|
|
|
|
#also init.rc must be changed to mount /data on nand userdata if ext partition does not exists
|
|
|
|
|
if [ -d /sys/block/mmcblk0/mmcblk0p2 ] ; then
|
|
|
|
|
echo "Ext partition found. Mounting data on EXT"
|
|
|
|
|
echo "Ext partition found. Mounting data on EXT" >> $init_log
|
|
|
|
|
|
|
|
|
|
# Added by arif-ali
|
|
|
|
|
# set a2sd mode
|
|
|
|
|
if [ "$a2sd_mode" == "a2sd" ]; then
|
|
|
|
|
echo "+++++++ a2sd ACTVATED +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ a2sd ACTVATED +++++++"
|
|
|
|
|
rm -rf /data/.noa2sd
|
|
|
|
|
rm -rf /data/.dalvikcache
|
|
|
|
|
elif [ "$a2sd_mode" == "dalvik" ]; then
|
|
|
|
|
echo "+++++++ dalvik a2sd ACTVATED +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ dalvik a2sd ACTVATED +++++++"
|
|
|
|
|
rm -rf /data/.noa2sd
|
|
|
|
|
touch /data/.dalvikcache
|
|
|
|
|
elif [ "$a2sd_mode" == "data" ]; then
|
|
|
|
|
echo "+++++++ data a2sd ACTVATED +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ data a2sd ACTVATED +++++++"
|
|
|
|
|
rm -rf /data/.noa2sd
|
|
|
|
|
touch /data/.dalvikcache
|
|
|
|
|
touch /data/.datasd
|
|
|
|
|
elif [ "$a2sd_mode" == "none" ]; then
|
|
|
|
|
touch /data/.noa2sd
|
|
|
|
|
echo "+++++++ a2sd DEACTVATED - running from NAND +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ a2sd DEACTVATED - running from NAND +++++++"
|
|
|
|
|
else
|
|
|
|
|
echo "+++++++ Default a2sd ACTVATED +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ Default a2sd ACTVATED +++++++"
|
|
|
|
|
rm -rf /data/.noa2sd
|
|
|
|
|
touch /data/.dalvikcache
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "+++++++ MOUNTED DATA ON EXT +++++++"
|
|
|
|
|
echo "+++++++ MOUNTED DATA ON EXT +++++++" >> $init_log
|
|
|
|
|
else
|
|
|
|
|
echo "Ext partition not found. disabling a2sd"
|
|
|
|
|
echo "Ext partition not found. disabling a2sd" >> $init_log
|
|
|
|
|
touch /data/.noa2sd
|
|
|
|
|
rm -rf /data/.dalvikcache
|
|
|
|
|
rm -rf /data/.datasd
|
|
|
|
|
echo "+++++++ MOUNTED DATA ON NAND +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ MOUNTED DATA ON NAND +++++++"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# set gps zone
|
|
|
|
|
if [ "$gps_zone" != "" ]; then
|
|
|
|
|
current_gps_zone=`awk -F"=" '/NTP_SERVER/ {print $2}' /system/etc/gps.conf`
|
|
|
|
|
[ "$gps_zone.pool.ntp.org" != "$current_gps_zone" ] && sed -i "s/$current_gps_zone/$gps_zone.pool.ntp.org/g" /system/etc/gps.conf
|
|
|
|
|
echo "+++++++ GPS ZONE CHANGED +++++++" >> $init_log
|
|
|
|
|
echo "+++++++ GPS ZONE CHANGED +++++++"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
boot_normal
|