[Android Apps and Games] dcatoffm:
This was driving me up a tree the last few days. I've dealt with Link2SD on quirky devices before, but this one forced me to understand just how Link2SD implemented the mount script, and hooray, I got it.

Now basically, I'm assuming you already know what Link2SD is for, and I'm also assuming that your S-ON device is already rooted and you have a custom recovery partition to the likes of TeamWin or CWM installed and functioning. For my device, I have a recently rooted HTC Desire 510 acquired from FreedomPop.

With the help of DiskInfo, I determined that this device supports ext4, so that's the filesystem I'm using.

____________________

So, What's the magic file anyway? (or, How does Link2SD Work?)

Link2SD has to mount the second SD partition rather early to make sure the files on it are accessible before Android starts looking for the apps. It does this by replacing an existing binary file with its mount script. Don't worry though, before replacing it, it renames the binary file and calls it at the end of the script. The file is:

/system/bin/debuggerd

That's it, and if you want to use Link2SD on your S-ON device (without resorting to quick-reboot every other boot, which on my device at least was spitting an error for every moved app or directory), you'll need to manually do the steps Link2SD would normally do automatically. You'll need to gather some info and other preparation. I'll provide a sample script (which came from my Proscan tablet), which you must edit to match your device information before flashing.

Here's the sample script. Save as "debuggerd" :

#!/system/bin/sh
#added by link2sd
LOG=/data/link2sd-debuggerd.log
echo "$(date) mounting..." > $LOG
sleep 2
mount -t ext4 -o rw /dev/block/vold/179:2 /data/sdext2 1>>$LOG 2>>$LOG

mount -t ext4 -o rw /dev/block/mmcblk0p2 /data/sdext2 1>>$LOG 2>>$LOG

mount >> $LOG
echo "$(date) mount finished" >> $LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin

You'll notice two mount lines, these are the ones in need of edit. What you'll need to find out:

* The 2nd SD partition type. If you did the partitioning, you should already know this one. As I already mentioned, I used ext4.

* The block number of the second SD partition. I like DiskInfo for that one. The script might be okay for your device, or it might not depending on how storage is set up. The desire was mmcblk1p2.

* The vold id of the second SD partition. Vold is the standard method of managing partition mounts in Android, so is Link2SD's preferred mount method. The block number line is only included as a backup in case the mount by vold id fails. If Link2SD is already installed (and it should be) and the mount script (supposedly) created, it will have already mounted the second partition, so you should be able to go into terminal and type

mount | grep sdext2

to retrieve this number. 179:2 is typical, but my desire was something like 179:58. Best to look it up.

Make the necessary edits, then save the file somewhere accessible to your recovery, such as the root of the sd card (first partition).

Double check the mount info in the script.

____________________

The manual install.

Now for the fun part. Reboot into your custom recovery.

Make sure /system and the sd card are mounted.

Enter the file manager.

Navigate to /system/bin.

Rename debuggerd to debuggerd.bin .

..This is to match the last (exec) line in the script, and what makes the mount stage a seamless insertion into the boot process.

Navigate to where you saved the replacement debuggerd script. Select Copy.

Navigate back to /system/bin and Paste. Confirm if necessary.

Once the custom debuggerd script is copied, you'll need to make sure it's executable. Run chmod on it, something like 755 will be fine. Confirm if necessary.

You also need to make sure the mount directory exists. Navigate to /data , if it doesn't already exist, make a directory called sdext2 .

That should be it. Reboot into the system. If everything is correct, you should boot normally with the second SD partition already mounted before the apps are loaded. I have so far been running Link2SD on the Desire for about a week, and have not run into any *unusual* problems.

____________________

Disclaimer.

This method was successful for me. Your mileage may vary. Editing the system partition always has some inherent risk. What you do to your device is on you; I will not be held responsible for a boot-loop, bricking the device, random interplanetary calls, or any other damages incurred, physical, monetary, or otherwise following your reading of this post. Proceed at your own risk.

---