[PRJ] apps2sd discussion

ivyvisors

Senior Member
Dec 29, 2010
233
52
Hi everyone,

I've sat down and written a new "how to" for the apps to sdcard process we've been talking about over the last week or two.

I've written this for people using a windows machine (I'm generally more of a UNIX type so hopefully this will make it easier.

Now as this is going to be a bit big, I'm going to split it over a few posts. So hopefully it will read properly.

If people find issues, typos, outright mistakes, Ivy loosing her mind, or anything like that please tell me and I will correct it. Once we've got all of the process ironed out, I will start a new thread which we can then sticky.

Regards,
Ivy
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
This "howto" is for the Australian version of the S7 Branded the Telstra T-Touch Tab. This version of the Huawei S7 doesn't have the internal sd card. Which means that certain "mount points" are not going to be the same as an S7 with the internal card and when the external sd card is inserted. This can make things a little difficult.

Also this howto requires some basic unix knowledge, I will try and explain things as I go on so that anyone can do this.

Needed Software:

On the tablet:
z4root. This can be found on the xda developers forums.
Titanium Backup. This can be found via the market.

On your PC:
Droid Explorer or the Android SDK (for adb).
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
To make things easier I would recommend flashing your tablet first. For the purpose of this howto I'm
using the S7V100R001C60B011 firmware.

The link for this can be found here:
http://www.androidtablets.net/forum/huawei-ideos-s7-development/5484-rom-official-huawei-ideos-s7-firmware.html

To flash the firmware, format an sdcard using the tablet, and then create a folder called dload, and place the files in this folder, place the sdcard back into the tablet, and reboot the tablet.

You should see the lights on your S7 flash and a progress bar on the screen. Once it's complete you should see an OK under the progress bar. Now we can't use the power button here so what we need to do is remove the battery (and the sdcard with the firmware otherwise we will end up flashing it again!) and put the battery back in and let the tablet reboot.

Rooting the tablet.

To install z4root, we need to allow installation of applications from Unknown Sources, Open settings click on Application Settings, and tick "Unknown Sources". Click back, and then click on Development and tick usb debugging.

Place a copy of the z4root package on your sdcard and then open the package using the file explorer. Once installed, run z4root and choose perminent root, the tablet will reboot at this point, and will be rooted.

Now we need to install TitaniumBackup, the reason for installing this is to get a known good version of busybox, busybox gives us access to more unix commands that will be useful later. Once installed just follow the prompts.
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
The sdcard needs to be broken up into two partitions, the first is for your "general" storage. The second needs is for your application storage.

To make things easier, I used a program (which was free) called Easus Partiton manager, to partition and format the tablet.

The first partition needs to be fat32, the second ext2.
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
With our patitioned sd card, lets boot the tablet, and using either the shell option in Droid explorer, or the adb shell command, we now need to set up some things to get things ready.

The first thing we need to do is mount the /system partition read write. That can be done with the following command:

mount -t yaffs2 -o rw,remount /dev/block/mtdblock1 /system

Now that system is read write, we're going to do a few things to make life easier for us.

Busybox:

Busybox, is a program that contains a number of "shell commands", to access these commands we'd normally type something like:

busybox top

Now we can avoid having to type busybox <command name>, we can use the unix command ln (link) to create links, so you can type the command without having to prefix it with busybox.

So, change directory to the /system/bin directory, to do this issue the following command:

cd /system/bin

Now we create the links we need.

ln -s busybox cp
ln -s busybox dos2unix
ln -s busybox grep
ln -s busybox less
ln -s busybox more
ln -s busybox tar
ln -s busybox vi


Once this have been done, cd back to the system directory by typing:

cd /system/

Now we need to make our mount point:

mkdir sd


Once this has been done, mount the ext2 partition with:

mount -t ext2 /dev/block/vold/179:2 /system/sd

issuing the mount command will show you if it's mounted or not.
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
Now we need to start copying over the contents of /data to different directories on our new partition.

There are two ways to do this, either using cp, which could cause issues with permissions. Or use tar, which will preserve permissions.

There are three major directories that we want to move:

/data/app/ this is the application storage directory
/data/app-private/
/data/dalvik-cache/ the cache directory
/data/data/

To do this we will issue the following commands:

cd /data/
tar -cvf /system/sd/app.tar app/
tar -cvf /system/sd/app-private.tar app-private/
tar -cvf /system/sd/dalvik-cache.tar dalvik-cache/
tar -cvf /system/sd/data.tar data/

Now, we need to unpack these:

cd /system/sd/
tar -xvf app.tar
tar -xvf app-private.tar
tar -xvf dalvik-cache.tar
tar -xvf data.tar

Now we need to remove the old data, and then bind mount the directories to their correct places in the data partition.

cd /data/app
busybox rm -rf *
cd ..
mount -o bind /system/sd/app /data/app

As this is a clean install there shouldn't be anything in app-private but it's better to check

cd /data/app-private
busybox rm -rf *
cd ..
mount -o bind /system/sd/app-private /data/app-private

Now the dalvik cache

