How to add the ArduPilot firmware to the Arduino Mega?

First of all, I am sorry if I am posting this in the wrong category, as I am new in the ArduPilot forum.
Can I load the ArduPilot software onto the Arduino Mega? I know it works on the mega2560 as ArduPilot is based on that, but I don’t want to use an APM 2.8 board or any ready-made one. I can’t find any tutorial on this that’s why I’m asking here. Thanks!

Nope. ArduPilot hasn’t supported the Mega for many years now.

But isn’t it based ON the Mega 2560?

It was- at the time there was a couple of thousands of lines of code now we are talking hundred of thousands lines of code = no match for this legacy entry level family of processors

So you can try recreate the past, but don’t expect support as we are looking forward and expanding capabilities with new generation of processors