Cyanogenmod
fastboot:
- Volume Down + Power
- install Recovery 6.0.1.0_r1
recovery:
- Volume Up + Power
- install cyanogenmod 9-20121102-NIGHTLY
battery
- HB5K1H
- 3.7V 1400mAh (5.2Wh) 18287-2000
Configs
mount /data
mount /sdcard
mount -o remount,rw /system
# move tmp to /sdcard
rm -rf /data/local/tmp
ln -s /sdcard/tmp /data/local/tmp
# enable adb over wifi
setprop persist.adb.tcp.port 5555
# original sysinit
cat << EOF > /system/bin/sysinit
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
EOF
chmod 777 /system/bin/sysinit
# replace sysinit, we need background task support '&'
mv /system/bin/sysinit /system/bin/sysinit.old
cat << 'EOF' > /system/bin/sysinit
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
for I in /system/etc/init.d/*; do
$I
done
EOF
chmod 777 /system/bin/sysinit
Dalvik cache
# move dalvik cache all apps to /sdcard except frameworks
cd /data/dalvik-cache && find . -name 'data*' -o -name 'mnt*' -o -name 'system@app*' -type f | while read dex; do cp "$dex" "/sdcard/dalvik-cache/$dex" && rm -f "/data/dalvik-cache/$dex" && ln -s "/sdcard/dalvik-cache/$dex" "/data/dalvik-cache/$dex"; done
# move dalvik cache all apps to /cache except frameworks
cd /data/dalvik-cache && find . -name 'data*' -o -name 'mnt*' -o -name 'system@app*' -type f | while read dex; do cp "$dex" "/cache/dalvik-cache/$dex" && rm -f "/data/dalvik-cache/$dex" && ln -s "/cache/dalvik-cache/$dex" "/data/dalvik-cache/$dex"; done
# move dalvik cache to /sdcard for apps only
cd /data/dalvik-cache && find . -name 'data*' -o -name 'mnt*' -type f | while read dex; do cp "$dex" "/sdcard/dalvik-cache/$dex" && rm -f "/data/dalvik-cache/$dex" && ln -s "/sdcard/dalvik-cache/$dex" "/data/dalvik-cache/$dex"; done
# move dalvik cache to /sdcards for sdcard apps
cd /data/dalvik-cache && find . -name 'data*' -o -name 'mnt*' -type f | while read dex; do cp "$dex" "/cache/dalvik-cache/$dex" && rm -f "/data/dalvik-cache/$dex" && ln -s "/cache/dalvik-cache/$dex" "/data/dalvik-cache/$dex"; done
# move frameworks apps (not recommended)
cd /data/dalvik-cache && find . -name 'system@framework*' -type f | while read dex; do cp "$dex" "/sdcard/dalvik-cache/$dex" && rm -f "/data/dalvik-cache/$dex" && ln -s "/sdcard/dalvik-cache/$dex" "/data/dalvik-cache/$dex"; done
# only data apps
cd /data/dalvik-cache && find data* -type f | while read dex; do cp "$dex" "/cache/dalvik-cache/$dex" && rm -f "/data/dalvik-cache/$dex" && ln -s "/cache/dalvik-cache/$dex" "/data/dalvik-cache/$dex"; done
Syncthing
- Advanced / Folder / Ignore Perms
# install syncthing
mkdir -p /data/local/axet/bin/
cat << 'EOF' > /data/local/axet/bin/syncthing-daemon.sh
#!/system/bin/sh
export HOME=/data/local/axet
export PATH=$PATH:$HOME/bin
while true; do
syncthing
sleep 1
done
EOF
chmod 777 /data/local/axet/bin/syncthing-daemon.sh
mkdir -p /system/etc/init.d/
cat << 'EOF' > /system/etc/init.d/90syncthing
#!/system/bin/sh
/data/local/axet/bin/syncthing-daemon.sh &
EOF
chmod 777 /system/etc/init.d/90syncthing
# download syncthing
V=$(basename `curl -w "%{url_effective}\n" -I -L -s -S https://github.com/syncthing/syncthing/releases/latest -o /dev/null`)
wget -qO- "$URL" | tar xOzv "syncthing-linux-arm-$V/syncthing" > syncthing
adb push syncthing /data/local/axet/bin/syncthing
adb shell chmod 777 /data/local/axet/bin/syncthing
# setup adb port forward
adb forward tcp:8080 tcp:8384
Autoboot
Connecting android device to charger boot android device into recover mode with ‘/proc/app_info:charge_flag’ set to 1. Script /sbin/postrecoveryboot.sh starts check the flag and starts /sbin/charge for charging animation. To control charging process (replace with reboot) change the script.
Requires patching recovery.img and replacing /sbin/charge or /sbin/postrecoveryboot.sh
Repacking ramdisk requires to set correct cpio format, please use “newc”.
Repacking recovery.img
git clone https://github.com/osm0sis/mkbootimg
~/local/mkbootimg/unpackbootimg -i recovery.img
cat ../recovery.img-ramdisk | gzip -d | cpio -i -F
find . | cpio -o -H newc | gzip -9 > ../recovery.img-ramdisk
~/local/mkbootimg/mkbootimg --kernel recovery.img-kernel --kernel_offset "$(cat recovery.img-kernel_offset)" --ramdisk recovery.img-ramdisk --ramdisk_offset "$(cat recovery.img-ramdisk_offset)" --tags_offset "$(cat recovery.img-tags_offset)" --cmdline "$(cat recovery.img-cmdline)" --pagesize "$(cat recovery.img-pagesize)" --header_version "$(cat recovery.img-header_version)" --hashtype "$(cat recovery.img-hashtype)" --base "$(cat recovery.img-base)" --second_offset "$(cat recovery.img-second_offset)" -o 123.img
fastboot flash recovery 123.img