Can I move the OS X that was preinstalled on my MacBook pro to a VM running on the MacBook Pro? I would like to run linux as the primary operating system on my MacBook Pro to replace the OS X that was pre-installed with the MacBook.

I would then like to run OS X inside a virtualbox guest running on the MacBook.


Is this configuration legal from a licensing perspective?
My mac book was pre-installed and there wasn't an installation CD in the box.  How can I get the OS X installation image for installing into Virtualbox?


UPDATE:
I have NOT purchased a copy of OS X, and I do not wish to purchase one either :)
You could try to download the Yosemite installer (or another OSX version if your "purchased" it earlier) and try if you can install a virtual machine with it. You could also visit this link (it is for parallels, but maybe it will also work with virtual box): http://kb.parallels.com/en/118806