Nowadays I am building custom CM-12 (Lolipop) roms for my i9300. Building requires several libraries however they are not inside Centos baase, update and epel repositories. I do not like using other repositories. And also I know that Ubuntu have all the required packages. However I do not want to install a second Ubuntu OS on my machines with/without using virtualization.

What must I do?

There is a tool at epel repository: debootstrap. The simple usage is:

debootstrap <dist> <destpath> <repourl>

After executing command you will have a minimal a debian based, I installed ubuntu trusty, system. You can chroot to the destpath from centos. However you should have a proper kernel, centos 7 have newer kernels similar to ubuntu however centos 6 not.

Before chroot, You may want to mount /dev partition:

mount -o bind /dev <destpath>/dev

After chroot, also proc and sys

mount -t proc none /proc/
mount -t sysfs none sys/

Ta-da! You have full functional debian based os. After you modify apt list, you can install, update packages.

I installed all dependencies which CM-12 required and I am building my own nightly ROMS.

I recommend reading manual of debootstrap. You can use –include parameter to install extra packages during debootstrap. I use this parameter to much for creating virtual machines.

I may write my rapid virtual machines deployment.