Home Forums Gallery FAQs Downloads
 
 

Go Back   Meizu Me > General > Community Development > Rockbox

Register Today!  

Using DFU Tool on Linux using QEMU

This is a discussion on Using DFU Tool on Linux using QEMU within the Rockbox forums, part of the Community Development category; I've done an experiment with my M6 SP on using DFU Tool inside QEMU on Linux. The answer is currently ...



Reply
 
Thread Tools Display Modes
Old 05-26-2008   #1
Member
 
Join Date: Jan 2008
Location: Indonesia
Posts: 106
Using DFU Tool on Linux using QEMU

I've done an experiment with my M6 SP on using DFU Tool inside QEMU on Linux. The answer is currently "maybe".

Preparation:
1. Get the USBID of the DFU device: Put the device into DFU mode and connect it to the computer, then use lsusb to see the USBID.
2. Install Windows XP inside QEMU, and then install DFU Tool on it.
3. Copy M6.EBN into the DFU Tool folder in the Windows XP installation.

Steps:
1. Mount usbfs at /proc/bus/usb.
2. Run QEMU as root. Remember to enable the USB option (-usb).
3. Hold the M and Play buttons, then connect the M6 to the computer.
4. Switch to the QEMU Monitor and add the usb device: usb_add host:0419:0141 (the USBID's for other models might be different).
5. Switch back to the Windows XP desktop and run the DFU Tool.
6. See that the device is detected, then press the "Download" button.

My QEMU crashed at this point. This is the dmesg line:
qemu[6429]: segfault at 220a2ec ip b7c40810 sp bfdfddec error 4 in libc-2.6.1.so[b7bd9000+12e000]

That's why I said the answer is "maybe": maybe there is a bug in QEMU that prevents the download process from starting correctly. But there is certainly hope
wpyh nincs online   Reply With Quote
Old 06-13-2008   #2
Passing By
 
Join Date: Feb 2008
Location: Europe
Posts: 5
My Meizu
Wine?

Excuse my simple question :-) Did someone try to use wine already?
Otherwise, what are the experiences with the opensourcedfu-utils ?
Lastly, we could always reverse engineer the usb protocol in windows and implement it in linux.. although I do prefer an easier solution since time is limited
Wbdsgnr nincs online   Reply With Quote
Old 06-13-2008   #3
Passing By
 
Join Date: Jan 2008
Posts: 3
What I don't get on wpyh Method:
If you're willing to install WinXP on QEMU, you could as well install WinXP on a different partition and do a dual-boot.

@Wbdsgnr: I think I read somewhere here, that the opensource dfu-utils aren't compatible to the samsung(?) version of dfu the M6 uses
fnord23 nincs online   Reply With Quote
Old 06-16-2008   #4
Member
 
Join Date: Jan 2008
Location: Indonesia
Posts: 106
I'll answer some of the questions here:

1. I can't speak for markun, but he's tried using wine to run the DFU tool but failed. This is because wine doesn't export the hardware, it just provides the Windows API.

2. I'm installing WinXP on QEMU precisely because I don't want to dual boot. Why should I? Linux gives me a very good working environment, and I feel lost in Windows (XP, Vista, whatever). Dual booting is also very inconvenient. That, and I've allocated the whole harddisk to Linux.

3. The dfu-util software (currently) can't flash the Meizu. I don't know but fnord23 may be right about the dfu versions. From my experiments, it seems to send data to the Meizu, but the player doesn't do a firmware update.
wpyh nincs online   Reply With Quote
Old 06-16-2008   #5
Member
 
Th3_uN1Qu3's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 210
My Meizu
Low-level programs such as DFU tools cannot be emulated because they need direct access to the hardware and an emulator or compatibility layer like QEMU or WINE won't let the program do direct hardware access as it has to pass through them first. I doubt a virtual machine would work either.
__________________
Meizu Playlist Converter!
Th3_uN1Qu3 nincs online   Reply With Quote
Old 06-18-2008   #6
Member
 
Join Date: Jan 2008
Location: Indonesia
Posts: 106
Well, the DFU tool does access hardware directly, and QEMU has a USB passthrough mode / feature / option. That USB passthrough feature is what I'm using. And since QEMU talks directly with the hardware, I expected it to work.

Now that might mean that the DFU tool tries to disconnect and reconnect the USB again, but I think the crash is due to a QEMU bug.
wpyh nincs online   Reply With Quote
Old 06-19-2008   #7
Member
 
