[INIT.D][10-05-2012]Super APP2SD Script [MAJOR UPDATE][BETA] - Galaxy Note 10.1 Android Development

UPDATES, WARNINGS, AND INSTALLATION STEPS ARE AVAILABLE IN THE 2ND POST
WHAT DOES THIS SCRIPT DO?
* It is the only method, that I am aware of to have apps trully run, and be installed directly to the external storage without completely switching the internal storage with the external storage.
This bings different benefits to different people:
1 - If you have a device that comes from factory with only a small amount of storage available, you can now install as many apps, and apps as big as the partition you setup to use with this script. For example, if you have a phone with only 512 MB of app storage, you can now install games that take over 1GB of app storage so long as your external partition has the space available.
2 - If you bought a 16GB device and wish you had bought a 32GB device, this is great for you as well (I'm one of these). With this script, your apps will not take up any space in your internal storage, which means that your 16GB (or whatever is left of it after factory partitioning, 11.66 GB in my case) is now available for pictures, videos, downloads, backups, or whatever else you might want to put there or have easy access to when you connect your device to your computer.
3 - If you have a lot of Android games, this is great for you too, specially if you're playing games that take a lot of space. Just get a large MicroSD (I have a 64GB partitioned to 32/32) and put as much space as you need in the second partition, and now you can have all your games intalled at the same time. No need to keep uninstalling games so that you can install other ones.
* Once and Done, across the board setup. That's right, launchers, keyboards and widgets will run from the external storage natively, something never done before in Android as far as I know.
This means that once you have the script up and running, you're good to go until the next time you reflash your /system partition. No need to choose what apps to move. No symlinks or anything. Your apps now belong in the external storage, plain and simple.
* No need to backup all your stuff before running the script (and eventually no need to back up your stuff when you want to disable it either).
That's right, the script does the hard work for you. All your stuff gets safely moved to the external storage, with all ownerships and permissions intact. It all happens so smoothly that some people have a hard time telling that the script is already at work. Nothing gets deleted from the internal storage until you're certain that everything is working as expected either. So even if something goes wrong, as long as you have ADB, all your stuff can go back to normal without a problem
(Even though you don't have to backup and restore in order to get the script going, it's always greatly recommended that you keep a backup of your apps).
* Simple intallation:
To get the script going all you have to do is download it, extract it, and run 3 commands in the terminal. It will then ask you a couple of questions, and then you'll be all set. The one downfall is that because the script requires user input (no, the required information cannot be picked from a list), the script cannot be run from a recovery zip. However, I'll emphasize once again that it only takes 3 commands to get the script going.
Also, the script comes with an options file that allows you to setup device specific variables, making the script malleable to work on just about any Android device. Just open the USER_OPTIONS file before runing the install script, and as long as you have the variables there set correctly, the script should be compatible with your device.
* You can still use the external partition for other stuff if you want to. Just remember that it's mounted to /mnt/sd-ext (or /storage/sd-ext in JB). So if you still have a ton of space left in the partition and need the space, you can still use it. Just ensure not to touch the folders Android, app and data.
* Now this is a bit more technically, but in theory, you could a third partition for this script instead of the second partition, and then still be able to use app2sd solutions, though personally I don't see what advantage there would be to doing this since apps would still be in the external storage no matter what.
WHAT DOES THIS SCRIPT NOT DO?
*** IT CANNOT BE CONVERTED INTO A RECOVERY ZIP DUE TO USER INPUT REQUIREMENT ***
*** YOU CANNOT PICK AND CHOOSE WHAT APPS TO MOVE, THAT'S PLAIN AND SIMPLE NOT THE PURPOSE OF THIS SCRIPT ***
SCREENSHOTS
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Above you can see my storage screen. If you add the amount of used space and the amount of available space, it's ~18 GB, well over the available 11.66GB in the internal storage. Also note that when the script is enabled, the bar displaying storage usage is unreliable. All other information is reliable, including, and most importantly, the amount of available free space.
Above you can see the output of some commands in the terminal. The most important part of the output for mount above are
Code:
/dev/block/mmcblk0p12 on /mnt/temp/data type ext4 (rw,relatime,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,discard)
/dev/block/mmcblk1p2 on /mnt/sd-ext/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
As you can see, mmcblk1p2, the external storage, is mounted to /data/app, /data/data and /data/media/Android, which means that as far as Android is concerned, those folders are in the external storage. Also note that all these mounts took place before /sdcard itself was mounted, meaning that the script is ensuring that these mounts take place soon enough in the boot process to avoid problems related to mounting the app storage locations after Android has loaded the available apps.
Finally, the fact that mmcblk0p12 is mounted to /mnt/temp/data is important because of the next two commands
The output of du -sh shows the amount of storage used by a folder, and as such because the internal storage is mounted to /mnt/temp/data;
/mnt/temp/data/app = internal /data/app = 8KB
/mnt/temp/data/data = internal /data/data = 72KB
/mnt/temp/data/media/Android = internal /data/media/Android = 4KB
whereas
/data/app = 1GB
/data/data = 624.3 MB
/data/media/Android = 5.6 GB
For a grand total of 7.22 GB of used app storage in the external storage as opposed to 84 KB in the internal storage.
CREDITS
*smaw51 - Testing
*ArangeLTX - Testing and Debugging
*Laggan - Testing
*aadiflesher - Testing
*Others who tested the script but weren't in direct contact with me.
*People who said it wasn't possible to run widgets, launchers and keyboards from External Storage (They provided the challenge I needed to make this work)
If anybody needs help or if anything doesn't work, I'll help through irc (much quicker than posting here) on freenode - #and-host

UPDATES:
09-26-2012: Major Update, Overhauled most of previous code.
09-27-2012: Found badass typo in one of the files, fixed and uploaded correction.
09-27-2012: Added install Script.
10-02-2012: Corrected install script so that things now run properly. Don't forget to double check USER_OPTIONS and set ENABLED=true
10-02-2012: Added MMCBLKXPX variable to user options so now devices that mount SD-EXT to different block can use script easily.
10-03-2012: More fixes to the install script, also added check for storage location as well as user input. Started working on compatibility for devices where /sdcard/Android is in different partition from /data
10-03-2012: Updated this post with more organized information.
10-04-2012: Modified script so that debugging output works properly in JB
10-05-2012: Finished working on compatibility for devices with /sdcard and /data in different partitions (PENDING TESTING)
10-05-2012: Added automatic detection for such devices ^ (New variable is automatically created in USER_OPTIONS, called fukedupFS)
10-05-2012: Added extra security for $deletepostmove (Will not take effect until stage 3 is detected)
10-05-2012: Added switch on install script to do a clean install, (using sh ./install-a2sd -clean) which will erase all current options/vars and reset stage to 0.
WARNINGS:
1 - PROCEED WITH THE FOLLOWING STEPS AT YOUR OWN RISK. IF ANYTHING BREAKS I'LL GLADLY TRY TO HELP (IF I CAN), BUT YOU DO WHAT YOU DO AT YOUR OWN RESPONSIBILITY.
2 - THE INSTALLATION SCRIPT REQUIRES USER INPUT, WHICH MEANS THAT IT CANNOT BE MADE INTO A RECOVERY ZIP. DO NOT BOTHER TO ASK FOR ONE. IF YOU CAN'T LEARN HOW TO USE THE TERMINAL, THEN JUST STICK TO OTHER SUCKY APP2SD SOLUTIONS.
3 - THIS SCRIPT IMPLEMENTS INIT.D BY DEFAULT, IF YOU ALREADY HAVE INIT.D FUNCTIONALITY MAKE SURE TO CHANGE:
Code:
/system/bin/logwrapper busybox run-parts /system/etc/init.d
TO
Code:
# /system/bin/logwrapper busybox run-parts /system/etc/init.d
IN THE B]sysinit[/B] FILE.
4 - THIS SCRIPT IMPLEMENTS INIT.A, WHICH IS ESSENTIALLY LIKE INIT.D, BUT HAPPENS EXTREMELY EARLY AT BOOT TIME, IT IS SUGGESTED THAT REGULAR USERS DO NOT PUT ANY SCRIPTS IN INIT.A UNLESS THEY KNOW WHAT THEY'RE DOING, JUST USE INIT.D FOR OTHER SCRIPTS.
5 - UPDATE YOUR BUSYBOX TO THE LATEST VERSION (1.20.2 AT THE WRITING OF THIS). SOME EARLIER VERSIONS OF BUSYBOX ARE KNOWN TO NOT HAVE SOME OF THE REQUIRED SWITCHES FOR THE COMMANDS USED IN THE SCRIPT.
6 - AT THIS POINT THE SCRIPT REQUIRES THAT YOU HAVE A SECOND PARTITION IN YOUR MICROSD FORMATTED TO EXT4, ANYTHING ELSE WILL NOT WORK. THIS MAY CHANGE IN THE FUTURE, BUT AT THIS POINT IT'S A REQUIREMENT.
7 - FULLY READ THE INSTALLATION INSTRUCTIONS, MORE THAN ONCE IF POSSIBLE, BEFORE RUNNING THE SCRIPT. FAILING TO COMPREHEND WHAT'S GOING ON CAN POSSIBLY LEAVE YOUR DEVICE SEMI-BRICKED/CAUSE MAJOR HAVOC AND FORCE-CLOSES AND YOU'LL HAVE TO RESTORE A BACKUP. MORE THAN ANYTHING MAKE SURE TO BACKUP YOUR APPS.
INSTALLATION:
1 - Download the attached file on your device or PC.
2 - Extract the files and move it to an easy to access location in your device, such as /sdcard. Open USER_OPTIONS and ensure that all variables correctly apply to your device, LEAVE deletepostmove='false' until later. Set ENABLED='true' once you're reviewed everything.
3 - Open a terminal app (Rom Toolbox and such probably won't work because the script requires user input)
4 - Assuming that you moved all 6 files to /sdcard, execute the following commands in the terminal:
Code:
su
cd /sdcard
sh ./install-a2sd
You can also perform a clean install by using the command:
Code:
sh ./install-a2sd -clean
5 - The script will ask a couple of questions, answer them (ask someone for help if you're not sure).
6 - If all went well (The script will tell you that folders were created, files were copied and permissions were set) you'll be told that upon pressing enter your device will be rebooted. Press ENTER when ready or reboot manually if it fails to reboot on its own.
7 - STAGE 1 - NOTHING WILL HAVE NOTICIABLY CHANGED UPON THE FIRST REBOOT. This is normal. The first reboot will only garther many variables needed for the script to run properly, it will also give the opportunity to review the variables and ensure that everything is ok, so that you can disable the script in case the gathered variables are not correct, so that things don't get broken unecessarily. Please take a look at:
Code:
/sdcard/Tweaked.Scripts/A2SD/options/vars
If all looks good in there (even if you don't understand what the variables are for, ensure that the paths make sense, don't worry if you don't have /mnt/sd-ext and /mnt/temp, or /storage/sd-ext and /storage/temp as these will be created).
Reboot again after reviewing the variables.
8 - STAGE 2 - ONCE AGAIN, WHEN YOU REBOOT, NOTHING WILL APPEAR TO HAVE HAPPENED. In fact, this is not the case this time. If all variables were correct in STAGE 1, every app along with their data and files will have started to be copied over to the external storage as soon as the device finished booting. You should be able to see the process for this by opening the terminal and running the command:
Code:
logcat | busybox grep "01a2sd"
You can also run the following command in the terminal to ensure that there are extra mounts that did not exist prior:
Code:
mount
***THIS IS THE MOST IMPORTANT STEP IN THE PROCESS. MAKE SURE THAT YOU DO NOT REBOOT YOUR DEVICE UNTILL THE FOLLOWING FILE IS CREATED:
Code:
/sdcard/Tweaked.Scripts/A2SD/DEVICE_IS_READY
Failing to do so is the single worst mistake that you can do. Rebooting the device before the copying is done might cause all your apps to look like they're not installed, as well as major FCs, to the point where stuff is unusable and you have to restore a backup.
Just be patient during this step, specially if you already have a lot of apps installed, even more so if you have games that use a large amount of space.
9 - STAGE 3 - After rebooting from STAGE 2, the device will mount the external storage in every location where apps would reside in the internal storage. This is why it's extremely important that STAGE 2 is completed properly, because unless everything has been moved properly, files that were not copied will seem like they don't exist, possibly causing FCs and major havoc.
If everything went ok, it will actually look like nothing happened, but in fact, everything should be running from the external storage. You can confirm this by running the following command in the terminal:
Code:
mount
You should see three mounts that weren't there before that look like
Code:
/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
At this point, it should be safe to open USER_OPTIONS in /sdcard/Tweaked.Scripts/A2SD/options and change deletepostmove='true'. Just remember that with this variable set on, all your apps will be wiped from external storage. This means that if you reboot without your MicroSD or if you lose the stuff in the MicroSD your alls will be gone. Becase of this, ensure that you have your apps backed up somewhere.

TweakerL said:
To install, download attached file (then rename it to 01a2sd) or copy code and save it to (01a2sd).
Copy the file to /system/etc/init.d (Can be done with any file manager that has root access)
Change permission to 755 (Can be done with most file managers with root access)
Change Options in script to your liking.
Enjoy the extra storage after reboot.
Code:
#! /system/bin/sh
########################################################################################################
########################################################################################################
## ##
## Super APP2SD by TweakerL ##
## Visit us at http://and-host.com ##
## Chat with us on freenot at #and-host ##
## ##
########################################################################################################
########################################################################################################
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
########################################################################################################
## Options #############################################################################################
## ##
## Feel free to change these: ##
## ##
## moveAndroid: Moves /sdcard/Android to external storage. ##
## moveApps: Not yet implemented ##
## moveData: Not yet implemented ##
## ##
## deletepostmove: If 'true ' Deletes files from internal storage after they have been moved. ##
## ##
## pruneoldlogs: If 'true' Deletes logs older than X hours set in prunehoursold. ##
## prunehoursold: If 'X' greater than 0 logs older than X hours will be deleted ##
## If 'X' equal 0 all logs will be deleted ##
## ##
## debugging: If 'true' files will be created in /sdcard for debugging purposes ##
## ##
moveAndroid='true' ##
##
deletepostmove='true' ##
##
pruneoldlogs='true' ##
prunehoursold='1' ##
##
debugging='false' ##
########################################################################################################
########################################################################################################
## Constants ###########################################################################################
## ##
## Don't touch these unless you're told to by someone who knows what they're doing: ##
## ##
append_android='/Android' ##
append_data='/data' ##
append_obb='/obb' ##
append_ext4='/ext4' ##
append_tweaked='/Tweaked.Scripts' ##
append_movethis='/movethis.txt' ##
append_temp='/temp' ##
append_media='/media' ##
append_A='A' ##
append_logs='/logs' ##
##
data='/data' ##
########################################################################################################
########################################################################################################
if [ -f /sbin/busybox -o -f /system/sbin/busybox -o -f /system/xbin/busybox -o -f /system/bin/busybox ]
then
has_busybox='true'
fi
if busybox blkid | busybox egrep -i "mmcblk1p2" > /dev/null
then
has_mmcblk1p2='true'
fi
if busybox blkid | busybox egrep -i "mmcblk1p2" | busybox awk '{print $4}' | busybox cut -f2 -d'"' > /dev/null
then
is_ext4='true'
fi
if [ $has_busybox == 'true' -a $has_mmcblk1p2 == 'true' -a $is_ext4 == 'true' ]
then
# DEBUGGING
# Get vars part 1
if [ $debugging == 'true' ]
then
set > /sdcard/vars.1
fi
# END DEBUGGING
# Start defining functions
makedir () {
if [ ! -d $1 ]
then
busybox mkdir -p $1
fi
busybox chmod $2 $1
busybox chown $3:$4 $1
}
# End defining functions
mnt_sd=$( busybox mount | busybox egrep -i '/sdcard' | busybox awk '{print $3}' )
mnt=$( busybox dirname $mnt_sd )
sd_uid=$( busybox ls -ln $mnt_sd | busybox egrep -i "Android" | busybox awk '{print $3}' )
sd_gid=$( busybox ls -ln $mnt_sd | busybox egrep -i "Android" | busybox awk '{print $4}' )
blk_ext4=$( busybox ls -lR /dev | busybox egrep -i "mmcblk1p2 ->" | busybox awk '{print $11}' )
blk_data=$( busybox mount | busybox egrep -m 1 '/data' | busybox awk '{print $1}' )
mnt_ext4=$mnt$append_ext4
ext_data=$mnt_ext4$data
ext_android=$ext_data$append_android
mnt_temp=$mnt_ext4$append_temp
temp_android=$mnt_temp$append_media$append_android
datetime=$( busybox date -Iseconds )
sd_android=$mnt_sd$append_android
sd_tweaked=$mnt_sd$append_tweaked
tweaked_logs=$sd_tweaked$append_logs
txt_movethis=$sd_tweaked$append_movethis
makedir $sd_tweaked 775 $sd_uid $sd_gid
data_media=$( busybox dirname $( busybox find /data -type d -follow -name 'Tweaked.Scripts' ) )
data_android=$data_media$append_android
data_uid=$( busybox ls -lnd $data | busybox awk '{print $3}' )
data_gid=$( busybox ls -lnd $data | busybox awk '{print $4}' )
android_uid=$( busybox ls -ln $data_media | busybox egrep -i "Android" | busybox awk '{print $3}' )
android_gid=$( busybox ls -ln $data_media | busybox egrep -i "Android" | busybox awk '{print $4}' )
# DEBUGGING
# Get vars part 2
if [ $debugging == 'true' ]
then
set > /sdcard/vars.2
busybox diff /sdcard/vars.1 /sdcard/vars.2 | busybox grep "+" | busybox egrep -v "@|_=" > /sdcard/vars.txt
fi
# END DEBUGGING
busybox chmod 775 $sd_tweaked
busybox chown $android_uid:$android_gid $sd_tweaked
makedir $tweaked_logs 775 $sd_uid $sd_gid
echo 'Logging Started' > $tweaked_logs/a2sd-$datetime.log
echo '' >> $tweaked_logs/a2sd-$datetime.log
busybox mount -o remount,rw /
makedir $mnt_ext4 775 $data_uid $data_gid
busybox mount $blk_ext4 $mnt_ext4
sleep 1
makedir $mnt_temp 775 $data_uid $data_gid
busybox mount $blk_data $mnt_temp
sleep 1
makedir $ext_data 775 $data_uid $data_gid
makedir $ext_android 775 $android_uid $android_gid
busybox mount -o bind $ext_android $data_android
sleep 3
busybox mount -o remount,ro /
if [ $moveAndroid == 'true' ]
then
busybox find $temp_android -type f -follow -print > $txt_movethis
fi
if [ $moveAndroid == 'true' ]
then
echo 'Copying files from internal storage to external storage\n' >> $tweaked_logs/a2sd-$datetime.log
while read line
do
source=$line
destappend=$append_A$( echo "$line" | busybox cut -f2-100 -d'A' )
dest=$ext_android/$destappend
destfolder=$( busybox dirname $dest )
if [ ! -f "$dest" ]
then
if [ ! -d "$destfolder" ]
then
busybox mkdir -p "$destfolder"
fi
busybox cp -pdf "$source" "$dest"
if [ -f "$dest" ]
then
echo -e $source'\ncopied to\n'$dest'\n' >> $tweaked_logs/a2sd-$datetime.log
else
echo -e 'Failed to copy: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
fi
else
echo -e 'Already exists: '$dest'\n' >> $tweaked_logs/a2sd-$datetime.log
fi
if [ $deletepostmove == 'true' ]
then
if [ -f "$dest" ]
then
busybox rm -f "$line"
if [ ! -f "$line" ]
then
echo -e 'deletepostmove = true - Deleted: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
echo -e '____________________________________________________________ ' >> $tweaked_logs/a2sd-$datetime.log
else
echo -e 'Failed to delete: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
echo -e '____________________________________________________________ ' >> $tweaked_logs/a2sd-$datetime.log
fi
fi
fi
done < $txt_movethis
busybox rm -f $txt_movethis
busybox chmod -R 775 $ext_android/*
busybox chown -R $android_uid:$android_gid $ext_android/*
fi
busybox umount $mnt_temp
if [ $pruneoldlogs == 'true' ]
then
(( prunehours = ($prunehoursold * 60) ))
find $tweaked_logs -mmin +$prunehours -exec rm {} \;
echo "All logs older than "$prunehoursold" hours old have been deleted"
fi
echo -e '\nEnd of Log' >> $tweaked_logs/a2sd-$datetime.log
fi
Click to expand...
Click to collapse
Where to find premission? Please advice.
Sent from my GT-N8000 using xda app-developers app

andylam16 said:
Where to find premission? Please advice.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
use a root file browser then press and hold on the file, select permissions. Change to: Owner (rwx), group and other (rx)
Sent from my GT-N8013 using Tapatalk 2

My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2

lm that guy said:
use a root file browser then press and hold on the file, select permissions. Change to: Owner (rwx), group and other (rx)
Sent from my GT-N8013 using Tapatalk 2
Click to expand...
Click to collapse
Thanks bro, is r = read , w = write , x = ???
Please advice.
Sent from my GT-N8000 using xda app-developers app

andylam16 said:
Thanks bro, is r = read , w = write , x = ???
Please advice.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
Execute
Sent from my GT-N8013 using Tapatalk 2

lm that guy said:
Execute
Sent from my GT-N8013 using Tapatalk 2
Click to expand...
Click to collapse
Got it, thanks!:thumbup:
Sent from my GT-N8000 using xda app-developers app

kaipro said:
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
Click to expand...
Click to collapse
+1

fauzin said:
+1
Click to expand...
Click to collapse
I suggest this thread: http://forum.xda-developers.com/showthread.php?t=1883125
Sent from my GT-N8013 using Tapatalk 2

kaipro said:
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
Click to expand...
Click to collapse
Check link in my sig for my other thread where you can get the init.d enabler.

After did the procedure as mentioned nothing happened the apps still go to the scared not the external. Please advice anything I missed. Thanks
Sent from my GT-N8000 using xda app-developers app
---------- Post added at 10:54 AM ---------- Previous post was at 10:12 AM ----------
One more thing there is a file "99testinit" inside the init.d , do I need to anything about it?
Sent from my GT-N8000 using xda app-developers app

andylam16 said:
After did the procedure as mentioned nothing happened the apps still go to the scared not the external. Please advice anything I missed. Thanks
Sent from my GT-N8000 using xda app-developers app
---------- Post added at 10:54 AM ---------- Previous post was at 10:12 AM ----------
One more thing there is a file "99testinit" inside the init.d , do I need to anything about it?
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
Exactly same as me.
Sent from my GT-N8000 using Tapatalk 2

If you guys read everything, this is still an early version. At the moment, only /sdcard/Android is getting moved, which is the location that stores extra files downloaded by apps, not the apps themselves. If the script is running, you can go on terminal and type:
Code:
df -h
and you should see mmcblk1p2 (which is the ext4 partition in the MicroSD) and how much space is being used, which is the amount of space that should be getting saved from the internal storage. Also, if you look under storage under settings, the amount of space available should have increased considerably, specially if you have a lot of games.
I'll be working on the other two parts throughout this week (moving APK and DATA) Then you will be able to notice a bigger difference, although it will always look like apps are installed in the internal storage, even when they're in the external storage.
The reason for this is because the script works by mounting the external storage to:
/data/app (not yet implemented)
/data/data (not yet implemented)
/data/media/Android (already implemented)
while at the same time copying the contents of those locations from internal to external then wiping them from internal. Essentially when it's all said and done, the OS pretty much thinks that nothing has changed, except that whenever anything gets written to those folders it takes space from the external storage instead of internal.
A good way to test it would be to download a free gameloft game like MIB3 or Six Guns. Take a look at storage before installing. After you install MIB3, your available storage should drop by roughly 500MB, but if you're using the script, even at preview stage, the available storage will only drop by about 30MB, even though storage settings will say that the game takes up ~500MB.
Also, you can mount your normal data partition and take a look at how much space is being used there, as opposed to the external partition like this:
(All the following commands in terminal)
make sure which partition is mounted to /data
# mount
mount data to temp location (assuming data is mmcblk0p12)
# mount /dev/block/mmcblk0p12 /mnt/ext4/temp
check amount of space used in internal storage:
# du -dh /mnt/ext4/temp/media/Android
check amount of space used in external storage
# du -dh /mnt/ext4/data/Android
In the future I'll add to the script a way to automatically calculate the amount of space saved

The script itself is not working. Init.d is working, did rename the file and changed permission. I use script manger and try to run the script but it's got error,
Sent from my GT-N8000 using xda app-developers app

htainlin said:
The script itself is not working. Init.d is working, did rename the file and changed permission. I use script manger and try to run the script but it's got error,
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
I'm gonna be uploading a new version soon with more debugging so I can see why people might have issues.
EDIT - Done updating OP

Is there any recommendations for the partition other than ext4, like swap size and what not? I also assume a reboot is required in order to get it to run right? I am still getting insufficient storage available when updating apps in the play store. I was getting that error before, even though I have plenty of space, like more than 10 gb on the internal memory so I don't know if it is just a batch update issue on the play store with my note for whatever reason. But even individual updates stop with an insufficient storage error.
I have tried using both the attached file in the op as well as the copy and paste method. The file should have no extension once in place right?
It seems as though it is still not working right
I have init.d working, confirmed with the test file and your method, Busybox installed, partitions with 0 swap and 1024 size at ext4
I have not been able to locate a log created, where is it dumped to to see if it is even running the script?
EDIT: never-mind, I figured out why my stuff was't updating but still able to add new apps, in rom tool box, I set it to install to sd card after most of my apps were already put on the internal memory. Just switched it to auto and it fixed it up

smaw51 said:
Is there any recommendations for the partition other than ext4, like swap size and what not? I also assume a reboot is required in order to get it to run right? I am still getting insufficient storage available when updating apps in the play store. I was getting that error before, even though I have plenty of space, like more than 10 gb on the internal memory so I don't know if it is just a batch update issue on the play store with my note for whatever reason. But even individual updates stop with an insufficient storage error.
I have tried using both the attached file in the op as well as the copy and paste method. The file should have no extension once in place right?
It seems as though it is still not working right
I have init.d working, confirmed with the test file and your method, Busybox installed, partitions with 0 swap and 1024 size at ext4
I have not been able to locate a log created, where is it dumped to to see if it is even running the script?
EDIT: never-mind, I figured out why my stuff was't updating but still able to add new apps, in rom tool box, I set it to install to sd card after most of my apps were already put on the internal memory. Just switched it to auto and it fixed it up
Click to expand...
Click to collapse
Had a similar problem when i had the tf201, kept getting an error whenever playstore started installing an app after the initial download, and i had the same problem a couple of days ago with the note which i resolved by deleting all odex files in the data\apps folder, i used es file explorer, navigated to the app folder and did a search for 'odex', then deleted them, i can now install apps again
Dont know if this is the same issue as yours , and ive just now seen your edit, so i see youve resolved it, so no worries, hopefully our solutions will help out others
Edit: dont quote me but my particular issue i 'think' has something to do with titanium backup, so for those having 'inssuficient storage errorr' in the playstore AND you have titanium backup, this may help

It might be a restore from backup in general issue, after you mention you used titanium. I used my backup pro to restore apps and data from my tf 700 to the my note. Only halfsies worked but maybe that caused some issues.
This is going to be very nice one apk and data are enabled to move to sd

how do I know that I have ext4 in my SDcard? and if I dont have it , How do I make ext4 ?
Thanks

Related

[MOD] full r/w access via overlay filesystem (any ROM)

OK, here we go. Following the model from Desire thread, I made this one for Legend too.
Backgroud:
If I sum up some key points from this thread... there is no way of writing to system partition (Legend, Desire...) even if it is mounted in read-write mode. The only way of writing to system partition is via recovery mode (if you have already rooted your Legend) which makes a process of updating/testing a pain... you have to reboot your phone into recovery mode each time you want to change something on system partition. So guys at Desire subforum came up with an idea to put a writable overlay over the /system directory. This principle is very well known from live CD distros of Linux and Asus also introduced this on their EEE systems running Linux.
This method can be used not only on system partition (so we can "write" to it) but also on data partition which brings us really a neat way of point-in-time backup. Basically one could make overlay of an entire system just after the system was installed and set-up (with all software and custom settings). Then when anything goes wrong after this point, all one has to do is to wipe the directory/partition where writes were being made - no need to factory reset (wiping data partition), setting things up and installing all the apps all over again. This method can well be a better alternative of nandroid backup, because restoring from nandroid backup wipes out all partitions and restore data to them from images. And we all know that frequent repetition of this process really deteriorates non-removable NAND flash chips in our phones.
Contents:
shell script that does the actual /system overlay
statically compiled mount (for compatibility reasons)
auplink utility for flushing pseudo-links to writable device (not used atm)
Shell script that does the overlay is made so it can use any (first) ext2/3 partition on your sdcard. That means you can use your a2sd partition for overlay too. If a2sd is not active but you still have ext2/3 partition on your sdcard, it will be mounted and used for overlay. If you don't have ext2/3 partition on your sdcard, then internal data partition will be used instead. In this case you will have to be careful not to fill it up entirely.
Requirements:
rooted Legend of course
any kernel with built-in aufs support
busybox
run-parts integrated in init.rc script (/etc/init.d)
a2sd script should run before the overlay script (only if you use a2sd)
(When I mention a2sd in this post I mean any a2sd; a2sd, a2sd+, apps2sd, DarkTremor, LightSabre, GoldenThrone )
Installation
Boot to recovery mode (ClockworkMod) and apply this update. After applying it (re)boot your phone. At this point overlay is not yet enabled. You have to issue:
Code:
adb shell aufs --enable
...to enable it and reboot your phone afterwards for changes to take effect.
Configuration
If you want to enable/disable overlay later on, issue:
Code:
adb shell aufs --disable
...to disable overlay or:
Code:
adb shell aufs --enable
...to enable overlay again. Reboot your phone for changes to take effect.
Be advised that after wiping (Factory data reset) overlay is disabled so you will have to enable it again.
Troubleshooting
Make logcat of boot process and check for errors in 1st 50 or so lines.
Warning!!!
Please, do not even try to flash this "update" if you don't know what you are doing or what things I mentioned above mean!!!
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Changelog
0.7 (December 16, 2010)
compatibility enhancements
some minor changes
0.6.1 (December 2, 2010)
script is now calling e2fsck or e2fsck_recvy
0.6 (December 1, 2010)
dropped auplink binary
some more error handling
changed installation script
0.5.1 (October 4, 2010)
minor change in installation script
0.5 (October 4, 2010)
added enable/disable ability (dumfaq was here also)
improved error handling
0.4 (September 30, 2010)
updated aufs script to check if aufs support is already on
added statically compiled mount to support mount-move on any ROM
0.3 (September 28, 2010)
updated aufs script to check presence of /data/local/dosysoverlay file (to enable/disable)
0.2 (September 20, 2010)
updated aufs script to check availability of ext partition on SD card (thanks to dumfaq)
0.1 (September 3, 2010)
initial release
Wow impressive..
I'll try to include into my rom!
Thank you so much!
This sounds very good... But please enlighten me...
Will this only work on stock/modified stock roms.. or will this work on CM6 roms also? (Azure 1.0 etc.)
Hey Neon, this would certainly overwrite your OC kernel.
But you can always build your own with aufs support and use my overlay script (maybe you'll find some glitch in it ).
I would just ask you to consider putting init.d into /data/local (making symlink in /system/etc). That would ease up adding/removing/chmoding scripts inthere. I think this approach is very handy.
I have put together a little script that would look for init.d link or directory in /system/etc (or directory in /data/local) and then decide to make /data/local/init.d directory or not.
whitetigerdk said:
This sounds very good... But please enlighten me...
Will this only work on stock/modified stock roms.. or will this work on CM6 roms also? (Azure 1.0 etc.)
Click to expand...
Click to collapse
It would work on CM6 too, but you would have to copy WiFi module from stock ROM, because I didn't include it in this update. But bare in mind that CM6 is based on kernel 2.6.32 and above and we are talking 2.6.29 here!
Ahh one more thing. CM6 kernel should already contain AUFS support (if I'm not mistaken) so you could use just my overlay loading script and auplink binary.
Blayo, an alternative way for nandroid backup sounds really interesting. if included in the rom along with a few further instructions Im sure it could be brought down to the level of no-obs. Ill wait till puppy is 100% tested
Learners Lisence said:
Blayo, an alternative way for nandroid backup sounds really interesting. if included in the rom along with a few further instructions Im sure it could be brought down to the level of no-obs. Ill wait till puppy is 100% tested
Click to expand...
Click to collapse
Oh.. you can't wait.. you are the one who is ment to be doing the testing .. so the rest of us are waiting for your result.
Sent from my Legend using XDA App
So...basically, this will helps installing Ad-free and OpenVPN on our Legend, right?
BlaY0 said:
Ahh one more thing. CM6 kernel should already contain AUFS support (if I'm not mistaken) so you could use just my overlay loading script and auplink binary.
Click to expand...
Click to collapse
The CM6 port from Ali Baba (Azure 1.0) contains a 2.6.29 kernel and no AUFS module... So it should work with your zip. Great work BlaY0!!!
Just to be sure.
This should work with Azure 1.0, right? What was that thing about the wifi?
cryshop said:
So...basically, this will helps installing Ad-free and OpenVPN on our Legend, right?
Click to expand...
Click to collapse
I'm not sure what you mean... but it will certainly help you adding/removing stuff to/from /system on-the-fly...
Briix said:
Just to be sure.
This should work with Azure 1.0, right? What was that thing about the wifi?
Click to expand...
Click to collapse
It's for 2.6.29 kernel (check the thread title!) and you have to provide your own WiFi driver, because it is not included in this update. Be advised that modules/drivers versions and kernel versions can not mix most of the times. You also can not use just aufs module from this update with any non-aufs kernel (even if versions match), it just won't work.
well, I got this working on my slide (I have no ext partition) however, I had to make some changes...
Code:
7,8c7,8
< RODIR=/data/sysro
< COUNT=0
---
> RODIR=/system
> COUNT=2
16c16
< while [ ! -e /dev/block/mmcblk0p1 ]; do
---
> while [ ! -e /dev/block/mmcblk0p$COUNT ]; do
48,49d47
< insmod /system/lib/modules/aufs.ko
< mount --move /system $RODIR
Without changing the while loop, it always detected an ext partition even though none existed.
Haven't tested it with an ext partition though.
Obviously I used my own kernel and modules.
Thanks alot.
Tested on CM6.0 (Azure latest) and the ROM still works perfectly including my WiFI. I have not tested the overlay functions itself just that it did not screw up CM6.0 which it didn't!
Will let you know the results of the AUFS side of things once I have finished playing!
Let us know how it goes... I'm still trying to figure out how to the the aufs stuff working.
!!!ignore me!!!
dumfuq said:
well, I got this working on my slide (I have no ext partition) however, I had to make some changes...
Code:
7,8c7,8
< RODIR=/data/sysro
< COUNT=0
---
> RODIR=/system
> COUNT=2
16c16
< while [ ! -e /dev/block/mmcblk0p1 ]; do
---
> while [ ! -e /dev/block/mmcblk0p$COUNT ]; do
48,49d47
< insmod /system/lib/modules/aufs.ko
< mount --move /system $RODIR
Without changing the while loop, it always detected an ext partition even though none existed.
Haven't tested it with an ext partition though.
Obviously I used my own kernel and modules.
Click to expand...
Click to collapse
Hi m8,
Thanks for the input but I think that you are missing the point why this while loop is there
...it is there just to check when SD card is ready to be used. The thing is that it depends of what speed is your SD card. If you have a class 6 for example, it can be available in less than a second, but if you have stock SD card or slower one, it is available only after 2 or even 3 seconds.
But you were right about the script not doing overlay if there's SD card present and no ext partition on it so I changed it a little. here's the patch:
Code:
--- 70aufs.old 2010-09-20 10:29:49.000000000 +0200
+++ 70aufs 2010-09-20 10:28:57.000000000 +0200
@@ -26,13 +26,20 @@
done
if [ -z "$NOSD" ]; then
DEV=`fdisk -l /dev/block/mmcblk0|grep Linux|head -n1|awk '{print $1}'`
- SD=/data/sd
- RWDIR=${SD}/sysrw
- [ -d "$SD" ] || mkdir $SD
- e2fsck -y $DEV
- mount -t auto -o noatime,nodiratime $DEV $SD
- chown 1000.1000 $SD
- chmod 775 $SD
+ if [ -n "$DEV" ]; then
+ SD=/data/sd
+ RWDIR=${SD}/sysrw
+ [ -d "$SD" ] || mkdir $SD
+ e2fsck -y $DEV
+ mount -t auto -o noatime,nodiratime $DEV $SD
+ chown 1000.1000 $SD
+ chmod 775 $SD
+ else
+ mkdir /dev/shm
+ mount -t tmpfs -o size=4m shm /dev/shm
+ RWDIR=/data/sysrw
+ MTOPTS="xino=/dev/shm/.aufs.xino,dirs=${RWDIR}:${RODIR}=ro"
+ fi
else
mkdir /dev/shm
mount -t tmpfs -o size=4m shm /dev/shm
...now it will check the availability of SD card and if it's there it will check for ext partition on it. If one is present it will prepare and mount it, otherwise it will do the overlay on data partition.
Update is also available in 1st post.
BlaY0 said:
Hi m8,
Thanks for the input but I think that you are missing the point why this while loop is there
...it is there just to check when SD card is ready to be used. The thing is that it depends of what speed is your SD card. If you have a class 6 for example, it can be available in less than a second, but if you have stock SD card or slower one, it is available only after 2 or even 3 seconds.
But you were right about the script not doing overlay if there's SD card present and no ext partition on it so I changed it a little. here's the patch:
Code:
--- 70aufs.old 2010-09-20 10:29:49.000000000 +0200
+++ 70aufs 2010-09-20 10:28:57.000000000 +0200
@@ -26,13 +26,20 @@
done
if [ -z "$NOSD" ]; then
DEV=`fdisk -l /dev/block/mmcblk0|grep Linux|head -n1|awk '{print $1}'`
- SD=/data/sd
- RWDIR=${SD}/sysrw
- [ -d "$SD" ] || mkdir $SD
- e2fsck -y $DEV
- mount -t auto -o noatime,nodiratime $DEV $SD
- chown 1000.1000 $SD
- chmod 775 $SD
+ if [ -n "$DEV" ]; then
+ SD=/data/sd
+ RWDIR=${SD}/sysrw
+ [ -d "$SD" ] || mkdir $SD
+ e2fsck -y $DEV
+ mount -t auto -o noatime,nodiratime $DEV $SD
+ chown 1000.1000 $SD
+ chmod 775 $SD
+ else
+ mkdir /dev/shm
+ mount -t tmpfs -o size=4m shm /dev/shm
+ RWDIR=/data/sysrw
+ MTOPTS="xino=/dev/shm/.aufs.xino,dirs=${RWDIR}:${RODIR}=ro"
+ fi
else
mkdir /dev/shm
mount -t tmpfs -o size=4m shm /dev/shm
...now it will check the availability of SD card and if it's there it will check for ext partition on it. If one is present it will prepare and mount it, otherwise it will do the overlay on data partition.
Update is also available in 1st post.
Click to expand...
Click to collapse
sweet thanks man. I'll give it a go tomorrow.
BlaY0 said:
Hi m8,
Thanks for the input but I think that you are missing the point why this while loop is there
...it is there just to check when SD card is ready to be used. The thing is that it depends of what speed is your SD card. If you have a class 6 for example, it can be available in less than a second, but if you have stock SD card or slower one, it is available only after 2 or even 3 seconds.
But you were right about the script not doing overlay if there's SD card present and no ext partition on it so I changed it a little. here's the patch:
...now it will check the availability of SD card and if it's there it will check for ext partition on it. If one is present it will prepare and mount it, otherwise it will do the overlay on data partition.
Update is also available in 1st post.
Click to expand...
Click to collapse
Works great for non ext now, thanks. I still have to set sysro to /system and take out the mount --move or it breaks though.
What's the logic/purpose of moving the sysro anyways, I noticed they are not doing that in the desire version. Just curious.
Thanks again
The purpose of mount moving /system to some place else is that you have only one instance of "/system" in /proc/mounts eventually. If you just do the overlay over /system, you have two instances of "/system" in /proc/mounts and that causes some root apps to panic because they chose the first instance (to remount it read-write) which we don't actually want.
But as soon as you mount move /system to some place else you also loose everything that's in it (bin, xbin, lib). And since you are on CM6 (i believe), your busybox is compiled dinamically thus it depends first on /system/bin/linker and then on libraries in /system/lib. You can catch those lib deps with LD_LIBRARY_PATH variable but the problem is still /system/bin/linker absolute path which is compiled into your busybox and all other native binaries.
There is actually only one solutions to this problem and that is to get statically built busybox, copy it to let say /data/bin and call this busybox from script.
I will add to 1st post that statically built busybox is imperative.

[Gen9] Developement organization

Hi
Archos G9 devices are quite new so we should create some developement guidelines/standards to avoid total mess.
This thread is meant to be the place to create those, feel free to contribute.
1. Firmware file name- archos.ext4/squashfs/img
as propposed by letama (source) and agreed by suduru_petru (source)
2. Firmware updating
letama in his builds added a mechanism to painlessly update system image: new image is called [...].update, kernel initrd deletes "old" file and renames new one- there is no need to boot or install stock firmware.
My opinion- this should be the standard but subject is to be discussed
However updating/downgrading firmware may cause problems so-
3. Recovering from problems (bootloop, FC's etc)
This subject is to be discussed.
Archos G9 has specific system structure and "non-standard" Recovery. For now the only way to fix app FC's or a bootloop is to wipe data (Reset Android option in recovery) but this deletes all system data. Better solution is to wipe dalvik-cache- this deletes some files used by system but they are rebuilt during boot- but there is no way to do it now.
After talking with letama we've come to an idea: kernel init looks for .update files and
-if it's archos.ext4/squashfs/img.update kernel updates system image
-if it has another but predefined name- .update file is a shell script that is executed
This would give us a substitute for a "standard" recovery. Best way would be to use external SD-card for this task but first we have to check if there are any problematic cards (seems that letama has such card)
Please post your opinions/ideas/suggestions but keep in mind that this is not a system/app feature request topic
And if you have a better idea for the topic title- let me know
My idea how .update files should be handled:
during boot check if external sd card is present
1)yes- check for .update files
a)archos.[...].update present- delete current system image from /data/media, copy new one, delete archos.[...].update files from card AND from /data/media
b) .update script file present- run script, delete script .update from sd AND /data/media
2) no- check /data/media for .update files
a)archos.[...].update- delete current system image, rename update file
b).update script- run script and delete .update file
Notes:
-both types of .update files should be handled if found- when updating firmware wiping dalvik-cache (rm -r -f /data/dalvik-cache) is always advised and this can be done using a script since we don't have a "standard" recovery
-using external sd as the first choice- if adb can't be accessed (no PC, no USB cable, bootloop etc) there is no way to access internal storage
gen_scheisskopf said:
My idea how .update files should be handled:
during boot check if external sd card is present
1)yes- check for .update files
a)archos.[...].update present- delete current system image from /data/media, copy new one, delete archos.[...].update files from card AND from /data/media
b) .update script file present- run script, delete script .update from sd AND /data/media
2) no- check /data/media for .update files
a)archos.[...].update- delete current system image, rename update file
b).update script- run script and delete .update file
Notes:
-both types of .update files should be handled if found- when updating firmware wiping dalvik-cache (rm -r -f /data/dalvik-cache) is always advised and this can be done using a script since we don't have a "standard" recovery
-using external sd as the first choice- if adb can't be accessed (no PC, no USB cable, bootloop etc) there is no way to access internal storage
Click to expand...
Click to collapse
First...Thanks @gen_scheisskopf for your idea....ofcourse is very important for us to have a standard "language".....and you are rigt ( is also my opinion ) - is very unpleasant to take it from zero for an future update or custom rom , considering that many users have installed many custom applications ( games, contacts-data, calendar-data and other personalizated-data....or other stuff).
I hope that together , we'll found the right way for this inconvenience ......and what you began is a necessary and welcome environment to improve programming and use.
Without portability not succeed to have its own development !
I hope in a close collaboration among you especially as you have one of the best developers (Thanks @LeTama) .. but I hope to help us and other developers ....See you soon ! and you started a great job anyway !
Problems like bootloop or FC's can occur even if firmware wasn't changed but there is no *easy* way to fix this yet- so we should make one
One more thing from my side- [email protected] image should be mounted RO by default:
-system RO is a standard (also in official firmware)
-nobody can do any harm to system by accident- any changes will require remounting RW first and no app does this by itself
-all root apps that can make changes to system (TitaniumBackup, RootExplorer, Abslute Root Tools, SUFBS etc) will function properly for remounting RO/RW
gen_scheisskopf said:
-system RO is a standard (also in official firmware)
Click to expand...
Click to collapse
Agreed, it would be nice. However, Archos has not the android standard way of managing partitions, they don't mount a /system partition on top of initrd , they mount a root partition that contains a system directory and chroot it. In short, we mount /dev/loop0 on /new-sys then chroot /new-sys, we don't /dev/block/mmcblkp1 on /system.
More, /dev/loop0 is becoming /dev/block/loop0 when android is booted, so it's a bit tricky to remount r/w after that. I think most root applications are confused with this layout and can't remount properly, that's why I left default to r/w in my build.
It would be good to test it a bit more with few root apps to see if some are working, I didn't do much tests.
I understand.
How about "ln -s /dev/block/loop0 /"? This can be done in init.rc (both kernel initrd and in system image init), not sure if this will work properly
Another idea about .update files- possibly safer way would be to add a predefined set of scripts to initrd- like it's done in recovery- and to use .update files with a different names (like wipe-dalivik.update).
letama said:
It would be good to test it a bit more with few root apps to see if some are working, I didn't do much tests.
Click to expand...
Click to collapse
TitaniumBackup has problems with integrating updated apps into rom- device rebooted during Maps.apk processing (2nd of 4) and now Market is missing from /system/app
Can't say however what caused this- system img file location (loop0) or RW by default. Ext4 is not the cause, I've used ext2 and ext4 for /system on the other device before and there was no problem.
EDIT:
TB restored Market from backup straight to /system/app and it seems that manual integration works fine. Maybe that was just a system error.
Dalvik-cache wipe in init:
Code:
# Do updates if need
if [ -e /data/media/archos.ext4.update ] ; then
rm /data/media/archos.ext4
mv /data/media/archos.ext4.update /data/media/archos.ext4
[B]rm -r /data/dalvik-cache[/B]
fi
if [ -e /data/media/archos.squashfs.update ] ; then
rm /data/media/archos.squashfs
mv /data/media/archos.squashfs.update /data/media/archos.squashfs
[B]rm -r /data/dalvik-cache[/B]
fi
[B]if [ -e /data/media/wipe-dalvik.update ] ; then
rm -r /data/dalvik-cache
rm /data/media/wipe-dalvik.update
fi[/B]
-when archos.ext4/squashfs.update file is found dalvik-cache wipe is mandatory
-file /data/media/wipe-dalvik.update also triggers wipe (and dalvik-wipe.update file is removed
Tested, works fine
gen_scheisskopf said:
Dalvik-cache wipe in init:
Code:
# Do updates if need
if [ -e /data/media/archos.ext4.update ] ; then
rm /data/media/archos.ext4
mv /data/media/archos.ext4.update /data/media/archos.ext4
[B]rm -r /data/dalvik-cache[/B]
fi
if [ -e /data/media/archos.squashfs.update ] ; then
rm /data/media/archos.squashfs
mv /data/media/archos.squashfs.update /data/media/archos.squashfs
[B]rm -r /data/dalvik-cache[/B]
fi
[B]if [ -e /data/media/wipe-dalvik.update ] ; then
rm -r /data/dalvik-cache
rm /data/media/wipe-dalvik.update
fi[/B]
-when archos.ext4/squashfs.update file is found dalvik-cache wipe is mandatory
-file /data/media/wipe-dalvik.update also triggers wipe (and dalvik-wipe.update file is removed
Tested, works fine
Click to expand...
Click to collapse
Thanks...good job !
Another test, possibly will work for HDD models:
Code:
mount_p data
mount_p storage_`$GET_INFO p` #this should return product name and use correct storage mountpoint
#Check if system image is present, if not- copy from storage
if [ ! -e /data/local/archos.ext4 ] ; then
cp /mnt/storage/archos.ext4.update /data/local/archos.ext4
fi
# Do updates if need
if [ -e /mnt/storge/archos.ext4.update ] && [ -e /mnt/storage/system.update] ; then
rm /data/local/archos.ext4
cp /mnt/storage/archos.ext4.update /data/local/archos.ext4
rm /mnt/storage/system.update
rm -r /data/dalvik-cache
fi
if [ -e /mnt/storage/archos.squashfs.update ] && [ -e /mnt/storage/system.update ] ; then
rm /data/local/archos.squashfs
cp /mnt/storage/archos.squashfs.update /data/local/archos.squashfs
rm /mnt/storage/system.update
rm -r /data/dalvik-cache
fi
if [ -e /mnt/storage/wipe-dalvik.update ] ; then
rm -r /data/dalvik-cache
rm /storage/wipe-dalvik.update
fi
umount_p storage_`$GET_INFO p`
# Now boot
if [ -e /data/local/archos.ext4 ] ; then
$LOSETUP `get_mount_info d rfsext4` /data/local/archos.ext4 || log_and_die "Mounting system partition failed"
mount_p rfsext4 || log_and_reboot "Mounting system partition failed"
umount_p rawfs
rootfs_path=`get_mount_info p rfsext4`
umount_pseudo_fs
log "SWITCHING TO REAL ROOT"
exec switch_root $rootfs_path /init
fi
$LOSETUP `get_mount_info d rootfs` /data/loacl/archos.squashfs || log_and_die "Mounting system partition failed"
mount_p rootfs || log_and_reboot "Mounting system partition failed"
umount_p rawfs
rootfs_path=`get_mount_info p rootfs`
umount_pseudo_fs
log "SWITCHING TO REAL ROOT"
exec switch_root $rootfs_path /init
Changes
-system image file is mounted from /data/local (not /data/media)
-archos.ext4.update file is preserved on storage (/data/media or hdd) in case of data wipe- init copies it to the right place if file is not present
-updating firmware requires two files- archos.ext4.update and system.update- second one is an empty file, it is removed after system update (archos.ext4.update is not removed)
-I did not add checking for archos.squashfs file
Prequisites
-minimum 512 MB free on /data for hdd models- they have much smaller /data- about 1.5GB
This works fine on 16GB model- file is copied without any problem and possibly will work on HDD models too- I've sent test version to philmein (he was willing to test)
Android does not touch /data/local/archos.ext4 file (/data/local belongs to shell, not system so it's a safe place)
Other thoughts:
-maybe we drop archos.squashfs support?
-archos.ext4 can be made smaller- 191 MB is free so 400 MB should be more than enough
-maybe add mounting official system file (.squashfs.secure) if there is no custom one present and no archos.ext4.update on storage?
-other possible location can be /data/customization but I didn't test it
Hi @gen_scheisskopf...
I think ( not sure ...) , that until we find a way for mount proper HDD into initramfs , we can't load any files system ( .ext4, .squashfs, .update ) for Archos HDD !
Your test it's work great because for flash 8/16G , @letama modified initramfs
for mounting (.ext4, .squashfs ) -proper !
I believe the solution to root version Archos HDD,is just find a solution to change something in initramfs for a proper mount , after that I do not think it matters where you are place the files system ( /data/media, /data/local , /data/customization - is the same way )
Still believe that /data/media was not chosen at random - when we connect the tablet to the computer we see just Internal Storage ( ..or + SD Card), which is equal to /data/media/....you don't need root, you don't need any other app for look into Internal Storage....
surdu_petru said:
Hi @gen_scheisskopf...
I think ( not sure ...) , that until we find a way for mount proper HDD into initramfs , we can't load any files system ( .ext4, .squashfs, .update ) for Archos HDD !
Click to expand...
Click to collapse
All proper mountpoints are stored in /etc/mountpoints- init reads device name and uses correct mount. The only thing that possibly can be required is
Code:
wait_blk_device storage_$DEVICENAME
(I'm not sure if it's wait_blk_device, will check)
surdu_petru said:
Your test it's work great because for flash 8/16G , @letama modified initramfs
for mounting (.ext4, .squashfs ) -proper !
I believe the solution to root version Archos HDD,is just find a solution to change something in initramfs for a proper mount , after that I do not think it matters where you are place the files system ( /data/media, /data/local , /data/customization - is the same way )
Still believe that /data/media was not chosen at random - when we connect the tablet to the computer we see just Internal Storage ( ..or + SD Card), which is equal to /data/media/....you don't need root, you don't need any other app for look into Internal Storage....
Click to expand...
Click to collapse
Problem is that after android boots all mountpoints change.
Using /data/media may not work- on HDD there may be problems with mounts if /data/media belongs to hdd.
I've chosen /data/local not by mistake:
-android does not touch files placed there (as they may be vendor specific)
-/data/local is chmoded to shell while most of other /data folders are chmoded to root
-running system form HDD may decrease battery life greatly while /data/local is for sure flash memory
-modified initrd check for required files/updates on storage (/mnt/storage) and does not delete possibly necessary archos.ext4.update file (in case of data wipe) so copying those files doesn't change at all- just drag'n'drop on PC
It seems that modified init works for HDD models but more tests are required: http://forum.xda-developers.com/showpost.php?p=22309411&postcount=72
Modified part of init:
Code:
mount_p data
mount_p storage
#Check if system image is present, if not- copy from storage
if [ ! -e /data/local/archos.ext4 ] && [ ! -e /mnt/storage/archos.ext4.update] ; then
cp /mnt/storage/archos.ext4.backup /data/local/archos.ext4
rm -r /data/dalvik-cache
fi
# Do updates if need
if [ -e /mnt/storage/archos.ext4.update ] ; then
rm /data/local/archos.ext4
cp /mnt/storage/archos.ext4.update /data/local/archos.ext4
mv /mnt/storage/archos.ext4.update /mnt/storage/archos.ext4.backup
rm -r /data/dalvik-cache
fi
if [ -e /mnt/sdcard/wipe-dalvik.update ] ; then
rm -r /data/dalvik-cache
rm /mnt/sdcard/wipe-dalvik.update
fi
umount_p storage
# Now boot
if [ -e /data/local/archos.ext4 ] ; then
$LOSETUP `get_mount_info d rfsext4` /data/local/archos.ext4 || log_and_die "Mounting system partition failed"
mount_p rfsext4 || log_and_reboot "Mounting system partition failed"
umount_p rawfs
rootfs_path=`get_mount_info p rfsext4`
umount_pseudo_fs
log "SWITCHING TO REAL ROOT"
exec switch_root $rootfs_path /init
fi
$LOSETUP `get_mount_info d rootfs` /data/local/archos.squashfs || log_and_die "Mounting system partition failed"
mount_p rootfs || log_and_reboot "Mounting system partition failed"
umount_p rawfs
rootfs_path=`get_mount_info p rootfs`
umount_pseudo_fs
log "SWITCHING TO REAL ROOT"
exec switch_root $rootfs_path /init
Changes:
-support only for archos.ext4
-after update a backup file is created in case of data wipe (archos.ext4.backup)
Works on flash model, to be tested on HDD models:
http://dl.dropbox.com/u/14106051/archos/kernel_hdd_test7.zip
EDIT:
As it was just reported- G9 80 HDD does not have SD card slot so earlier idea to use external SD has to be dropped.
Backup & restore of archos.ext4 without wiping data (in case something went wrong with merging changes into the system).
Code:
#backup & restore of system image
if [ -e /mnt/storage/backup.update ] ; then
rm /mnt/storage/archos.ext4.backup
cp /data/local/archos.ext4 /mnt/storage/archos.ext4.backup
fi
if [ -e /mnt/storage/restore.update ] ; then
rm /data/local/archos.ext4
cp /mnt/storage/archos.ext4.backup /data/local/archos.ext4
rm -r /data/dalvik-cache
fi
umount_p storage[...]

How to install ubuntu on the Droid 4

How to install ubuntu on the Droid 4
Note to mods: this thread is a branch off of this thread
Huge thanks to zacthespack for creating the ubuntu installer app and original boot script and to zeroktal for modifying the script to work on the D4 and helping me get it working on my device.
I decided to take my experience in setting this up and put it into a how-to so that others could enjoy the experience of having ubuntu on the Droid 4. If zackthespac or zeroktal have any problems with me making and putting this guide up, please let me know and I will remove it.
Knowledge Required:
working knowledge of command line
working knowledge of vi
OR the ability to learn how to use both
Tools Required:
A rooted Motorola Droid 4
BusyBox (Android Market)
Terminal Emulator (Android Market)
Android VNC Viewer (Android Market)
Ubuntu Installer App (Android Market)
zeroktal's ubuntud4.zip file (attached to this post and mediafire)
Vi Cheat Sheet (lagmonster.org)
Step by Step:
Install BusyBox, Terminal, and Android VNC Viewer
Install and run Ubunutu Installer App
Follow the on-screen instructions and click next
Download either the Small or Large image to your phone, (use zeroktal's ubuntud4.zip file instead of the boot script provided in the guide) after the image downloads (will take a while because the file is HUGE) click next
For this screen, the instructions differ from the app.
1. With your D4 plugged into your PC in USB Mass Storage, create a directory (folder) called ubuntu in the EXTERNAL sdcard's root*
2. Extract the image you downloaded to that directory
3. Download and extract the attached .sh (ununtud4.zip) to that directory
4. Disconnect your phone from your PC
5. Open terminal and run the following commands:
su [ENTER]
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext [ENTER]
cd /mnt/sdcard-ext/ubuntu [ENTER]
sh ubuntud4.sh [ENTER]
960x540 [ENTER]**​If you get an error message: ubuntud4.sh: 45: syntax error: end of file unexpected (expecting "then") see troubleshooting section below.​killall -TERM Xtightvnc [ENTER]
vncserver :1 -geometry 960x540 [ENTER]**​6. Open androidVNC app and enter the following settings:
Nickname: Anything you want
Password: ubuntu
Address: localhost
Port: 5901
Color Format: 24-bit color (4 bpp)
7. Hit connect
8. Hit your menu soft button and then set input mode to touchpad
9. You have ubuntu on your Droid 4!
To "shut down" ubuntu:
press the menu button, select disconnect in VNC
In terminal type this command 3 times (terminal will close itself when you are done):
exit [ENTER]
To "start up" ubuntu again:
Follow steps 5-8 above
Troubleshooting:
If you get the error message: ubuntud4.sh: 45: syntax error: end of file unexpected (expecting "then") you are about to have fun with vi at the command line.
Do the following from inside terminal:
su [ENTER]
cd /mnt/sdcard-ext/ubuntu [ENTER]
vi ubuntud4.sh [ENTER]​If you see ^M or ^ at the end of any line (remember to scroll all the way to the right to see the end of long lines) remove it. once you do that, everything should work just fine. (See the Vi Cheat Sheet above for help with Vi)
Note: Vol Up + E is [ESC] by default in this terminal emulator
Notes:
* It does not have to be on the external SD, but if you put it on the internal SD you will have to modify things as needed-- if you dont know what needs to be changed, just put it on the external SD.
** Screen size can be whatever you want it to be, but 960x540 is the size of the D4 screen.
*** This is a fairly involved process... especially when it comes to editing the .sh file in vi things can get very frustrating and hard, but just take your time and you will get it. As always, doing anything with root access on your phone, especially on the command line has risks. I am not responsible if anything goes wrong with your phone... proceed at your own risk!
greekchampion04 said:
Notes:
* It does not have to be on the external SD, but if you put it on the internal SD you will have to modify things as needed-- if you dont know what needs to be changed, just put it on the external SD.
** Screen size can be whatever you want it to be, but 960x540 is the size of the D4 screen.
*** This is a fairly involved process... especially when it comes to editing the .sh file in vi things can get very frustrating and hard, but just take your time and you will get it. As always, doing anything with root access on your phone, especially on the command line has risks. I am not responsible if anything goes wrong with your phone... proceed at your own risk!
Click to expand...
Click to collapse
I actually got it up and running on my internal sdcard partition. Pretty much just have to modify the Mount remount command, and a few lines in the script.
Here's the original command
Code:
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
And the modified one
Code:
mount -o remount,rw,exec,suid /dev/block/vold/179:57 /mnt/sdcard
Only things you have to change are the device location(179:57) and mount location(drop the -ext after sdcard)
Now, after that you also have to modify the script a bit. Just go through it, and anywhere that you see sdcard-ext, drop the -ext off the end.
thanks for putting that up for everybody! like i said, if you know what you are doing its not a hard swap to make.
Is anyone else getting just a gray screen when they remote in? What could be causing this?
i had that same problem at first... did you use zeroktal's ubuntud4.zip file? or did you use the ubuntu.sh file included in the app?
I used the sh file included. I did however fix the problem, when mounting at the start i confused vold with void. I did not get the file system mounted properly. This method does work!! however I am currently trying to get bash on my droid to replace sh as the shell. I've checked the forums but have not found anything yet about someone installing bash on the droid 4. With no way for nandroids I feel i should wait before I kill sh.
Sent from my DROID4 using XDA App
If you mod your init.sh in your root directory to the following, your vnc will work on startup without issue. It will also shutdown vnc on exit.
#!/bin/bash
#############################################
# Asks User to screen size and saves as REZ #
#############################################
#echo "Now enter the screen size you want in pixels (e.g. 800x480), followed by [ENTER]:"
#read REZ
##############################################
# Pick which desktop environment to use, this#
# is done by having a xstartup file for each #
# desktop, then renaming the one you want to #
# use to 'xstartup' before boot #
##############################################
echo "Please select which Desktop environment you want to use, type the number to select it then press [ENTER]"
echo "1 - LXDE"
echo "2 - Gnome"
echo "Make your Selection:"
read DESKTOP
if [ $DESKTOP == 1 ]
then
mv /root/.vnc/lxstartup /root/.vnc/xstartup
fi
if [ $DESKTOP == 2 ]
then
mv /root/.vnc/gxstartup /root/.vnc/xstartup
fi
###########################################
# Tidy up previous LXDE and DBUS sessions #
###########################################
rm /tmp/.X* > /dev/null 2>&1
rm /tmp/.X11-unix/X* > /dev/null 2>&1
rm /root/.vnc/localhost* > /dev/null 2>&1
rm /var/run/dbus/pid > /dev/null 2>&1
############################################################
# enable workaround for upstart dependent installs #
# in chroot'd environment. this allows certain packages #
# that use upstart start/stop to not fail on install. #
# this means they will have to be launched manually though #
############################################################
dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
ln -s /bin/true /sbin/initctl > /dev/null 2>&1
###############################################
# start vnc server with given resolution and #
# DBUS server, (and optionally an SSH server) #
###############################################
dbus-daemon --system --fork > /dev/null 2>&1
/etc/init.d/ssh start
vncserver :1 -geometry 960x540
echo
echo "If you see the message 'New 'X' Desktop is localhost:1' then you are ready to VNC into your ubuntu OS.."
echo
echo "If VNC'ing from a different machine on the same network as the android device use the 1st address below:"
##########################################
# Output IP address of android device #
##########################################
ifconfig | grep "inet addr"
echo
echo "If using androidVNC, change the 'Color Format' setting to 24-bit colour, and once you've VNC'd in, change the 'input mode' to touchpad (in settings)"
echo
echo "To shut down the VNC server and exit the ubuntu environment, just enter 'exit' at this terminal - and WAIT for all shutdown routines to finish!"
echo
###############################################################
# Spawn and interactive shell - this effectively halts script #
# execution until the spawning shell is exited (i.e. you want #
# to shut down vncserver and exit the ubuntu environment) #
###############################################################
/bin/bash -i
#########################################
# Disable upstart workaround and #
# kill VNC server (and optionally SSH) #
# Rename used xstartup to its first file#
#########################################
killall -TERM Xtightvnc
/etc/init.d/ssh stop
Also save the follow lines between ### as remount.sh on your system partition. Then chmod 755 /system/remount.sh. Now you can just run run from a terminal /system/remount.sh and voila it remounts correctly and starts ubuntu(with the above fixes). Im still working on the unmounts.
####### for the internal sd card
mount -o remount,rw,exec,suid /dev/block/vold/179:57 /mnt/sdcard
/mnt/sdcard/ubuntu/ubuntu.sh
######
OR
####### for the external sd card
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
/mnt/sdcard-ext/ubuntu/ubuntu.sh
#######
great stuff!
feel free
Feel free and take, modify, repost or edit anything I touch.
QUESTION:
After I delete all the ^M and ^ what do i do next? I try to hit the command ":x" to exit and save changes but it just creates another line. Also when I press VOL UP + E to escape nothing happens.
PhanTuhC said:
QUESTION:
After I delete all the ^M and ^ what do i do next? I try to hit the command ":x" to exit and save changes but it just creates another line. Also when I press VOL UP + E to escape nothing happens.
Click to expand...
Click to collapse
In vi, the command to save and exit is :wq (probably short for write and quit).
remember, read up on the vi quick-reference guide: http://www.lagmonster.org/docs/vi.html
OK I fixed it but now its not letting me connect with androidVNC. All the settings entered is correct but when I try to connect it says:
"VNC connection failed!" localhost/127.0.0.1:5901 - Connection refused"
ok, i've gone thru this a few times (slowly and deliberately) and must be missing something...the directions seem pretty straightforward! here's what i know...
busy/terminal/vnc are all installed
small 2.5gb image is unzipped in /sdcard-ext/ubuntu directory
the attached .sh file from page 1 is in the same directory
i removed all ^M using vi
but when I try sh ubuntud4.sh i get an error...
"mkdir failed for /data/local/mnt/ubun, No such file or directory"
(plus a few other errors)
should the directory be "ubun" or "ubuntu"? am I typing something incorrectly?
copy and paste new script
Copy and paste the new scripts I posted. They will fix your problem. Remember to use the remount script from /system/ the rest will work perfectly if you are root. I'll check back later on your progress.
Ok, well I started from scratch (deleted both .img and .sh files) and it's still not working.
I have all the apps installed (and yes rooted, SU works just fine)
I used Ubuntu Installer app to download the image zip (tried both the large and small img)
I downloaded the .sh file from the first post
The /sdcard-ext/ubuntu/ folder now has two files: "ubuntu.img" and "ubuntud4.sh"
All ^M characters have been removed from .sh file
Still no joy...
Ideas? What am I missing?
In terminal, I can set SU permissions and the mount/cd commands work just fine...it's the last sh command that spits out a bunch of errors about not being able to create/find the directories.
I'm going to format the sdcard and try again...any help is appreciated.
Update: Even after re-formatting the SD and following the steps exactly, no luck!
Did you remember to remount the sdcard with exec and suid permissions?
Andbuntu will work much better than this method. It works on every single phone with modification to the "environmental variables".
http://code.google.com/p/andbuntu/
Follow the directions in the script to make the process much easier than the first post.
instructions:
generate an image with rootstock on an ubuntu computer.
put it on /sdcard/ubuntu/ubuntu.img
run the script on your phone with "sh /path/to/script"
Here is the script. http://andbuntu.googlecode.com/svn/trunk/uboot
Also, run "firstRun" to make things like terminals work properly.
Adamoutler: That didnt work for me. The permissions were incorrect on the mounted partitions.
Sent from my DROID4 using XDA App

[STOCK]INIT.D support. No need to flash anything or even reboot into recovery

So yea I've been working on a proper "app2sd" solution that doesn't involve just switching the MicroSD for the eMMC, but I like the stock rom so far, so I didn't feel like flashing a rom just to get init.d, and I didn't feel like modifying the ramdisk in the kernel either. So I cooked up this script that anyone can run from terminal to get init.d support. It should work for other devices too, as long as they run /system/etc/install-recovery.sh on boot.
There's only three requirements for it to work:
#1 You must be rooted
#2 Your device must run /system/etc/install-recovery.sh
#3 You must have busybox
I tested a few times on my own device (GT-N8013), but haven't had anyone else test it, so don't freak out if it doesn't work. Just let me know what went wrong and I'll figure something out.
Running it is very simple:
#1 Open any terminal app
#2 su
#3 navigate to the folder where you have the script
#4 sh ./enableinit.sh
Your device will be rebooted once the process is done, don't freak out. If everything went fine, you'll have a file in /sdcard called init.d.log created by the test init.d script that is made by the enabler.
You can either download the attachment (rename it to enableinit.sh if you get the attachment), or create the file with the contents betlow:
Code:
#!/system/bin/sh
# Adds init.d support to any device that automatically runs /system/etc/install-recovery.sh
# on startup.
#
# Made by TweakerL, make sure to visit us at and-host.com or chat with us on freenode #and-host
echo '##################################################'
echo '## ##'
echo '## Script by TweakerL ##'
echo '## Visit us at and-host.com ##'
echo '## Chat with us at freenode #and-host ##'
echo '## ##'
echo '##################################################'
echo ''
echo 'This script will enable init.d if your device'
echo 'executes /system/etc/install-recovery.sh'
echo ''
echo 'Your tablet will be rebooted once the process'
echo 'is done.'
echo ''
echo 'If the script successfully enabled init.d you will'
echo 'have a file in /sdcard called init.d.log after'
echo 'the device is done rebooting. Remember to always'
echo 'set the proper permissions in your scripts or they'
echo 'will not work.'
echo ''
read -p "Press ENTER to continue..."
if [ ! -f /system/xbin/busybox -a ! -f /system/bin/busybox ]
then
echo 'You do not have busybox. Exiting now...'
else
# Mount system as rw in order to execute the script
busybox mount -o remount,rw -t ext4 /dev/block/mmcblk0p9 /system
# Check if install-recovery.sh already exists, and if so
# add the necessary lines, otherwise create it
if [ -f /system/etc/install-recovery.sh ]
then
if cat /system/etc/install-recovery.sh | busybox egrep -i "sysinit"
then
echo sysinit already present in install-recovery.sh, skipping this step.
else
busybox cp -f /system/etc/install-recovery.sh /sdcard/qsxdrgbhuk.sh
echo '' >> /sdcard/qsxdrgbhuk.sh
echo '/system/bin/sysinit' >> /sdcard/qsxdrgbhuk.sh
busybox cp -f /sdcard/qsxdrgbhuk.sh /system/etc/install-recovery.sh
fi
else
echo '#!/system/bin/sh' >> /sdcard/qsxdrgbhuk.sh
echo '' >> /sdcard/qsxdrgbhuk.sh
echo '/system/bin/sysinit' >> /sdcard/qsxdrgbhuk.sh
busybox cp -f /sdcard/qsxdrgbhuk.sh /system/etc/install-recovery.sh
busybox chmod 755 /system/etc/install-recovery.sh
fi
# Check if sysinit already exists and if so skip step
# otherwise create it
if [ ! -f /system/bin/sysinit ]
then
echo '#!/system/bin/sh' >> /sdcard/kuhbgrdxsq
echo 'export PATH=/sbin:/system/sbin:/system/bin:/system/xbin' >> /sdcard/kuhbgrdxsq
echo '' >> /sdcard/kuhbgrdxsq
echo '/system/bin/logwrapper busybox run-parts /system/etc/init.d' >> /sdcard/kuhbgrdxsq
busybox cp -f /sdcard/kuhbgrdxsq /system/bin/sysinit
busybox chmod 755 /system/bin/sysinit
else
echo sysinit already exists in /system/bin. init.d should already be enabled.
fi
# Cleanup
busybox rm -f /sdcard/qsxdrgbhuk.sh
busybox rm -f /sdcard/kuhbgrdxsq
#Check that init.d folder exists and if not create it
# as well as set the right permissions
if [ -d '/system/etc/init.d' ]
then
chmod 755 /system/etc/init.d
else
mkdir /system/etc/init.d
chmod 755 /system/etc/init.d
fi
# Create a test init.d script that echoes a file to
# /sdcard on successful execution
echo '#!/system/bin/sh' > /sdcard/99testinit
echo '' >> /sdcard/99testinit
echo 'echo init.d works > /sdcard/init.d.log' >> /sdcard/99testinit
busybox cp -f /sdcard/99testinit /system/etc/init.d
chmod 755 /system/etc/init.d/99testinit
busybox rm -f /sdcard/99testinit
# Sync and remount system
sync
busybox mount -o remount,ro -t ext4 /dev/block/mmcblk0p9 /system
# Reboot system to enable init.d
if [ -f /system/bin/reboot ]
then
echo Your device will reboot in 3 seconds
sleep 3
reboot
else
echo "Your device doesn't appear to have a reboot command,"
echo "please reboot your device now to avoid problems."
fi
fi
reserved
TweakerL said:
reserved
Click to expand...
Click to collapse
it is good!
TweakerL said:
reserved
Click to expand...
Click to collapse
Thanks for sharing.
Im tested my ainol elf offical rom novo0706, and worked. Thank
Sent from my Ainol Novo 7 Elf using Tapatalk 2
Pretty awesome. Will edit once i try this out.
Edit: Everything worked. Tested on GT-N8013
Thanks alot.
Sent from my GT-N8013 using Tapatalk 2
Hi, Can you tell more clearly how to make this work.
Sent from my GT-N8000 using xda app-developers app
Can any one make .zip file to flash thru recovery..thanks
The point was not to have to go into recovery...
Anyway, it's really simple...
Download the attached file
open terminal
then do the following commands
Code:
su
cd /sdcard
sh ./Download/enableinit.sh.txt
assuming that your browser saves files to /sdcard/Download
Sorry, I am a computer idiot . I really donot how to do after I had downloaded the text file. Appreciated if you can explain more detail.
Sent from my GT-N8000 using xda app-developers app
So now with init.d support ready, is it going to be possible to run proper a2sd scripts? And which one specifically would you recommend? Excuse me if i'm asking the wrong questions.
andylam16 said:
Sorry, I am a computer idiot . I really donot how to do after I had downloaded the text file. Appreciated if you can explain more detail.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
It has nothing to do with knowing anything about computers, as you don't need a computer to do this... just your device...
Download the file, on your device, if you're using stock browser it will go to /sdcard/Download
Make sure you have busybox, download a busybox installer from the market, install it, and run it, and tell it to install busybox
Download a terminal app from the play store for free, such as android terminal emulator, install it and open it
then type in these exact commands, just like they're in here, in the terminal:
Code:
su
sh /sdcard/Download/enableinit.sh
Assuming of course, that your stuff is getting download to /sdcard/Download.
If you can't do this... sell your android device and buy an iCrap one...
drnish83 said:
So now with init.d support ready, is it going to be possible to run proper a2sd scripts? And which one specifically would you recommend? Excuse me if i'm asking the wrong questions.
Click to expand...
Click to collapse
I'm working on my own app2sd script that should beat anything ever made. Here's what it does:
It uses a second partition in the MicroSD card for gaining extra storage, this partition has to be formatted to ext4
#1 It mounts the external ext4 partition to a new location
#2 It detects the location for /sdcard/Android; /data/data; /data/app no matter what device you have (suppose the directories aren't the same for a certain device)
#3 It has the option to mount /sdcard/Android to a folder in the external partition
#4 It has the option to mount /data/data to a folder in the external partition
#5 It has the option to mount /data/app to a folder in the external partition
#6 It has the option to automatically copy everything from any of those folders to the appropriate folder in the external partition
#7 It has the option to automatically wipe from the internal storage anything that it moves
#8 If you have all options enabled, apps will be automatically installed to the external partition and never take any space in the internal storage, while everything else (Download/recovery/backup/pictures/videos/etc...) all remain in the internal partition.
Wow... cant wait for this script
Sent from my GT-N8013 using Tapatalk 2
Thanks for explaining. Interesting indeed! Will definitely wait for it eagerly!
Here's a preview of the super app2sd script I'm working on. Much of it is already implemented, should have it all in a couple of days
confusing
I have tried your script and it has successful at first.. then i flashing my note again with stock rom and i try using ur script again but now there is nothing chance.. do you know why?? what must i do now??
You know, this is the damnedest thing, but your instructions call for Busybox installation, and I can't install Busybox on my N8013. And tips you can share?
NessLookAlike said:
You know, this is the damnedest thing, but your instructions call for Busybox installation, and I can't install Busybox on my N8013. And tips you can share?
Click to expand...
Click to collapse
Busy box installs on mine.
Sent from my GT-N8013 using Tapatalk 2
NessLookAlike said:
You know, this is the damnedest thing, but your instructions call for Busybox installation, and I can't install Busybox on my N8013. And tips you can share?
Click to expand...
Click to collapse
Only reason you wouldn't be able to install busybox is if you're not rooted.
Mr tweaker, i have done the process of init.d but there is nothing changed.. where is my false?
Sent from my GT-N8000 using XDA Premium HD app
Welly_11 said:
Mr tweaker, i have done the process of init.d but there is nothing changed.. where is my false?
Sent from my GT-N8000 using XDA Premium HD app
Click to expand...
Click to collapse
Look for these files and let me know if they're there:
/system/etc/install-recovery.sh
/system/bin/sysinit
/system/etc/init.d/99testinit
**************************************
If anybody needs help, look for me on irc - #and-host in freenode

mount second sd card as a directory so car detects music over USB

Hi,
I use my telephone with a second sd card in the car through usb.
Appearently the car only finds and indexes the first sd card.
Is there a way to mount the sceond card as a directory on the first card?
Kind Regards
Guy F
I found a file vold.fstab in my /etc/system but there's no info regarding the second sd card?
Can I safely edit and how?
# Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################
#FIXME: Swap again?
# internal sdcard
dev_mount emmc /storage/sdcard1 auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2
# external sdcard
dev_mount sdcard /storage/sdcard0 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0
I have looked here
http://forum.xda-developers.com/showthread.php?t=1922272
http://forum.xda-developers.com/showthread.php?t=1724287
http://forum.xda-developers.com/showthread.php?t=1785245
but I can't seem to get it to work
Anybody?
Forssound said:
I have looked here
http://forum.xda-developers.com/showthread.php?t=1922272
http://forum.xda-developers.com/showthread.php?t=1724287
http://forum.xda-developers.com/showthread.php?t=1785245
but I can't seem to get it to work
Anybody?
Click to expand...
Click to collapse
It seems I found a solution here http://forum.xda-developers.com/showthread.php?t=1511619
In brief
install a app like SSHDroid
on your desktop connect with putty to your phone so hook up your phone with the usb cable
login is or was "root" and password is "admin"
ls /dev/block/vold will give you some figures 179.0 179.2 179.2 179.8 179.9
ls /dev/block/platform will give some folders s3c-sdchi.0 s3c-sdchi.2 s5pc110-onenand
One can chose between several ways how the folders appear on a windows explorer folder
like a USB stick or a mediaplayer
setprop persist.sys.usb.config mtp,adb results in the little walkman icon on your explorer
setprop persist.sys.usb.config mass_storage,adb results in the appearing of a usb stick
mount is also a commando when given alone which will show you everything that is mounted
In the putty window i did a feel free to experiment
setprop persist.sys.usb.config mass_storage,adb
echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file"
This would result in the appearing of a USB stick with name sdcard on your file explorer in windows.
To make this flash persistent
Look if your rom has support for userinit.d or bootcompletehook.sh somewhere in /data
cm 10.1 has support for userinit.d
in /system/etc/init.d I found 2 files 00banner and 90userinit
vi /system/etc/init.d/90userinit is this
#!/system/bin/sh
# call userinit.sh and/or userinit.d/* scripts if present in /data/local
if [ -e /data/local/userinit.sh ];
then
log -p i -t userinit "Executing /data/local/userinit.sh";
logwrapper /system/bin/sh /data/local/userinit.sh;
setprop cm.userinit.active 1;
fi;
if [ -d /data/local/userinit.d ];
then
logwrapper busybox run-parts /data/local/userinit.d;
setprop cm.userinit.active 1;
fi;
now the folder wasn't there so
mkdir /data/local/userinit.d
in this folder make a file.The name isn't important
cd /data/local/userinit.d
vi mountsdcard
setprop persist.sys.usb.config mass_storage,adb
echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file
make sure you give rights to this file and the folder one can do that with es file explorer or probable
chmod 751 mountsdcard
I think that's it
This will mount your second sdcard (if you have one ) on your windows like a usb stick. It will do this even if your phone isn't completely started up.
You will not have to do a "mount usb" on your phone. If you do this anyway your first card is also mounted.
This is a neat trick to make your CAR find your music on your phone. If your car has a usb port and the functionality to play music from usb sticks.
Kind Regards
Guy
I tried doing the same by bind-mounting the external_sd on a folder on the internal_sd:
Code:
mount -o bind /storage/sdcard1 /storage/sdcard0/external_sd/
In the terminal it worked like a charm, but i couldn't get it to work at boot. Have you any other ideas?
Wouldn't it be easier to just mount the ext SD to a folder on the internal SD? This seems like 100 times the work really needed.
I can't recall atm how mounting of SD cards works, but if I had this problem I'd probably just put the songs in a .img file and mount that with
mount -o loop -t auto /storage/sdcard1/music.img /storage/sdcard2/music/
Sent from my GT-I9000 using xda premium
Yeah thats kinda what i thought of. But my init script is not getting executed or at least there is no effect of it.
I assume you've tested it with terminal output, what doesn't work about it? :/
Sent from my GT-I9000 using xda premium
I don't know what you mean, to be honest. I know that init.d should write the logs somewhere but couldn't find out where they are written to.
Edit: when i try to execute the command above it works, but it doesn't work with init.d
wget21 said:
I tried doing the same by bind-mounting the external_sd on a folder on the internal_sd:
Code:
mount -o bind /storage/sdcard1 /storage/sdcard0/external_sd/
In the terminal it worked like a charm, but i couldn't get it to work at boot. Have you any other ideas?
Click to expand...
Click to collapse
Read my large post..... It works on reboot and flash... I have tested it in my car and on my PC..
wget21 said:
I don't know what you mean, to be honest. I know that init.d should write the logs somewhere but couldn't find out where they are written to.
Edit: when i try to execute the command above it works, but it doesn't work with init.d
Click to expand...
Click to collapse
Well, for what it's worth you can use CM File Manager to add a shortcut on your home screen if you're on a ROM with Trebuchet Launcher, do that with the executable file and you can at least launch it easily when needed...
With pretty much any other launcher custom shortcuts are supported as is, Trebuchet for some reason lacks it.
(I loathe init.d)
Sent from my GT-I9000 using xda premium
I have now made a script in rom toolbox which does the job, but i'm not very happy with this. I'd prefer doing this simple bind-mount with init.d
@Forssound: Your solution seems to me a bit complicated, just for this simple task.

Categories

Resources