Good job, please do share with the community what you've done to make it work. I'm sure it'll be an interesting read at least.
Allright, here we go: Linux guide to X5000 mining:
Step 1: start download of Xilinx ISE (it's development environment. There might be other ways to program the FPGA, but for now, I used this, as Li suggested in the windows version of the guide). The file is huge (4.6GB), so we start this now to avoid coffee breaks later.
Step 2: Get the USB Platform Cable to work (I use a USB platform cable here, there are others, this guide is for USB Platform cable, I have a "Model DLC9G")
Step 2 A: Plug the "Cable" (it's called cable, although it's a box, and I will just call it "Cable" or "Platform Cable") into a USB port. Better try without a hub first. Check if the USB portion of the device works:
#> lsusb
Bus 001 Device 120: ID 03fd:0008 Xilinx, Inc.
Step 2 B: Driver for Platform CableBefore we start, lets make a directory to work in:
#> cd ~
#> mkdir x5000
#> cd x5000
My gentoo linux did not have any sort of driver coming with it and there is no module in vanilla kernel 2.6, at least not in mine.
The Xilinx ISE actually comes with source for a kernel mode driver, called "windrvr". I tried to compile this but I failed miserably.
I used this:
http://rmdir.de/~michael/xilinx/. It's a usermode driver that uses libusb (or parport for parallel port cables) and emulated windrvr afaik. Download, unpack, compile it and check it created the lib we need:
x5000 #> wget http://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver?a=snapshot;h=HEAD;sf=tgz
x5000 #> tar -xzf usb-driver-HEAD-913cbbf.tar.gz
x5000 #> cd usb-driver-HEAD-913cbbf
usb-driver-HEAD-913cbbf #> make
usb-driver-HEAD-913cbbf #> ls libusb-driver.so
libusb-driver.so
Now, this software comes with a script that copies firmware-files from the Xilinx ISE install directory, this means we have to install the Xilinx ISE now:
downloads #> tar -x Xilinx_ISE_DS_Lin_13.2_O.61xd.0.0.tar
downloads #> Xilinx_ISE_DS_Lin_13.2_O.61xd.0.0/xsetup
I checked the option "install driver" here. First I ran this as user and after unzipping files for an hour, the installer told me I'm not root and therefor drivers could not be installed. I did the whole shebang again as root, and this time it told me that driver installation failed. Since
we do not use the windrvr that comes with the ISE, screw it. You can try, though, maybe it works for you.
I chose /opt/Xilinx as install directory. You can choose any dir, just replace that in the following
Now let's run the above-mentioned setup-script:
#> cd ~/x5000/usb-driver-HEAD-913cbbf
#> ./setup_pcusb
This installs some udev-rules in /etc/udev/rules.d/xusbdfwu.rules by copying from xilinx folder somewhere. They already mod these xilinx-rules for newer udev versions, but it seems udev changed again, so I had to edit that file:
#> edit /etc/udev/rules.d/xusbdfwu.rules
change all occurences of "$tempnode" to "%N" (uppercase N)
you also need a tool called
fxload to upload the firmware to the device, install it (this example is gentoo)
now if you replug the USB Platoform Cable, the firmware should load and the LED on the device go from "maybe very dimly red" to "
BRIGHT RED", when the firmware is loaded. If x5000 is connected, it will go green.
If it doesn't work for some reason, set
udev_log="debug" in /etc/udev/udev.conf to see what's going on in the syslog when you replug.
You can also load the firmware manually (look in the rules file and lsusb which one by device id):
#> fxload /usr/share/xusb_....hex
At this point, the driver should be working and the LED on cable should be either GREEN or RED depending on wether x5000 is plugged in or not.
To check if
driver works libusb and the firmware works, you can use another tool, urJTAG (
http://urjtag.org/):
#> jtag
jtag> cable xpc_ext
jtag> detect
maybe we can even program with this tool, I don't know. Anyone?
Step 3: program the FPGA using ISE:
Now you can start
impact, which can be used to program the X5000 fpga, preloading the usb driver:
#> LD_PRELOAD=~/x5000/usb-driver-HEAD-913cbbf/libusb-driver.so /opt/Xilinx/13.2/ISE_DS/ISE/bin/lin/impact
impact should start up and ask you some stuff about project folder. Just answer as you see fit. It also asks you "Configure devices using Boundary-Scan (JTAG)". You can try "Automatically connect to a cable...." here, but it never worked for me. Instead, I select "Enter a boundary-chain manually".
The gui starts now. Important:
Do "Menu: Output -> Reset Cable". This helped me to get the cable working at all. It did not work for me without doing this.No you can select "boundary Scan" on the left and then Right Click on "Right click to Add Device....". and select "Cable Setup...". This is also in the "Output Menu".
If it says: "warning, windrvr not installed", you probably did something wrong with the LD_PRELOAD above.
Select "Platform Cble USB/II" (at least for me that's what I wanted) and then check out "Advanced USB Cable Setup", it should show an entry in the list of usb cables/ports. If it doesn't, exit that stuff and try "Output -> Reset Cables" again.
If it says: "this function requires a target to be set first", it's probably working
. Load the xxx.bit file from the miner.zip by right-clicking on the white "boundary scan" areay and selecting "Add xilinx device...". Then try again with the Cable Setup.
The cable works and a nice Xilinx image popped up in the white area? Then you can program the fpga by right-clicking the image and selecting "program". Took 11 seconds for me, the bar didn't go all the way to 100%.
Step 4: mine!go to the directory where you unpacked Miner.zip and make a script,
mine.sh#> cd ~/x5000/Miner
Miner #> edit mine.sh
#!/bin/sh
export PLATFORM=lin
#if ("`arch | grep -c "64"`" == "1") then <- fix this if you have 64 bit system
# PLATFORM=${PLATFORM}64
#fi
export XIL_CSE_TCL=/opt/Xilinx/13.2/ISE_DS/ISE/cse/tcl
export XILINX=${XIL_CSE_TCL}/../..
export PATH=${XILINX}/lib/${PLATFORM}:${XILINX}/bin/${PLATFORM}:$PATH
export LD_LIBRARY_PATH=${XILINX}/lib/${PLATFORM}:${XILINX}/bin/${PLATFORM}
export LD_PRELOAD=~/x5000/usb-driver-HEAD-913cbbf/libusb-driver.so
tclsh mine.tcl
note that this script quite sucks, you probably have to change a couple of paths.
edit the configfile... and start to mine
Miner #> edit config.tcl
Miner #> ./mine.sh
you might get some errors. If tcl complains about missing packages, try installing tcllib.
Ok, that's it. Hope it helps someone.