cd /data/dalvik-cache/
busybox rm -rf *
cd ..
mount -o bind /system/sd/dalvik-cache /data/dalvik-cache

now the data directory

cd /data/data/
busybox rm -rf *
cd ..
mount -o bind /system/sd/data /data/data
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
If we issue the mount command we should see something like:

rootfs / rootfs ro 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
/dev/block/mtdblock1 /system yaffs2 rw 0 0
/dev/block/mtdblock6 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock5 /cache yaffs2 rw,nosuid,nodev 0 0
/dev/block//vold/179:1 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,flush 0 0
/dev/block/vold/179:2 /system/sd ext2 rw 0 0
/dev/block/vold/179:2 /data/app ext2 rw 0 0
/dev/block/vold/179:2 /data/app-private ext2 rw 0 0
/dev/block/vold/179:2 /data/dalvik-cache ext2 rw 0 0
/dev/block/vold/179:2 /data/data ext2 rw 0 0


Now we need to automate the mounting of these partitions during boot.

For this to occur we need two scripts to be placed in /system/etc/

The first script is called install-recovery.sh as the tablet looks for this script at boot time, we use this to call another script called init-sd.sh to mount the second partition on the sdcard, and then bind mount the directories in the data partition.

the first script contains the following

#!/system/bin/sh
/system/etc/init-sd.sh&


The second script contains:

#!/system/bin/shsleep 10
mount -t ext2 /dev/block/vold/179:2
mount -o bind /system/sd/app /data/app
mount -o bind /system/sd/app-private /data/app-private
mount -o bind /system/sd/dalvik-cache /data/dalvik-cache
mount -o bind /system/sd/data /data/data

so using a good text editor, such as notepad ++, we need to make these two scripts and then get them on to the tablet.

We could either mount the sdcard on your windows machine, or use Droid explorer, or adb push to put these on to the sdcard

Once they are on the sd card, we need to move them to the correct place and also as we've been editing these files on a windows machine, make sure that the line breaks are good and correct.

To do this we need to issue the following commands:

cd /sdcard
dos2unix install-recovery.sh
dos2unix init-sd.sh

Now we copy both of these files to the /system/etc/ folder

cp install-recovery.sh /system/etc
cp init-sd.sh /system/etc

Next we need to make sure both these files are able to be run at boot, by issuing the following command:

chmod 755 /system/etc/install-recovery.sh
and
chmod 755 /system/etc/init-sd.sh

Now we reboot the tablet, and hopefully everything has worked, we can do this quickly via the adb
shell with the reboot command

reboot

If all has worked correctly, everything will be up and running.

so using a good text editor, such as note pad ++, we need to make these two scripts and then get them on to the tablet.

We could either mount the sdcard on your windows machine, or use Droid explorer, or adb push to put these on to the sdcard

Once they are on the sd card, we need to move them to the correct place and also as we've been editing these files on a windows machine, make sure that the line breaks are good and correct.

To do this we need to issue the following commands:

cd /sdcard
dos2unix install-recovery.sh
dos2unix init-sd.sh

Now we copy both of these files to the /system/etc/ folder

cp install-recovery.sh /system/etc
cp init-sd.sh /system/etc

Next we need to make sure both these files are able to be run at boot, by issuing the following command:

chmod 755 /system/etc/install-recovery.sh
and
chmod 755 /system/etc/init-sd.sh

Now we reboot the tablet, and hopefully everything has worked, we can do this quickly via the adb shell with the reboot command

reboot

If all has worked correctly, everything will be up and running.
 

blade111

Member
Jan 14, 2011
50
0
General Notes for apps to sd

This "howto" is for the Australian version of the S7 Branded the Telstra T-Touch Tab.​


What are the steps if its not Australian but American? Would love a video tut on this but I know your super busy and I do appreciate all the hard work you do for all of us!!!
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
Hi Blade111, This is only an issue with the devices with the inbuilt SDcard. As my s7 doesn't have this installed, it makes it quite difficult to test.

The big issue that the block device i.e. /dev/block/vold/179:2 changes when the the other sd card is in or not (in the tablets with the internal sdcard.)

As it's hard to script for this and I don't have a device with the internal sd card. It's hard for me to make my scripts work with these tablets.

~Ivy
 

blade111

Member
Jan 14, 2011
50
0
Hi Ivyvisors,

Thanks for getting back. So I guess I have to wait it out???? If they do update the Android to 2.2 will the fix that problem?
 

ivyvisors

Senior Member
Dec 29, 2010
233
52
Well 2.2 does support apps2sd. So it might be best to wait for that.

Unfortunately what we're doing here is a complete hack and a half, so when 2.2 comes out it will be a lot easier.

~ivy
 

pvella

Senior Member
Dec 20, 2010
392
38
The steps where documented by kevmeuller in this thread. It should be very similar except the mount device number is different.

Sent from my Ideos S7
 

pvella

Senior Member
Dec 20, 2010
392
38
My understanding is that 2.2 will only allow apps2sd for apps written to support it. The S7 has a small memory footprint and might still need this mod even after 2.2.

Sent from my Ideos S7
 
Top