diff --git a/app2sd_mount.sh b/app2sd_mount.sh new file mode 100644 index 0000000..7c864a8 --- /dev/null +++ b/app2sd_mount.sh @@ -0,0 +1,4 @@ +#!/system/bin/sh +insmod /system/lib/modules/nilfs2.ko +mount -t nilfs2 /dev/block/mmcblk0p2 /system/sd +/system/xbin/nilfs_cleanerd /dev/block/mmcblk0p2 diff --git a/etc/nilfs_cleanerd.conf b/etc/nilfs_cleanerd.conf new file mode 100644 index 0000000..92513f6 --- /dev/null +++ b/etc/nilfs_cleanerd.conf @@ -0,0 +1,60 @@ +# nilfs_cleanerd.conf - configuration file of NILFS cleaner daemon. +# +# This file contains GC parameters that are loaded when cleaner gets +# started. You can force them to be reloaded by sending a HUP signal +# to the cleaner process. +# +# Each parameter is declared with a keyword-value pair or a directive +# with no argument. Lines beginning with "#" are ignored. For +# details, see the man page of nilfs_cleanerd.conf(5). + +# Protection period in second. +protection_period 60 + +# Minimum number of clean segments +# 0 = continuous cleaning +# > 0 = pause cleaning until less segments are available +min_clean_segments 30% + +# Maximum number of clean segments +max_clean_segments 70% + +# The argument of min_clean_segments and max_clean_segments can be +# followed by a percent sign (%) or one of the following +# multiplicative suffixes: K 1024, MB 1000*1000, M 1024*1024, GB +# 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E. +# +# If the argument is followed by "%", it represents a disk capacity +# ratio. + +# Clean segment check interval in seconds +clean_check_interval 60 + +# Segment selection policy. +# In NILFS version 2.0.0, only the timestamp policy is supported. +selection_policy timestamp # timestamp in ascend order + +# The maximum number of segments to be cleaned at a time. +nsegments_per_clean 2 + +# The maximum number of segments to be cleaned at a time +# if clean segments < min_clean_segments +mc_nsegments_per_clean 4 + +# Cleaning interval in seconds. +cleaning_interval 5 + +# Cleaning interval in seconds +# if clean segments < min_clean_segments +mc_cleaning_interval 1 + +# Retry interval in seconds. +retry_interval 60 + +# Use mmap when reading segments if supported. +use_mmap + +# Log priority. +# Supported priorities are emerg, alert, crit, err, warning, notice, info, and +# debug. +log_priority info diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..614591a --- /dev/null +++ b/install.sh @@ -0,0 +1,113 @@ +#!/system/bin/sh + +#scripted by gnh1201 at gmail dot com (Nam Hyeon, Go) + +echo "Install App2SD NILFS2 for XT720" +echo "Backup: /data/data1, app1, app-private1, dalvik-cache1" +echo "This script may damage your system. Continue? (y/n)" +read y + +if [ $y != "y" ] +then + echo "Canceled." + exit 1 +fi + +echo "Please Wait..." + +mount -t yaffs2 -o rw,remount /dev/block/mtdblock6 /system + +if [ -b /dev/block/mmcblk0p2 ] +then + busybox umount /dev/block/mmcblk0p2 +else + echo "Not Found! /dev/block/mmcblk0p2"; + exit 1 +fi + +echo "Do you want to format to NILFS2? (y/n)" +read y +if [ $y = "y" ] +then + touch /etc/mtab + cp xbin/* /system/xbin + cp etc/nilfs_cleanerd.conf /system/etc + chmod 755 /system/xbin/mkfs.nilfs2 /system/xbin/nilfs_cleanerd + chmod 644 /system/etc/nilfs_cleanerd.conf + mkfs.nilfs2 /dev/block/mmcblk0p2 +fi + +echo "Please Wait..." + +cp nilfs2.ko /system/lib/modules +busybox insmod /system/lib/modules/nilfs2.ko +mkdir /system/sd + +busybox mount -t nilfs2 /dev/block/mmcblk0p2 /system/sd +if [ $? -eq 255 ] +then + echo "Mount Failed!" + exit 1 +fi + +echo "NILFS2 Mount OK! Install App2SD..." + +if [ -f /system/bin/mot_boot_mode.bin ] +then + echo "mot_boot_mode.bin Exists." + if [ -d /system/bin/boot_script ] + then + cp app2sd_mount.sh /system/bin/boot_script + chmod 755 /system/bin/boot_script/app2sd_mount.sh + elif [ -f /system/bin/mot_boot_mode ] + then + echo "insmod /system/lib/modules/nilfs2.ko" >> /system/bin/mot_boot_mode + echo "mount -t nilfs2 /dev/block/mmcblk0p2 /system/sd" >> /system/bin/mot_boot_mode + echo "/system/xbin/nilfs_cleanerd /dev/block/mmcblk0p2" >> /system/bin/mot_boot_mode + fi +else + mv /system/bin/mot_boot_mode /system/bin/mot_boot_mode.bin + cp mot_boot_mode /system/bin + chmod 755 /system/bin/mot_boot_mode +fi + +busybox cp -r /data/app /system/sd +busybox chmod 777 /system/sd/app + +busybox cp -r /data/dalvik-cache /system/sd +busybox chmod 777 /system/sd/dalvik-cache + +busybox cp -r /data/app-private /system/sd +busybox chmod 777 /system/sd/app-private + +busybox mv /data/app /data/app1 +busybox ln -s /system/sd/app /data/app + +busybox mv /data/dalvik-cache /data/dalvik-cache1 +busybox ln -s /system/sd/dalvik-cache /data/dalvik-cache + +busybox mv /data/app-private /data/app-private1 +busybox ln -s /system/sd/app-private /data/app-private + +echo "App2SD OK! Do you want I/O patch? (y/n)" +read y +if [ $y = "y" ] +then + busybox cp -rp /data/data /system/sd/ + busybox mv /data/data /data/data1 + busybox ln -s /system/sd/data /data/data + echo "I/O patch OK!" +else + echo "I/O patch Canceled." +fi + +echo "Reboot? (y/n)" +read y + +if [ $y = "y" ] +then + echo "Rebooting... Please Wait..." + reboot +fi + +exit 1 diff --git a/mot_boot_mode b/mot_boot_mode new file mode 100644 index 0000000..a55ce21 --- /dev/null +++ b/mot_boot_mode @@ -0,0 +1,11 @@ +#!/system/bin/sh +export PATH=/system/bin:$PATH + +#run original script +mot_boot_mode.bin + + +#mount nilfs2 +insmod /system/lib/modules/nilfs2.ko +mount -t nilfs2 /dev/block/mmcblk0p2 /system/sd +/system/xbin/nilfs_cleanerd /dev/block/mmcblk0p2 diff --git a/nilfs2.ko b/nilfs2.ko new file mode 100644 index 0000000..276e9b5 Binary files /dev/null and b/nilfs2.ko differ diff --git a/restore_app2sd.sh b/restore_app2sd.sh new file mode 100644 index 0000000..e5de1ec --- /dev/null +++ b/restore_app2sd.sh @@ -0,0 +1,40 @@ +#!/system/bin/sh + +#scripted by gnh1201 at gmail dot com + +echo "Restore App2SD NILFS2 for XT720" +echo "This script may damage your system. Continue? (y/n)" +read y + +if [ $y != "y" ] +then + echo "Canceled." + exit 1 +fi + +echo "Please Wait..." + +mount -t yaffs2 -o rw,remount /dev/block/mtdblock6 /system + +busybox rm /data/app +busybox cp -r /system/sd/app /data +busybox chmod 777 /data/app + +busybox rm /data/dalvik-cache +busybox cp -r /system/sd/dalvik-cache /data +busybox chmod 777 /data/dalvik-cache + +busybox rm /data/app-private +busybox cp -r /system/sd/app-private /data +busybox chmod 777 /data/app-private + +echo "OK. Reboot? (y/n)" +read y + +if [ $y = "y" ] +then + echo "Rebooting... Please Wait..." + reboot +fi + +exit 1 diff --git a/restore_io.sh b/restore_io.sh new file mode 100644 index 0000000..67a02c6 --- /dev/null +++ b/restore_io.sh @@ -0,0 +1,31 @@ +#!/system/bin/sh + +#scripted by gnh1201 at gmail dot com + +echo "Restore I/O App2SD NILFS2 for XT720" +echo "This script may damage your system. Continue? (y/n)" +read y + +if [ $y != "y" ] +then + echo "Canceled." + exit 1 +fi + +echo "Please Wait..." + +mount -t yaffs2 -o rw,remount /dev/block/mtdblock6 /system + +busybox rm /data/data +busybox cp -rp /system/sd/data /data + +echo "OK. Reboot? (y/n)" +read y + +if [ $y = "y" ] +then + echo "Rebooting... Please Wait..." + reboot +fi + +exit 1 diff --git a/xbin/mkfs.nilfs2 b/xbin/mkfs.nilfs2 new file mode 100644 index 0000000..e4e0d51 Binary files /dev/null and b/xbin/mkfs.nilfs2 differ diff --git a/xbin/nilfs_cleanerd b/xbin/nilfs_cleanerd new file mode 100644 index 0000000..1256596 Binary files /dev/null and b/xbin/nilfs_cleanerd differ