How to add an overlay

I would like to use GPIO pin 32 for shutting down my RADXA Zero.
For that to make to happen I’m reading
My problem is:

  1. How to add overlay: meson-g12a-gpio-shutdown.dts
  2. This needs CONFIG_KEYBOARD_GPIO_POLLED. But how built into the kernel or compile as a module?
    Could someone help me please?

Adding the overlay will depend on what distro you are using. KEYBOARD_GPIO_POLLED can be either compiled as a module or built in to the kernel.

The Distro I’m using is: Radxa Zero Debian
Without really knowing what I’m doing, I added in /boot/uEnv.txt a few overlays like: meson-g12a-gpio-shutdown.dts but that didn’t had any results.

Also when I’m running a python script I do get the following error message:

File “/usr/lib/python2.7/dist-packages/RPi/GPIO/”, line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

Did you just add lines to /boot/uEnv.txt? Or did you also compile and install the actual overlays you are trying to use? Specifying a device tree overlay in your boot script isn’t going to do anything if the overlay doesn’t actually exist.

The python error is entirely unrelated, although in this case, the error message is telling you exactly what the problem is. The standard RPi.GPIO python library only works on Raspberry Pi hardware. For this hardware, the recommendation is to use libmraa.

I’m not familiar with how to compile and install overlays. Could you please help?

See this post for a similar conversation. Just replace the overlay name with the one you’re trying to build.