The gpiochip module provides a sysfs interface to communicate using rpmsg with the PRUs.
If you have already built modules on your machine earlier you would be having the headers already installed. You might skip this step
apt-cache search linux-headers-$(uname -r)
sudo apt install linux-headers-$(uname -r)
make
sudo insmod gpiochip.ko
The gpiochip module is probed when the PRU code is started. It is very important to have the CHAN NAME set to " rpmsg-pru-gpio" to make sure this driver is used and not the character driver. Also make sure that gpiochip module is loaded before starting the PRU.
cd /sys/class/remoteproc/remoteproc1
sudo start > state
sudo rmmod gpiochip.ko