In the Yocto folder, the source code of the kernel is located in tmp/work/<board>/linux-imx/<version>/git/. And the u-boot source code is located in tmp/work/<board>/u-boot-imx/<version>/git/.
Then in the u-boot source code, you could use the same device tree file of your board there.
And for example, you could add your code in the <board>.c file to control the gpio output.
for your reference.
https://github.com/nxp-imx/uboot-imx/blob/lf_v2023.04/board/freescale/imx8qm_mek/imx8qm_mek.c