Th3_uN1Qu3's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 210
My Meizu
Originally Posted by wpyh View Post
Well, the DFU tool does access hardware directly, and QEMU has a USB passthrough mode / feature / option. That USB passthrough feature is what I'm using. And since QEMU talks directly with the hardware, I expected it to work.

Now that might mean that the DFU tool tries to disconnect and reconnect the USB again, but I think the crash is due to a QEMU bug.
Even if it has such a mode (i have used QEMU several times but did not know about this feature), chances are it's going to be very buggy and highly dependant on the OS you run QEMU on.
Th3_uN1Qu3 nincs online   Reply With Quote
Old 06-20-2008   #8
Member
 
Join Date: Jan 2008
Location: Indonesia
Posts: 106
There is a short description of that feature here: QEMU

Originally Posted by Th3_uN1Qu3 View Post
it's going to be very buggy
Yes, it is indeed buggy, otherwise my post would contain instructions on how to successfully run DFU tool that way.

Originally Posted by Th3_uN1Qu3 View Post
and highly dependant on the OS you run QEMU on.
Yes, this is also a known fact. I forgot to mention that I'm running QEMU on Linux. Sorry for any confusion this might have caused.
wpyh nincs online   Reply With Quote
Old 08-24-2008   #9
Member
 
Join Date: Jan 2008
Location: Indonesia
Posts: 106
It is now possible to do a DFU restore on Linux, using VirtualBox.

Preparation:
1. Install Windows XP inside QEMU, and then install DFU Tool on it.
2. Copy M3.EBN, M6.EBN or M6SL.EBN into the DFU Tool folder in the Windows XP installation.

Steps:
1. Mount usbfs at /proc/bus/usb.
2. As root, loop every 0.5 seconds to chown all the files in /proc/bus/usb to the username you are using.
3. Run VirtualBox. Remember to enable USB support for the VM.
4. Hold the M and Play buttons, wait 2 seconds, then connect the device to the computer.
5. Release the Play button.
6. Connect the device to VirtualBox.
7. Run DFU Tool, then press "Download" button.
8. Unplug device.

Notes:
1. The Play button must be released after connecting the device to the PC, otherwise it will power off after a few seconds.
2. Keep the M button pressed down through the recovery procedure.
3. If anything fails, start over.
wpyh nincs online   Reply With Quote
Old 08-24-2008   #10
Valued Member
 
JkPwNsTeR's Avatar
 
Join Date: Jul 2008
Location: Canada
Posts: 1,033
My Meizu
So in other words, just forget it because no one wants to buy a second Windows XP license. Seriously, if you're going to do it legally, you need one. Just buy a new miniPlayer/musicCard.
JkPwNsTeR nincs online   Reply With Quote
Old 08-27-2008   #11
Member
 
Join Date: Jan 2008
Location: Indonesia
Posts: 106
(this is very similar to my previous post, but I'll just copy the whole thing to make it easier to follow)

I've figured out the DFU suffix part of the DFU restore operation using VirtualBox on Linux. We would need the current CVS libpcap and Wireshark for this. Wireshark is very helpful here, since it allows us to monitor everything that's going on between the device and the DFU tool.

As always, preparation:
1. Install Windows XP inside QEMU, and then install DFU Tool on it.
2. Copy M3.EBN, M6.EBN or M6SL.EBN into the DFU Tool folder in the Windows XP installation.
3. Download, compile and install the current CVS version of libpcap.
4. Recompile Wireshark against the new libpcap.

Steps:
1. Mount usbfs at /proc/bus/usb.
2. As root, loop every 0.5 seconds to chown all the files in /proc/bus/usb to the username you are using.
3. Run VirtualBox. Remember to enable USB support for the VM.
4. Run Wireshark, then start a capture on the appropriate USB port.
5. Hold the M and Play buttons, wait 2 seconds, then connect the device to the computer.
6. Release the Play button.
7. Connect the device to VirtualBox.
8. Run DFU Tool, then press "Download" button.
9. Unplug device.
10. Stop and save the capture.

Notes:
1. The Play button must be released after connecting the device to the PC, otherwise it will power off after a few seconds.
2. Keep the M button pressed down through the recovery procedure.
3. If anything fails, start over. Remember to restart the capture in Wireshark.
wpyh nincs online   Reply With Quote
Reply


Thread Tools
Display Modes

Hot Deals for Meizu & Related Products Related Threads
All times are GMT. The time now is 05:05 AM.







   
 
Meizu Me is an independent resource for all things Meizu. All rights reserved. Powered by vBulletin. Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc. Meizu M8, miniPlayer and all related names are properties of MEIZU Electronic Technology, Inc. Copyright 2008 Meizu Me.