- These instructions are provided in a manner that assumes you know what you're doing (at least a little bit). They don't go into extreme detail, and they won't help you troubleshoot if you've broken something.
- I'm not responsible if you do break something. Try these instructions at your own risk. They worked for me, and hopefully they'll work for you too.
- These instructions are based on my experience doing this for the synology RS1221+. They are somewhat generalized in that I will call out where there are architecture specific choices made, but if they don't work for you because you have a different model, i'm sorry.
- There may be a better way to do this. I know my way around a makefile because of an old job I had working in C, but compiling drivers is still kinda foreign to me. If theres some better way to do some part of this (or all of it) I likely didn't do that becuase I didn't know it was an option.
- Install Entware. We'll be needing things like gcc, make, etc..., so a package manager is a must and these instructions use Entware. If you have some other way of getting those packages and don't like Entware, you could try that.
I followed the installation instructions here: https://www.technorabilia.com/using-entware-on-synology-nas/ but the commands *I* used for *my* NAS (aka, x86_64 specific) are below.
mkdir -p /volume1/@Entware/opt /opt
mount -o bind /volume1/@Entware/opt /opt
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
Lastly: set up boot task in scheduler as described by the link
- Install packages. We'll need a couple of packages. I installed the following using
opkg install
because I knew I would need them.
opkg install git git-http gcc
I also installed the following on the reocmmendation for general compilation tools from the Entware wiki. They may or may not be needed, but I installed them, so I'm listing them in case they were used.
opkg install binutils busybox gawk ldd make sed tar
opkg install coreutils-install diffutils ldconfig patch pkg-config --force-overwrite
The drivers need certain kernel modules to compile properly.
Note: Looking back on this, maybe all it needed was the source files, but I don't want to troubleshoot others attempts to recreate this effort, so I'm gonna list every step I took even if it might not be needed.
Unless noted otherwise, these steps were all run on my personal computer, not my synology box. I mostly did that because I didn't know what this step would entail, and the enviroment is limited on the synology. It is possible that this could be done on the synology to save the copy step at the end, but I'm not sure.
-
Download the appropriate linux-4.4.x file.
a) Visit https://archive.synology.com/download/ToolChain/Synology%20NAS%20GPL%20Source
b) Select your version of synology software, I used
7.2-64570
c) Find your version of
linux-4.4.x.txz
based on your chip. I have an AMD Ryzen V1500 so I use thev1000
file. -
Extract the tar file
-
Copy the appropriate config file out of
synoconfigs
into `.config. Again because of my chip I ran:
cp synoconfigs/v1000 .config
- Fudge the version? This was a bit odd. My synology was on Kernel version
4.4.302+
(you can get this by runninguname -r
on your machine). The existing files I downloaded were for version4.4.302
. I tried all of this once and was met with an error at the end when inserting the kernel driver because those two didn't match. So what I'm actually documenting here is my second attempt, and in that second attempt, I had to edit line 4 of theMakefile
from
EXTRAVERSION =
to
EXTRAVERSION = +
-
build it!
a) Run
make menuconfig
. This will bring up an interface, but I didn't need to make any changes. Just hit save.b) Run
make modules
. This will take a moment. -
Copy over the files. I used
tar
to bundle the wholelinux-4.4.x
directory and usedscp
to copy it over to my synology, but any way you get it over works. Its a NAS after all, you probably have something set up. -
Un-tar the directory on the synology, and place it somewhere reasonable.
-
Link it into place. The latter steps will expect the files to be at
/lib/modules/$(uname -r)/build
. You could maybe just put the files you brought over into that location, but I knew I was iterating at this point, so I linked them into place using
ln -s /path/to/linux-4.4.x/ /lib/modules/$(uname -r)/build
- Get the driver files. The driver we'll be making is the "Gasket" driver, so we'll get the source files by running
git clone https://github.com/google/gasket-driver.git
-
within the
gasket-driver/src
directory, runmake
. It shouldn't take too long and if it worked it should generate the two files we needgasket.ko
andapex.ko
. -
Insert the kernel modules. Run
insmod gasket.ko
insmod apex.ko
There may be some warnings about untrusted kernel modules, that doesn't seem to be an issue.
- Check if it worked. Running
lsmod | grep gasket
should get you something likegasket 79046 11 apex,[permanent], Live 0xffffffffa0089000 (OE)
in return, and runningls /dev | grep apex
should show the two apex devices (assuming the dual TPU).
If that all worked, you should now be good to pass those devices /dev/apex_0
and /dev/apex_1
into a docker
container (I did all of this to be able to use frigate) or use them however you want.
Note: The insmod
commands from the above step 3 do seem to be temporary. I haven't done the research yet if I just need
to automate running those commands at boot or if there is a place I can put the .ko files where they will be automatically
loaded.
Hopefully this helped someone like me who was sick of being told to give up on using the non-USB TPU I had lying around while the only thing stopping me was a lack of drivers.
I don't see any immediate reason it wouldn't. When it comes to architecture specifics, it looks like the DS1618+ uses a Intel Atom C3538 which after some googling means you'll want the "Denverton" file from the synology archive.
If I'm reading the specs right, like mine, your NAS does have a PCIe slot, but no M.2 slot. Which means you'll need the M.2 adapter card:
https://www.bhphotovideo.com/c/product/1569136-REG/synology_m2d20_m_2_adapter_card.html
If you don't already have a reason to have the adapter card, I would unfortunately say that it isn't worth getting it just for this, just getting a USB coral device is cheaper. I went through all the trouble because I already had the M.2 adapter card because of my need for an SSD cache drive.