# Create a Server for FwUpdate

**URL:** <https://forum.legato.io/t/create-a-server-for-fwupdate/6744>\
**Category:** Uncategorized\
**Created:** [May 22, 2024, 6:44pm UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744 "2024-05-22T18:44:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gi1](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gi1](https://forum.legato.io/u/gi1)\
**Post date:** [May 22, 2024, 6:44pm UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/1 "2024-05-22T18:44:09Z")

</div>

Hello,  
I’m tring to download a firmware update from a remote server. Some points are not clear to me:

1. The listening server what kind of service have to expose? http? ftp?
2. What’s the default port to listen?

once I have the firmware server up, can I issue the command fwupload download myfilename.cwe XXX.XXX.XXX.XXX ?

regards.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [May 23, 2024, 1:11am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/2 "2024-05-23T01:11:17Z")

</div>

1. can you install vscode + leaf in the remote machine?  
If yes, you don’t need to care those protocol and listening port

> **[fwupdate - Legato Docs](https://docs.legato.io/latest/toolsHost_fwupdate.html)**
>
> legato™ is an open source Linux-based embedded platform designed to simplify connected IoT application development

1. If the firmware download process is triggered by module, you can just set up a http server or ftp server. Module can download the required firmware to /tmp folder from these server by http/ftp protocol. After that module can start the firmware upgrade by “fwupdate download /tmp/xxx.cwe”.

2. If the firmware download process is triggered by server, you can use this sample application fwupdateDownloader

> **[legato-af/apps/sample/fwupdateDownloader at master · legatoproject/legato-af](https://github.com/legatoproject/legato-af/tree/master/apps/sample/fwupdateDownloader)**
>
> Legato Application Framework. Contribute to legatoproject/legato-af development by creating an account on GitHub.

It will listen to port 5000 after running the application in module, and the host PC needs to send the image through TCP (e.g. “nc64 -w 120 123.123.123.123 5000 \< legato\_test.cwe”)  
Since there is firewall setting in module, you need to first enter “iptables -I INPUT -j ACCEPT” to disable the module’s firewall.

---

<div class="post-metadata">

**Author:** ![gi1](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gi1](https://forum.legato.io/u/gi1)\
**Post date:** [May 23, 2024, 7:38am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/3 "2024-05-23T07:38:36Z")

</div>

Thank you so much. My actual approach is to have a tftp server and get new firmware. Unfortunatly I have to download all the legaco.cwe (round 5,8 Mb) and this can be very slow.  
I cant just download new apps only cause in some cases the devices running version (even if marked as good) goes back to a previus version.

Gianmaria

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [May 23, 2024, 7:45am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/4 "2024-05-23T07:45:14Z")

</div>

TFTP uses User Datagram protocol which doesn’t establish a connection and therefore cannot guarantee that files to get to their destinations

If you concern the rollback of version which will make the application disappear, I would suggest you to embed the app into legato image

> [@Flash size wp7607](https://forum.legato.io/t/flash-size-wp7607/3805/35):
>
> you can go to legato-19.02.0/modules/WiFi/wifi.sdef, under “apps:” section, add e.g. $LEGATO\_ROOT/apps/sample/helloWorld/helloWorld.adef [image] Now the new app will be included in legato.cwe. Please also note that the max size for legato partition is 8MB.

---

<div class="post-metadata">

**Author:** ![gi1](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gi1](https://forum.legato.io/u/gi1)\
**Post date:** [May 23, 2024, 7:56am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/5 "2024-05-23T07:56:44Z")

</div>

That’s what i do. Embedd everything in the legato build. About tftp I’ve tried to do a wget of firmware, but many times the file i receive is corrupted.  
What i really need is to exclude every useless part from my legato build (useless apps, other resources i will never use) to have a smaller footprint.

Gianmaria

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [May 23, 2024, 8:03am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/6 "2024-05-23T08:03:25Z")

</div>

As said before, tftp is not suggested as it is not reliable

---

<div class="post-metadata">

**Author:** ![gi1](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gi1](https://forum.legato.io/u/gi1)\
**Post date:** [May 23, 2024, 8:05am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/7 "2024-05-23T08:05:53Z")

</div>

What you suggest to use? Ftp? It seems i dont have any built in tools for ftp transfer…

Regards,  
Gian

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [May 23, 2024, 8:07am UTC](https://forum.legato.io/t/create-a-server-for-fwupdate/6744/8 "2024-05-23T08:07:01Z")

</div>

you can use another busybox:

> [@FTP file creation](https://forum.legato.io/t/ftp-file-creation/3469):
>
> Hi, I wrote an FTP client code . I am unable to establish connection. No tcp server is on the server side. there is an ftp server. suggest me what is wrong in it. i am using legato 16.07 on mangohred 750x module. Thank You, K Subrahmaniam

Furthermore, how about http server?  
you can use wget or curl to get the file

Lastly, here says you can use wget to get FTP file:

> <https://serverfault.com/questions/357576/ftp-file-download-using-wget>
