Choose your operating system
Softpedia reports
The tool is developed by Marius Quabeck [of UbuntuFun.de] and is called magic-device-tool. The first stable version, magic-device-tool 1.0, is now available to everyone and promises to offer a simple and easy-to-use batch tool for installing Canonical's Ubuntu Touch mobile OS, as well as Android, Cyanogenmod, or Phoenix OS.
In other words, you'll be able to replace your mobile operating system on your device with any of the following: the latest Ubuntu Touch release, Cyanogenmod--with or without the GAPPS (Google Apps) package, the factory Android image, as well as Phoenix OS. Please note that you'll only be able to run one of these OSes on your mobile devices [at a time].
[It] has been successfully tested with BQ Aquaris E4.5, BQ Aquaris E5 HD, BQ Aquaris M10 HD, BQ Aquaris M10 FHD, Meizu MX 4, Meizu Pro 5, LG Nexus 4, LG Nexus 5, Asus Nexus 7 2013 WiFi, Asus Nexus 7 2013 LTE, Asus Nexus 7 2012 3G, Samsung Nexus 10, OnePlus One, and Fairphone 2 (FP2).
magic-device-tool is also good for creating backups, restoring your device, locking or unlocking the bootloader, and installing TWRP (Team Win Recovery Project) recovery.
(Score: 3, Informative) by RamiK on Tuesday October 25 2016, @06:17PM
The same one here: https://github.com/MariusQuabeck/magic-device-tool/blob/master/devices/nexus4/android/factoryimage.sh [github.com] never worked for me.
I always had to decompress image-occam-lmy48t.zip and do a few things differently to circumvent no-space-left errors.
compiling...