# Switching from repo to git submodules

**URL:** <https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341>\
**Category:** Uncategorized\
**Created:** [January 16, 2017, 4:37pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341 "2017-01-16T16:37:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [January 16, 2017, 4:37pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/1 "2017-01-16T16:37:07Z")

</div>

The Legato project uses the Google repo tool to manage multiple git repositories. When we were trying to figure out how to manage the mangOH source we wanted to be consistent with legato since the mangOH source code is mostly just apps on top of Legato.

The problem we have found with repo is that it isn’t supported under Windows. Another downside of repo is that it’s another tool to learn on top of git (which is already difficult enough to learn). The reason why repo isn’t really supported on Windows is that repo relies heavily on symlinks and symlinks are poorly supported on Windows.

As a result we have decided to switch from repo to git submodules to manage multiple git repositories. What this means is that how you get and build source code for mangOH will be changing a bit.

To get the mangOH source code, run `git clone --recursive https://github.com/mangOH/mangOH mangOH_from_github`

This will create a folder `mangOH_from_github` on your machine that contains only the mangOH source code and it’s submodules. If you `cd` into your `mangOH_from_github` folder, you can see which submodules are included by doing `git submodule status`. I’m not going to to through everything to do with submodules. If you’re interested, do `git help submodule`.

A notable difference between the contents of `mangOH_from_github` and what you would get using the previous `repo` based method is that there is no legato source code in `mangOH_from_github`. To build the code, you can do `make wp85` from the `mangOH_from_github` directory. This should create `mangOH_Green.wp85.update`. The system update file created will integrate the legato dependencies from your toolchain rather than an explicit legato checkout. If you want to build against a customized legato, you can still do that by following the [Legato build instruction](https://github.com/legatoproject/legato-af) and then running `make --include-dir=$LEGATO_ROOT wp85` from the `mangOH_from_github` folder. The `--include-dir` option is required so that the build system can use some files from the Legato directory.

One (rather annoying) problem is that the master branch of the mangOH repository currently requires legato 16.10 and the associated toolchain to build and I think that it’s not available publicly yet. So to remedy this I will try to create a `for_legato_16.07` branch today that will allow mangOH to be built against 16.07.

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [January 16, 2017, 6:09pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/2 "2017-01-16T18:09:39Z")

</div>



---

<div class="post-metadata">

**Author:** ![Raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Raf](https://mangoh.discourse.group/u/Raf)\
**Post date:** [January 24, 2017, 4:49am UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/3 "2017-01-24T04:49:06Z")

</div>

Hi @dfrey,

How did you go creating the remedy branch?  
Any idea when we can expect the required toolchains?

Cheers,  
Raf

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [February 2, 2017, 11:56pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/4 "2017-02-02T23:56:24Z")

</div>

Hi Raf,

I have created a `for_legato_16.07` branch in the mangOH repository. Basically the only difference is that I have deleted the mangOH Red SDEF and modified the mangOH Green SDEF so that it only includes applications which are present in legato 16.07. As with the `master` branch of the mangOH repository, build using `make -I $LEGATO_ROOT wp85`.

---

<div class="post-metadata">

**Author:** ![Kas.Lewis](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kas.Lewis](https://mangoh.discourse.group/u/Kas.Lewis)\
**Post date:** [February 16, 2017, 9:01pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/5 "2017-02-16T21:01:10Z")

</div>

Hello @dfrey,

I have tried using the “make wp85” unfortunately this does not work. I get an error.

mangoh@mangoh-virtualbox:~/mangOH/mangOH/mangOH\_from\_github$ make wp85  
Makefile:11: targetDefs.wp85: No such file or directory  
make: \*\*\* No rule to make target ‘targetDefs.wp85’. Stop.

I have also tried to build the Arduino project and I also get an error.

mangoh@mangoh-virtualbox:~/mangOH/mangOH/mangOH\_from\_github/apps/ArduinoBridge$ mkapp -t wp85 arduinoBridge.adef  
\*\* ERROR:  
/home/mangoh/mangOH/mangOH/mangOH\_from\_github/apps/ArduinoBridge/bridgeComponent/Component.cdef:21:8: error: Couldn’t find file ‘/apps/DataRouter/dataRouter.api’.

Sincerely  
Kas

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [February 16, 2017, 9:07pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/6 "2017-02-16T21:07:16Z")

</div>

> [@Kas.Lewis](#):
>
> I have tried using the “make wp85” unfortunately this does not work. I get an error.

Try `make -I $LEGATO_ROOT wp85` instead. The problem is that the `targetDefs.wp85` file is in `$LEGATO_ROOT` and `make` can’t see it unless you specify the `-I` flag.

> [@Kas.Lewis](#):
>
> I have also tried to build the Arduino project and I also get an error.
> 
> mangoh@mangoh-virtualbox:~/mangOH/mangOH/mangOH\_from\_github/apps/ArduinoBridge$ mkapp -t wp85 arduinoBridge.adef  
> \*\* ERROR:  
> /home/mangoh/mangOH/mangOH/mangOH\_from\_github/apps/ArduinoBridge/bridgeComponent/Component.cdef:21:8: error: Couldn’t find file ‘/apps/DataRouter/dataRouter.api’.

The problem here is that the `Component.cdef` file uses $MANGOH\_ROOT, but it’s not defined. Try `MANGOH_ROOT=/path/to/your/mangOH/working/copy mkapp -t wp85 arduinoBridge.adef`

---

<div class="post-metadata">

**Author:** ![Kas.Lewis](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kas.Lewis](https://mangoh.discourse.group/u/Kas.Lewis)\
**Post date:** [February 16, 2017, 9:11pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/7 "2017-02-16T21:11:09Z")

</div>

> [@dfrey](#):
>
> Try make -I $LEGATO\_ROOT wp85 instead. The problem is that the targetDefs.wp85 file is in $LEGATO\_ROOT and make can’t see it unless you specify the -I flag.

mangoh@mangoh-virtualbox:~/mangOH/mangOH/mangOH\_from\_github$ make -I $LEGATO\_ROOT wp85  
export MANGOH\_ROOT=/home/mangoh/mangOH/mangOH/mangOH\_from\_github &&   
mksys   
-C “-DPCM\_IF=“AUX”” -C “-DI2S\_IF=“PRI”” -C “-DUSB\_IF=“AFE\_PCM”” -C “-DCODEC\_IF=“PRI”” -C "-DMM\_1\_ALSA\_MIXER\_CTRL=“MultiMedia1"” -C “-DMM\_1\_ALSA\_PCM\_DEVICE\_ID=0” -C "-DMM\_2\_ALSA\_MIXER\_CTRL=“MultiMedia2"” -C “-DMM\_2\_ALSA\_PCM\_DEVICE\_ID=1” -C “-DADC\_BEGIN\_NUM=0” -C “-DADC\_COUNT=4”   
-t wp85   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/supervisor”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/positioning”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/airVantage”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/modemServices”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/atServices”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/wifi”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/secureStorage”   
-i “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/interfaces/logDaemon”   
-s “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/modules/WiFi/service”   
-s “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/components”   
-s “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/modules/WiFi/apps/tools/wifi”   
-s “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/platformServices/airVantage”   
-s “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/platformServices”   
-s “/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/tools”   
-s “/home/mangoh/mangOH/mangOH/mangOH\_from\_github/apps/GpioExpander/gpioExpanderService”   
-C -g -X -g -L -g   
mangOH\_Green.sdef  
Looked in the following places:  
‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/modules/WiFi/service’  
‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/components’  
‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/modules/WiFi/apps/tools/wifi’  
‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/platformServices/airVantage’  
‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/platformServices’  
‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/tools’  
‘/home/mangoh/mangOH/mangOH/mangOH\_from\_github/apps/GpioExpander/gpioExpanderService’  
‘.’  
\*\* ERROR:  
/home/mangoh/mangOH/mangOH/mangOH\_from\_github/mangOH\_Green.sdef:31:4: error: Can’t find definition file (.adef) for app specification ‘/home/mangoh/legato/packages/legato.framework.16.7.0.201609081601/resources/legato/apps/platformServices/spiService’.  
Makefile:19: recipe for target ‘wp85’ failed  
make: \*\*\* [wp85] Error 1

---

<div class="post-metadata">

**Author:** ![Kas.Lewis](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kas.Lewis](https://mangoh.discourse.group/u/Kas.Lewis)\
**Post date:** [February 16, 2017, 9:12pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/8 "2017-02-16T21:12:47Z")

</div>

> [@dfrey](#):
>
> The problem here is that the Component.cdef file uses $MANGOH\_ROOT, but it’s not defined. Try MANGOH\_ROOT=/path/to/your/mangOH/working/copy mkapp -t wp85 arduinoBridge.adef

I’m not sure where I should put this code, any more information would be hopeful.

Thankfully  
Kas

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [February 16, 2017, 9:19pm UTC](https://mangoh.discourse.group/t/switching-from-repo-to-git-submodules/341/9 "2017-02-16T21:19:14Z")

</div>

With regards to your first problem, you want to do `git checkout for_legato_16.07` in your mangOH folder to switch to the branch which works with 16.07. In this branch, the sdef doesn’t include the SpiService application because it was introduced in legato 16.10.

With regards to this command: `MANGOH_ROOT=/path/to/your/mangOH/working/copy mkapp -t wp85 arduinoBridge.adef`  
I am saying that you need to define an environment variable named MANGOH\_ROOT which points to the directory where you have mangOH checked out. Then just run the `mkapp` command as before.
