How to modify a DTS and .env file

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu

Which version of system do you use? Please provide the version of the system here:

5.15 ubuntu

Please describe your issue below:

hello,I modified the DTS file according to the official documentation. Is this correct? For example, I want to disable the uart-tx function and use J16 (GPIOA_7)

  1. Create a uart3.dts file and compile it into a uart3.dtbo file according to the command
  2. Move uart3.dtbo to /boot/dtb/amlogic/kvim3.dtb.overlays (does this directly overwrite the original file?)
  3. How do I modify the /boot/dtb/amlogic/kvim3.dtb.overlay.env file? If I want to disable multiple functions (uart3, spdifout) and release multiple GPIOs, how do I modify it? (I don’t understand the syntax very well. Is it like this: fdt_overlays = uart3 spdifout? Or fdt_overlays = uart3, spdifout)

Post a console log of your issue below:

I followed this operation before and modified the .env file: fdt_overlays=uart3. After reboot, I could not enter the boot interface.

@Akina uart3 is disabled by default. What have you written in your custom dtbo file ?

Overlays must be written in one line, with single space character in between, where the first overlay is continuous after the = character.

hello
This is the dtbo file I wrote:
uart3.dts((To use J16 (GPIOA_7)):

/dts-v1/;
/plugin/;

/ {
fragment@0 {
target = <&uart_C>;

	__overlay__ {
		status = "disabled";
	};
};

};

spdifout.dts(To use J13 (GPIOA_5)):

/dts-v1/;
/plugin/;

/ {
fragment@0 {
target = <&aml_spdif>;

	__overlay__ {
		pinctrl-names = "spdif_pins","spdif_pins_mute";
		pinctrl-0 = <&spdifout &spdifin>;
		pinctrl-1 = <&spdifout_a_mute>;

		status = "disabled";
	};
};

};
overlay.env:

fdt_overlays=uart3 spdifout

If uart3 is disabled by default, which dtbo file should I modify to enable J16 to become GPIO (GPIOA_7)

@Akina please check, the pins you have mentioned J13 and J16 can be used without any modification

khadas@Khadas:~$ cat /boot/overlays/kvim3.dtb.overlay.env 
fdt_overlays=
khadas@Khadas:~$ gpio readall
 +------+-----+----------+------+---+----+-- Model Khadas VIM3/3L --+----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode |   Name   | wPi | GPIO |
 +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
 |      |     |       5V |      |   |    |       |  1 || 21 |       |    |   |      | GND      |     |      |
 |      |     |       5V |      |   |    |       |  2 || 22 | P/U   |    | 1 | ALT1 | PIN.A15  | 6   |  475 |
 |      |     |   USB_DM |      |   |    |       |  3 || 23 | P/U   |    | 1 | ALT1 | PIN.A14  | 7   |  474 |
 |      |     |   USB_DP |      |   |    |       |  4 || 24 |       |    |   |      | GND      |     |      |
 |      |     |      GND |      |   |    |       |  5 || 25 | P/U   |    | 1 | ALT0 | PIN.AO2  | 8   |  498 |
 |      |     |   MCU3V3 |      |   |    |       |  6 || 26 | P/U   |    | 1 | ALT0 | PIN.AO3  | 9   |  499 |
 |      |     |  MCUNRST |      |   |    |       |  7 || 27 |       |    |   |      | 3V3      |     |      |
 |      |     |  MCUSWIM |      |   |    |       |  8 || 28 |       |    |   |      | GND      |     |      |
 |      |     |      GND |      |   |    |       |  9 || 29 | P/D   |    | 0 | IN   | PIN.A1   | 10  |  461 |
 |      |  18 |     ADC0 |      |   |    |       | 10 || 30 | P/D   |    | 0 | IN   | PIN.A0   | 11  |  460 |
 |      |     |      1V8 |      |   |    |       | 11 || 31 | P/D   |    | 0 | IN   | PIN.A3   | 12  |  463 |
 |      |  19 |     ADC1 |      |   |    |       | 12 || 32 | P/D   |    | 0 | IN   | PIN.A2   | 13  |  462 |
 |  506 |   1 | PIN.AO10 |   IN | 1 |    |   P/U | 13 || 33 | P/D   |    | 0 | IN   | PIN.A4   | 14  |  464 |
 |      |     |     GND3 |      |   |    |       | 14 || 34 |       |    |   |      | GND      |     |      |
 |  433 |   2 |   PIN.H6 |   IN | 0 |    |   P/D | 15 || 35 | P/D   |    | 0 | IN   | PWM-F    | 15  |  432 |
 |  434 |   3 |   PIN.H7 |   IN | 0 |    |   P/D | 16 || 36 |       |    |   |      | RTC      |     |      |
 |      |     |      GND |      |   |    |       | 17 || 37 | P/D   |    | 0 | IN   | PIN.H4   | 16  |  431 |
 |  497 |   4 |  PIN.AO1 | ALT0 | 1 |    |   P/U | 18 || 38 |       |    |   |      | MCU-FA1  |     |      |
 |  496 |   5 |  PIN.AO0 | ALT0 | 0 |    |   P/U | 19 || 39 | P/D   |    | 0 | IN   | PIN.Z15  | 17  |  426 |
 |      |     |      3V3 |      |   |    |       | 20 || 40 |       |    |   |      | GND      |     |      |
 +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
khadas@Khadas:~$ echo 433 | sudo tee /sys/class/gpio/export
[sudo] password for khadas: 
433
khadas@Khadas:~$ echo 434 | sudo tee /sys/class/gpio/export
434
khadas@Khadas:~$ echo 506 | sudo tee /sys/class/gpio/export
506
khadas@Khadas:~$ ls /sys/class/gpio
export	 gpio434  gpiochip402  gpiochip496
gpio433  gpio506  gpiochip410  unexport

Attained by following this guide: VIM3/3L GPIO Header [Khadas Docs]