User overlay on Armbian
Add new dts file to /boot/overlay-user
cd /boot/overlay-user more example https://github.com/armbian/sunxi-DT-overlays/tree/master/examples
e.g. power-button.dts
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
/*
* This fragment is needed only for the internal pull-up activation,
* external pull-up resistor is highly recommended if using long wires
*/
fragment@0 {
target = <&pio>;
__overlay__ {
gpio_button_0: gpio_button_0 {
pins = "PA17";
function = "gpio_in";
bias-pull-up;
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
gpio-keys-user {
/*
* Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins
* add "poll-interval" property if using "gpio-keys-polled"
*/
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&gpio_button_0>;
power_button {
label = "GPIO Key Power";
linux,code = <116>; /* KEY_POWER, see include/uapi/linux/input-event-codes.h */
gpios = <&pio 0 17 1>; /* PA17 GPIO_ACTIVE_LOW */
};
};
};
};
};
e.g. rtc.dts
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
/*
* Aliases can be used to set the external RTC as rtc0
* Needs supplying the correct path to the I2C controller RTC is connected to,
* this example is for I2C0 on H3
* NOTE: setting time at boot by the kernel
* may not work in some cases if the external RTC module is loaded too late
*/
fragment@0 {
target-path = "/aliases";
__overlay__ {
rtc0 = "/soc/i2c@01c2b000/ds3231@68";
};
};
fragment@1 {
target = <&i2c0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
ds3231@68 {
compatible = "dallas,ds3231";
reg = <0x68>;
status = "okay";
};
};
};
};
Compile dts file
armbian-add-overlay power-button.dts
Example
root@nanopineo:/boot/overlay-user# armbian-add-overlay power-button.dts
Compiling the overlay
Copying the compiled overlay file to /boot/overlay-user/
Overlay power-button was already added to /boot/armbianEnv.txt, skipping
Reboot is required to apply the changes
root@nanopineo:/boot/overlay-user#