Things that need to be done before starting.
Have the Android SDK installed (or droidexplorer if you're on windows for adb, as I've got the sdk this howto uses adb on the command line.)
Root the device. This goes without saying, Z4Root is recommend.
Install busybox, this could be done by simple download a busybox installer from the android market
Step 1: Prepairing the SD card.
Note: I have an 8gb sd card, so my examples use this in mind.
Using which ever partitioning program you wish to use, create two partitions on your sd card.
Partition 1 is 7GB and is fat 32 formatted.
Partition 2 is 1GB and is not formatted (we will do this later on the device.)*
*in my case I've mucked up and my ext2 partition is only 400Mb
Now place the sdcard back into the device and boot.
We need to make an ext2 file system on the second partition. This is done via the command line on
the device. So fire up the adb shell
./adb shell
Type the command su to get root privilages, then type the following command:
busybox mke2fs /dev/block/vold/179:2This will output some data. Once done on the second partition we now have an ext2 file system.
Once this is all done the SD Card is ready.
Step2: Mounting the card, and moving data to the card.
For this step we need to mount the /system partition as read write as this partition is normally
mounted read only. To do this run the following command:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system mkdir /system/sdThen we need to mount the ext2 partition and we can do this via this command:
mount -t ext2 /dev/block/vold/179:2 /system/sdWe need to now copy the data from the data directory to the ext2 partition, as we want to preserve
permissions we're going to use the command tar (cp can preserve partitions, but I've had more issues
with cp not working correctly in busybox I prefer tar:
cd /data/ tar -cvf /system/sd/app.tar app tar -cvf /system/sd/data.tar data tar -cvf /system/sd/dalvik-cache.tar dalvik-cache cd /system/sd tar -xvf app.tar tar -xvf data.tar tar -xvf dalvik-cache.tar rm *.tar
Step 3: scripts and cleanup.
To mount the ext2 filesystem at boot, we need two scripts. These both go into /system/etc
The first one is called install-recovery.sh and contains the following:
#!/system/bin/sh # /system/etc/init-sd.sh& The next is called init-sd.sh and contains the following: #!/system/bin/sh # MYLOG=/data/install-recovery.log echo "$(date) Starting install-recovery.sh" > $MYLOG echo "$(date) Waiting SD to become ready..." >> $MYLOG sleep 10 mount -t ext2 /dev/block/vold/179:2 /system/sd 1>>$MYLOG 2>>$MYLOG mount -o bind /system/sd/app /data/app 1>>$MYLOG 2>>$MYLOG mount -o bind /system/sd/data /data/data 1>>$MYLOG 2>>$MYLOG mount -o bind /system/sd/dalvik-cache /data/dalvik-cache 1>>$MYLOG 2>>$MYLOG mount >> $MYLOG echo "$(date) Finishing install-recovery.sh" >> $MYLOGnow you need to use a decent text editor (I like vi) on windows I reccomend notepad++
copy both of these into /system/etc
for example:
cp /sdcard/install-recovery.sh /system/etc
cp /sdcard/init-sd.sh /system/etc
Now we need to make sure these files are executable with the following commands:
chmod 755 /system/etc/install-recovery.sh chmod 755 /system/etc/init-sd.shFinally, we need to remove everything in the existing /data/app /data/data/ and /data/dalvik-cache
with the following commands:
cd /data/app busybox rm -rf * cd /data/data/ busybox rm -rf * cd /data/dalvik-cache busybox rm -rf *now you will notice some odd things happening on the screen of your tablet but that will be fixed
with the command:
rebootand if all went well you now have all your applications on the sdcard.
0 comments:
Post a Comment