Switching from repo to git submodules

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 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.

Hi @dfrey,

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

Cheers,
Raf

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.

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

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.

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

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

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

Thankfully
Kas

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.