How to add gpio button on Raspberry Pi 3B?

I try to add a reset gpio button on Raspberry Pi 3B, i try add the following code into /arch/arm/boot/dts/bcm2710-rpi-3-b.dts.

&keys {
        compatible = "gpio-keys-polled";
        poll-interval = <20>;

        reset {
                label = "reset";
                gpios = <&gpio 28 0>;
                linux,code = <0x198>;

But when i build with make -j1 V=s, it report eror:

Error: arch/arm64/boot/dts/broadcom/../../../../arm/boot/dts/bcm2710-rpi-3-b.dts:190.1-6 Label or path keys not found
FATAL ERROR: Syntax error parsing input tree
scripts/Makefile.lib:294: recipe for target 'arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb' failed
make[7]: *** [arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb] Error 1
scripts/ recipe for target 'arch/arm64/boot/dts/broadcom' failed
make[6]: *** [arch/arm64/boot/dts/broadcom] Error 2
arch/arm64/Makefile:140: recipe for target 'dtbs' failed

What should I do?

1 Like