Here's a way of triple-booting Android, Firefox OS and Ubuntu on a Nexus 4: http://www.droidviews.com/how-to-triple-boot-nexus-4-on-andr...
It relies on a piece of kernel infrastructure called kexec-hardboot which to me sounds like black magic - it's like normal kexec but also resets all the peripherals so that they can be reinit by the new kernel. Magic.