Which platform? Qualcomm, MediaTek, nVidia, TI?
I've upgraded a TI platform from Jellybean to Lollipop, Marshmallow
and Nougat. The steps are the same.
1) download sources
2) copy device/MANUFACTURER/PRODUCT to the new tree
3) disable as much as possible that isn't necessary (wifi, bluetooth,
camera, bunch of packages, SELinux to permissive, etc.)
4) get it to build, cherry pick in changes from Lollipop to M/N that
you need for it to boot (could be graphics related, or similar)
5) flash images and boot. If possible, with a UART terminal so you can
see the kernel booting. Try to get to an ADB prompt, and then fix one
issue after the other.
One change we had to make between Lollipop and Marshmallow, was to add
androidboot.hardware=PRODUCT to our kernel command line.