There are more differences between Android devices than between different PC Machines. So you need to know things like which CPU and hardware and version of it you got in the device. Then look for an Android firmware that supports your phone. You might be able to compile your own firmware from source for your device, also depending on your devices hardware and how well you can handled fails there.
After an upgrade, your device will end up in different shape with regard to what works and not after the upgrade. It might even work flawlessly. You might even get a "bricked" device if you fail the upgrade and are a bit unlucky.
So, it all depends on what hardware you have and how good support Linux and Android has to your device hardware.
That is why the phone manufacturers and your telephone operator test the upgrades in many ways before they push it out to the customers.
But if you know this and are technical skilled and know that you might make your phone usless, you can always try.