To cross compile for the Pi, the compiler on my build machine needs to have access to the /usr/include/ and /usr/lib/ directories from the Pi. I share these by sharing the Pi’s entire root filesystem over NFS.
So, every time I want to cross compile, I need to mount the Pi’s NFS share from my build machine. I’ve written a simple script to do this because I don’t like thinking about things like this:
#!/bin/bash
if [ "$#" -eq 0 ]; then
echo "Please pass the pi's IP as an argument"
exit 0
fi
echo "Mounting Raspberry Pi at $1 using NFS"
mount -t nfs $1:/ /root/dev/raspberry_pi/nfs_rootIt’s simple but it works. It mounts the root share at the path in the final line. Change this to match your system, chmod +x the file you place this script in, and run the script passing in the IP of the Pi.
And here’s the unmount for good measure:
#!/bin/bash
echo "Unmounting Raspberry Pi NFS root"
umount /root/dev/raspberry_pi/nfs_rootWoo. Why isn’t this crap on github somewhere…?
