How to use GPIO and UART?

Hello everyone
I 'm a newbie at TX1.
I have a TX1 board, and i can export gpio187

echo 187 > /sys/class/gpio/export

,but when the system reboot, the gpio187 disapper, i need export it again… Can i export it forever? Is it necessary to make a new kernal?
I use uart0(ttyS0) to communicate with PC,but I find the TX1 will output some system info to PC except my messages ,how to stop the output of system info? or can I use another uart port to instead of uart0? I didnot find a manual to learn.
thank you!

Regarding GPIO, many of the optional things you can do at runtime in “/sys” have some relation to the device tree. This in turn is loaded via the “.dtb” device tree file named in “/boot/extlinux/extlinux.conf”. You can look at some example GPIO setup there by reverse compiling to source form (".dts"). This could of course be an edit in kernel source and then go through the steps of generating from a kernel build, but it’s simpler to just reverse compile to find what you want. You can edit the “.dts” source version, then recompile back to “.dtb” binary version.

Example:

dtc -I dtb -O dts -o /tmp/extracted.dts /boot/the_firmware_in_extlinux.dtb
# ...browse and edit extracted.dts...
dtc -I dts -O dtb -o /tmp/modified.dtb /tmp/extracted.dts

Be sure to not lose your original dtb in any testing, you may want it back.

Serial console is set to ttyS0, so console output goes there. This was intended for system debug info. You could remove that function (but lose any ability to rescue via serial console). However, U-Boot itself sends some output there too, before Linux ever loads. Disabling console in Linux is easy, disable in U-Boot is a modification and recompile. If you wish to remove serial console in Linux just remove the options in the kernel command line of extlinux.conf:

console=ttyS0,115200n8

Thank U for your reply!
I am not good in kernel, so I add the code in bash to boot up.

sudo -S su <<EOF
ubuntu(Password)
echo 187 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio187/direction
exit
EOF

It succeed!
Also, I change “ttyS0” to “ttyTHS2” to use uart1(J17,pin 4,5) instead of uart0(J26 pin8,10). It seems work well!
I noted your reply to try your method at a later date. Thank you.