Wipe the SD card and install a fresh Raspbian. SSH into it and install the essentials (e.g. git, libtool, byobu, build-essentials, etc.)
Git clone dmaxl's fork of cgminer from
https://github.com/dmaxl/cgminer.gitConfigure it with --enable-scrypt --enable-gridseed and then make
I run it with a shell script that looks something like:
./cgminer -o X -u X.x -p X --scrypt --gridseed-options freq=838,chips=40 --lowmem