# Firmware Update

## Using Ubuntu:

### Get USB Boot Utility (only needs to be done once)

First of all, you will need USB boot utility which will force the system transition into bootloader state.

Download the USBBoot tool here: [USBBootTool](https://github.com/aviaks/Sky-Drones-Docs/tree/afc9473ad52bff56c4bd76b506f26e86b52cd0d9/smartlink/downloads/smartlink-usbboot.zip)

{% file src="/files/-MZria9MfQ56S33NICYc" %}

### Force SmartLink Bootloader Mode

Once you have the boot tool, let's start it and flash the firmware.

* Open command line and locate USBBoot
* Start bootloader tool

  `sudo ./usbboot`
* Connect USB cable, turn on power supply (make sure to connect USB cable before providing power)
* After a few seconds the terminal will show that bootloader mode has been successfully enabled. Then you can proceed to flashing or saving the image file

### Flash SmartLink Image from File

* Enable bootloader mode as described in the steps above
* Use `lsblk` or `df -h` to find out the mounting point of the unit (look for 3.9GB unit since eMMC of SmartLink has this amount of flash memory)
* Locate the firmware file
* To flash image from file (make sure to set correct filename and sdX):

  `gunzip --stdout IMAGE_NAME.img.gz | sudo dd bs=4M of=/dev/sdX status=progress`

Upload process may take up to 15 minutes. Progress will be displayed on the screen.

{% hint style="info" %}
&#x20;After upload process is complete, power off SmartLink before disconnecting the USB cable.
{% endhint %}

### Save Current SmartLink as Image to File

You can save the entire eMMC of [SmartLink](https://sky-drones.com/smartlink) to image file and later flash this to another [SmartLink](https://sky-drones.com/smartlink) unit. Please follow these steps:

* Enable bootloader mode as described in the steps above
* Use `lsblk` or `df -h` to find out the mounting point of the unit (look for 3.9GB unit since eMMC of SmartLink has this amount of flash memory)
* To save currently installed image to file (make sure to set correct sdX):

  `sudo dd bs=4M if=/dev/sdX status=progress | gzip > smartlink.img.gz`

{% hint style="info" %}
&#x20;After download process is complete, power off SmartLink before disconnecting the USB cable.
{% endhint %}

## Using Windows / MacOS:

### Get Boot Tool utility for forcing the bootloader

Please ensure you are not writing to any USB devices whilst the installer is running.

1. Download and run the [Windows installer](https://github.com/raspberrypi/usbboot/raw/master/win32/rpiboot_setup.exe) to install the drivers and boot tool.
2. Once the driver installation is complete, run the exe tool that was previously installed.
3. Plug micro USB cable into the micro USB socket marked `USB` on SmartLink.&#x20;
4. Plug the other side of the USB cable in your computer.&#x20;
5. Power up SmartLink. It's important to plug in the USB cable first and only then power up SmartLink.
6. After a few seconds, the SmartLink eMMC will pop up under Windows as a disk (USB mass storage device).

### Get balenaEtcher for flashing the image

1. Download the Windows installer from [balena.io](https://www.balena.io/etcher/)
2. Run balenaEtcher and select the SmartLink OS image file
3. Select the correct storage drive (SmartLink)
4. Finally, click **Burn** to write the SmartLink OS image
5. You'll see a progress bar. Once complete, power down SmartLink first and only then unplug the USB cable.

### Recovery procedure

If your [SmartLink](https://sky-drones.com/smartlink) unit is not responding and you think eMMC might be corrupted / the device seems to be bricked, you will need to re-flash the image to eMMC. Please contact us [here](https://sky-drones.com/contact-us) and we'll provide you with the link to the latest SmartLink image file.

### Recovery images

Click below to download the recovery image. Make sure to the select the one which suits your SmartLink version:

* [SmartLink with CSI and HDMI](http://sky-drones.com/downloads/smartlink-csi.img.gz)
* [SmartLink with HDMI and HDMI](http://sky-drones.com/downloads/smartlink-hdmi.img.gz)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sky-drones.com/avionics/smartlink/firmware-update.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
