# How to add new service?

**URL:** <https://forum.legato.io/t/how-to-add-new-service/2630>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [August 28, 2017, 11:46am UTC](https://forum.legato.io/t/how-to-add-new-service/2630 "2017-08-28T11:46:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lichen](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@lichen](https://forum.legato.io/u/lichen)\
**Post date:** [August 28, 2017, 11:46am UTC](https://forum.legato.io/t/how-to-add-new-service/2630/1 "2017-08-28T11:46:50Z")

</div>

Hi all,

How can I add new service .api files into the development environment? I want to add the gpioExpanderService from [https://github.com/mangOH/GpioExpander](https://github.com/mangOH/GpioExpander) into the legato framework. I put the folder in legato/apps/platformServices, but the service cannot be found by the build tool.

How can I do this right?

Thx.

Already solved. It was because I wrote the binding wrong.

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dfrey/32/563_2.png) [@dfrey](https://forum.legato.io/u/dfrey)\
**Post date:** [August 28, 2017, 3:00pm UTC](https://forum.legato.io/t/how-to-add-new-service/2630/2 "2017-08-28T15:00:40Z")

</div>

Hi Lichen,

You don’t need to move the location of the GpioExpader app. You can clone it to any location and then just add a references to it in your system definitions file. Alternatively, you can just built the app by itself. I always prefer to build a system though because the Legato build tools can catch errors in application binding that way.

---

<div class="post-metadata">

**Author:** ![lichen](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@lichen](https://forum.legato.io/u/lichen)\
**Post date:** [August 29, 2017, 7:30am UTC](https://forum.legato.io/t/how-to-add-new-service/2630/3 "2017-08-29T07:30:59Z")

</div>

Thank you dfrey. By building the app do you mean install it onto the wp module (or any other target that’s feasible) ?

BTW, the system definition file that I have to add the reference in is default.sdef or localhost.sdef? After adding it I have to mksys right?

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [August 29, 2017, 10:52pm UTC](https://forum.legato.io/t/how-to-add-new-service/2630/4 "2017-08-29T22:52:18Z")

</div>

It would be more the default.sdef. The localhost.sdef is only used when doing `make localhost`.

Note that you can already create your own sdef that includes modules/WiFi/wifi.sdef (or default.sdef if you do not want WiFi).

For instance you have a look at the mangOH sdef files: [https://github.com/mangOH/mangOH/blob/master/](https://github.com/mangOH/mangOH/blob/master/)  
They also demonstrate how to build things through a Makefile: [mangOH/Makefile at master · mangOH/mangOH · GitHub](https://github.com/mangOH/mangOH/blob/master/Makefile)

---

<div class="post-metadata">

**Author:** ![lichen](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@lichen](https://forum.legato.io/u/lichen)\
**Post date:** [August 30, 2017, 10:20am UTC](https://forum.legato.io/t/how-to-add-new-service/2630/5 "2017-08-30T10:20:17Z")

</div>

Thank you CoRfr. Regarding the makefile, when I make it, an error message always appears saying “unexpected character “#””, while the # is from the line in mangOH\_Green.sdef including wifi.sdef

> #include “$LEGATO\_ROOT/modules/WiFi/wifi.sdef”

Well, how can this happen?

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/daav/32/64_2.png) [@daav](https://forum.legato.io/u/daav)\
**Post date:** [September 4, 2017, 5:53am UTC](https://forum.legato.io/t/how-to-add-new-service/2630/6 "2017-09-04T05:53:48Z")

</div>

Hi @lichen

AFAIR “Xdef” files inclusion is supported from Legato 17.05, not earlier.  
If you’re using an older Legato version, unfortunately you’ll have to replicate the content of **wifi.sdef** into your own sdef.

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dfrey/32/563_2.png) [@dfrey](https://forum.legato.io/u/dfrey)\
**Post date:** [September 6, 2017, 4:14pm UTC](https://forum.legato.io/t/how-to-add-new-service/2630/7 "2017-09-06T16:14:23Z")

</div>

Hi lichen,

As daav mentioned, including other sdefs is a Legato 17.05 feature. The mangOH SDEFs have been updated to use this feature and thus the mangOH SDEFs must be built using Legato 17.05 or newer.
