Linux: Flashing Firmware on the DC Darknet Badge for DEF CON 31


Being the contrarian that I am, I don't run Windows or Mac OS on any of my workstations. As a result my path to flashing firmware on the DC 31 Darknet badge is a little more complicated. This post walks through what I did to get the badge setup without using the 'web flasher'.

Here's a picture of the device:

References

System Preparation

  • Run a recent debian-based linux distribution (I'm on Ubuntu 22.04)
  • Open a shell and run these commands to install the firmware flasher:
sudo apt install esptool
pip install --upgrade esptool
  • Download the firmware files from Downloads | Meshtastic
    • Scroll down to the Firmware section and click on the Download Stable button

  • Unzip the stable firmware
  • Navigate to the firmware folder in your Terminal

Sanity Check and Firmware Installation

  • Within your terminal, check to ensure the USB tty interface is recognized (You'll see USB Single Serial if successful):
$ lsusb | grep USB
Bus 009 Device 011: ID 1a86:55d4 QinHeng Electronics USB Single Serial
  • Next, run this to validate your chip type (Check for a Chip type of ESP32-PICO-D4):
# esptool chip_id
esptool.py v2.8
Found 1 serial ports
Serial port /dev/ttyACM0
Connecting....
Detecting chip type... ESP32
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: d4:d4:d4:d4:d4:d4
Enabling default SPI flash mode...
Warning: ESP32 has no Chip ID. Reading MAC instead.
MAC: d4:d4:d4:d4:d4:d4
Hard resetting via RTS pin...
  • Time to flash the firmware! Ensure you are in the firmware directory that you downloaded
    • The firmware to deploy is the firmware-tlora-v2-1-1_6
    • Be sure to select the .bin file and not the '-update.bin' file as we want a clean flash
# sh ./device-install.sh firmware-tlora-v2-1-1_6-2.1.19.eb7025f.bin 
Trying to flash firmware-tlora-v2-1-1_6-2.1.19.eb7025f.bin, but first erasing and writing system information
esptool.py v4.6.2
Found 1 serial ports
Serial port /dev/ttyACM0
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-PICO-D4 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: d4:d4:d4:d4:d4:d4
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 6.1s
Hard resetting via RTS pin...
esptool.py v4.6.2
Found 1 serial ports
Serial port /dev/ttyACM0
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-PICO-D4 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: d4:d4:d4:d4:d4:d4
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00203fff...
Compressed 2113072 bytes to 1269792...
Wrote 2113072 bytes (1269792 compressed) at 0x00000000 in 111.1 seconds (effective 152.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
esptool.py v4.6.2
Found 1 serial ports
Serial port /dev/ttyACM0
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-PICO-D4 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: d4:d4:d4:d4:d4:d4
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00260000 to 0x002f7fff...
Compressed 618624 bytes to 374028...
Wrote 618624 bytes (374028 compressed) at 0x00260000 in 32.8 seconds (effective 150.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
#

Final word

While it would have been easier to use the Meshtastic Web-Flasher [youtube] I don't regret following the True Terminal Path ;)

See you all at DEF CON next week!