How to Do Kernel Modification

Hi,

Does anyone know how to modify the kernel of M4, M2U, or M2Plus Raspbian or Ubuntu to make it’s GPIO pins function exactly as the GPIO pins of Raspberry Pi 3 with Raspbian OS?