We are involved in developing Moto Mods for the Lenovo Motorola Moto Z series of phones.
The hardware side is based off of their MDK:
https://developer.motorola.com/documentation/mdk-overview-0
Our hardware project is a matter of another blog post, but let me outline the software setup i needed to begin developing.
So the basic instructions (https://developer.motorola.com/documentation/setup-environment) are for Ubuntu 16.04 but if you're using a newer distro, there is some tinkering to be done.
kconfig-frontends need this patch applied:
https://gist.github.com/KamilSzczygiel/d16a5d88075939578f7bd8fadd0907aa
(More info here: http://distortos.org/news/updated-build-instructions-kconfig-frontends/)
Also needs some love, i kept getting "Conflicting CPU architectures 13/1"
Looking at the errors pointed out here https://answers.launchpad.net/gcc-arm-embedded/+question/288338 i decided to play with the make file and changed:
CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
to
CFLAGS += -mfloat-abi=softfp
(i don't care about fpu support as long as it works;)