ANDROID: Factory Flash DroidX

Motorola Droid X SBF
http://www.multiupload.com/NYV7593UM3
http://www.multiupload.com/HS3Q4U95CG
http://rootzwiki.com/

Instructions (Linux)
1. Unzip the SBF and place VRZ_MB810_1.13.6.2_1FF_01.sbf and sbf_flash in the downloads folder
2. Put the Droid X in bootloader and connect it via usb.
3. Open a terminal window.
4.Change your directory: CD Downloads
5. Then type: ./sbf_flash VRZ_MB810_1.13.6.2_1FF_01.sbf
6. Wait and finish!

ANDROID: Superuser + Shared JNI LIBs

If you need access to system libs (in my case, uinput), you will usually need to do one of 2 things:

1. create another unix executable (binary), which will call uinput, and invoke it with su (super user). Put this file in the /raw directory, and copy it to the device during run-time. This seems to be the easier method. The source is as such:

your_copy_binary(R.raw.your_binary, getFilesDir().getAbsolutePath()+"/your_binary");
Process sh = Runtime.getRuntime().exec("su");
OutputStream os = sh.getOutputStream();
os.write("chmod 777 " + getFilesDir().getAbsolutePath() + "/your_binary" + "\n", "ASCII");
os.write(getFilesDir().getAbsolutePath() _ "/your_binary", "ASCII");

2. create a unix shared library embedded within your android app, call open(...) to directly access the system lib, give the manifest SUPERUSER permissions, and finally set the lib to chmod 777.

Here's the JNI sourcecode:
int success = open("/dev/input", O_WRONLY | O_NONBLOCK);

Here's the Manifest added permission:
< uses-permission android:name="android.permission.ACCESS_SUPERUSER" />

Here's the final step to chmod
chmod 777 /dev/uinput


I prefer the second method, because it's closer to how the android NDK was intended to run.