Flash Xperia devices with Flashtool

Hello!
I have a Xperia V (LT25i) , In the past I flashed my device with windows (running windows in bhyve). Flashtool is written in java so you can run it in FreeBSD too,
but there is a problem: flashtool uses a native library (libusbx) via JNA (java native access) to access usb interface.
This is almost all thing you need to solve, I'll say how to do that later so we'll go from start:

1. Download and extract compiled flashtool from flashtool repository in github: You need Linux version. windows version won't work.
The latest version will work, but if you have a device from 2012 or older (like me) you need to download 0.9.18.3 or an older version,
because newer flashtool versions won't flash your device (other things like imei working well) its right for windows, linux or mac hosts not a freebsd problem!

2. Now before you run program, you need to find a libusb for freebsd (the bundled libusbx is a linux shared library). fortunatly you don't need to search for that! FreeBSD libusb will be enough with some tweaks, so if you have source tree installed, copy libusb into other place. if not simply downlaod FreeBSD Source Tree.
Code:
cp -r /usr/src/lib/libusb /tmp/
cd /tmp/libusb/

The reason we copied libusb source into other place is.... Flashtool need (actualy I'm not sure about "need") at least 1.0.15 and freebsd libusb version is 1.0.0. fortunatly changing libusb version in source code will fix this problem:
open libusb10.c with your text editor and go to line 77 and change 0 to 15 Thats all! you can see libusb_get_version function that returns the struct we changed and flashtool use this to know version. now save and exit and make!
now copy libusb.so.3 to Flashtool directory with name libusbx-1.0.so.0.1.0:
Code:
cp libusb.so.3 /path/to/Flashtool
cd /path/to/Flashtool

3. Now you can run program like this to see thats working or not:
Code:
java -Djava.library.path=./ -Djna.library.path=./ -cp x10flasher.jar:x10flasher_lib/swtlin/swt64.jar gui.Main -console --action=imei
After run connect your phone in flash mode when program said to see the result.

4. If step 3 was successful and printed phones IMEI, you can flash your phone (you need ftf file of your model)
sh:
java -Djava.library.path=./ -Djna.library.path=./ \
        -cp x10flasher.jar:x10flasher_lib/swtlin/swt64.jar
        gui.Main -console --action=flash --file=romfile.ftf \
        --wipedata=no --wipecache=no --baseband=no --system=no --kernel=no
Thats All.
The reason I not use GUI is swt64.jar working only for linux and I haven't swt installed to test GUI.
 
Back
Top