User Tools

Site Tools

Translations of this page:

howto:pyduml

This is an old revision of the document!


DJI Flashing & Rooting FAQ

Flashing your DJI aircraft is bloody simple with the pyduml.py script. This FAQ is based on work by vk2fro, and Dreadwing007.

1. Toolchain

Install your toolchain as per the instructions here. You only need to do this once… but check the instructions to see if there are any new tools that you may need.

2. Get the duml magic

If this is your first time using duml, you will need to checkout the code from git.

cd ~/Documents/
git clone https://github.com/hdnes/pyduml.git
cd pyduml

If you have done this before and you want to make sure you have the latest code, you just need to sync to the most recent version

cd ~/Documents/pyduml
git pull

3. Get some firmware

If you are planning to flash new firmware, you obviously need some firmware files. I am not going to publish where to find this here… If you are familiar with the right places, get your files… possibly in #archived_fw_flashing or from a git source

This step will find the TTY for connectivity to your aircraft, and store it in a file /tmp/dji.port for use later.

  • Power on your aircraft
  • Connect USB from your computer to your aircraft
  • Open a terminal window
ls /dev/tty* | sed -e "s#.*/##g" > /tmp/dji.on
  • Disconnect the USB cable
ls /dev/tty* | sed -e "s#.*/##g" > /tmp/dji.off
  • Now find what is our tty port for the aircraft
diff /tmp/dji.on /tmp/dji.off | grep "<" | sed -e "s/.* //" > /tmp/dji.port
rm /tmp/dji.on /tmp/dji.off
cat /tmp/dji.port

5. Flashing

FULLY CHARGE A BATTERY!!! do not try to flash with a depleted battery - itʼll only end in tears and a dead aircraft. If you aren't interested in changing firmware and you just want to get root access, skip ahead to the next step.

  • Put the firmware into the same folder as pyduml.py - ~/Documents/pyduml
  • Open a terminal window and go to our directory
cd ~/Documents/pyduml
  • Prepare our package for delivery - Rename the firmware
cp <yourfirmwarename> dji_system.bin
  • For example…
cp V01.03.0700_Mavic_dji_system dji_system.bin
  • Deliver the package
python pyduml.py /dev/`cat /tmp/dji.port`

Flashing takes around 10 minutes. Watch the lights on the aircraft. It may reboot during the procedure but donʼt touch it. Once it chimes and the front beacons stop flashing, its done. Be patient - 10 minutes seems like an awfully long time, but you donʼt get a progress bar like when you flash with assistant.

Do not disconnect the drone when the script says its finished - thats only the upload portion! The flashing process follows and its a good idea to leave it all alone until you hear the chimes.

Want to watch the process? if you have root, you can issue the following commands in a second terminal session:

* monitor progress with terminal if you already have root:

 adb shell
 busybox tail -f /ftp/upgrade/dji/log/upgrade00.log
  • Remove temporary file from the firmware upload that we created before
rm dji_system.bin

6. Rooting

  • Prepare our package for delivery
cp fireworks.tar dji_system.bin
  • Deliver the package
python pyduml.py /dev/`cat /tmp/dji.port`
  • Remove temporary file
rm dji_system.bin

7. Open a shell

From your terminal window

  • List adb devices. You should see RedHerring has Fangs!
adb devices
  • Connect to your aircraft via ADB
adb shell

8. Make ADB persistent

To make it easier to get back into your aircraft via ADB next time, you can add a command to the boot init script. Beware. This command is modifying a startup script. If you get it wrong, that could be … well … bad. Don't do this more than once, unless you change your firmware to re-patch the startup script.

mount -o remount,rw /system
echo /system/bin/adb_en.sh >> /system/bin/start_dji_system.sh
reboot

Credits

  • This FAQ was compiled based on work by vk2fro, and Dreadwing007.
  • Of course, we have to thank hdnes for his work, and hostile for all of his work too, not to mention the_lord for all his help as well.
howto/pyduml.1500169889.txt.gz · Last modified: 2017/07/16 01:51 by czokie