Well you can build from aosp or cm sources. Xiaomi doesn't have anything like that. But you can make many custom roms based on other devices. This is porting. You can e.g make a new Hongmi port based on Lenovo MTK devices. You just use other device as a base.