Here is a short instruction how to enable S/PDIF digital audio output on NanoPI M1 board running Debian Jessie with legacy kernel.
This instruction can be applied to other H3 based boards but connect S/PDIF output hardware to GPIOA17 can be tricky (soldering miniature camera connector pins).
Operations can be done over serial console or ssh.
Login as root
Get a .fex file and open it in editor:
bin2fex /boot/script.bin /tmp/script.fex
nano /tmp/script.fex