[PRJ] apps2sd discussion

Here is the issuer i have... a2sd is working... but i have to remount the partitions manually after every boot via adb.

It is not processing my install-recovery.sh

I have been over it and over it and over it. I am running the Telstra version of the tab that has no insternal SD card installed.

I go into /data/ to check the log file, and there is none, it is if the file isnt even being run at init. Is there a way i can reboot and enable boot logging to see whats happening ? and why init.rc is not even running this script...

inb4: permissions are wrong, SD card formatted wrong, spelling is wrong. as i said, it works if i manually mount the partitions, just for some reason it wont auto mount from the init.rc via install-recovery.sh

Could it be that permissions are set wrong on /data to enable logging so it just stops at the first line ? will try to enable log to SDcard and see if it tells me anything....
 
What I did was use a program called gparted to set up the partitions on the sdcard.

GParted -- Download

The machine seems much faster now that it has breathing space for apps. I am very happy with the installation.

OK so I used GParted, set the primary to FAT32 created an unformated 1MB partion and am still getting the file not found on the first busybox commad. I tried both a 16G card and also tried with the internal SD, and am getting this with both, wonder what is wrong. Using busybox from Titanium. Any suggestions appreciated.

Update - Changed the partition from logical unformated to primary unformated and got everything to work except the script part...... still trying :)
Update 2 - I now have my apps on the SD card!!!
 
Last edited:
Here is the issuer i have... a2sd is working... but i have to remount the partitions manually after every boot via adb.

It is not processing my install-recovery.sh

...

I had the same problem. You have to edit the files using something other than windows. I found even Notepad++ did not put the correct end of line command in the files. When I loaded my files in Linux, using vi, I could see a ^M at the end of each line. You might be able to use some sort of dos2linux command.
 
Could some upload the 2 sh files

Do we have somewhere on here to host a couple of small text files. I am happy to email my ones to someone. Or just message me with your email address and I will mail them from my device.
 
I just noticed a mistake in my post with all of the instructions, where for the second script I'd cut and pasted a few lines into the second script that shouldn't be there, and could cause all sorts of drama. Here is a new version of the howto. I will upload this and the scripts to my website in a second.


applications to sd for 2.1 focusing on the Huawei S7

Note: this how to expects some unix or gnu/linux know how.

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, I reccomend Z4Root.

Install Busybox. I've used Titanium Backup to do this for me (via the problems menu).

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:2

This 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

Next run this command:

mkdir /system/sd

Then we need to mount the ext2 partition and we can do this via this command:

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

We 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/
busybox tar -cvf /system/sd/app.tar app
busybox tar -cvf /system/sd/data.tar data
busybox tar -cvf /system/sd/dalvik-cache.tar dalvik-cache

cd /system/sd

busybox tar -xvf app.tar
busybox tar -xvf data.tar
busybox 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" >> $MYLOG

now 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 /sdcard/etc/install-recovery.sh
chmod 755 /sdcard/etc/init-sd.sh

Finally, 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:

reboot

and if all went well you now have all your applications on the sdcard.

~Ivy
 
Last edited:
......

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

......

I think this bit should read....

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

cd /system/sd

busybox tar -xvf app.tar
busybox tar -xvf data.tar
busybox tar -xvf dalvik-cache.tar

On windows I don't think the adb command supports tar directly. I am still in the process of switching to Ubuntu for my development, but I think a lot of people run windows.
 
Last edited:
Awesome work. Now we just need to think about how we can automate any of this.

I notice on other platforms that they have written a ".zip" file that gets run automatically from the sdcard to do an update. We need to look at what is the best way to do an update to the s7.

Under the "Location and Security" settings, there is an option to "Install from SD Card", it is looking for a ".p12" file. Does anyone know what this is?
 
i also own a moto backflip and we have app2sd on that automated using darktremor apps2sd...not sure but maybe it would work on here also

Sent from my S7 using Android Tablet Forum App
 
Hi Daz,

I will have a look at it and see if it will work, will need to flash my s7 first. To send it back to stock.

~Ivy
 
Back
Top