Skip to content

Instantly share code, notes, and snippets.

@ashayh
Last active August 29, 2015 13:56
Show Gist options
  • Save ashayh/8896079 to your computer and use it in GitHub Desktop.
Save ashayh/8896079 to your computer and use it in GitHub Desktop.
headless cgminer on ubuntu 12.04 for ATI HD 7XXX
#!/bin/bash
# ashay.humane at the gmail dots com
# Headless install of cgminer on a ATI HD series GPU
# Tested on Ubuntu server 12.04.4 with a ATI HD 7970
#
# Do a regular install of Ubuntu server with openssh enabled.
# Then run this script.
#
# The script requires a REBOOT, which could be avoided,
# but I haven't had a chance to test it
#
# The script does everything from scratch, eveerytime you run it.
# ie the $HOME/mine/ directory is deleted/recreated on every run.
# To avoid this, run relevant sections manually if needed.
set -e
sudo ls
# not updating repo metadata is the cause of many woes:
sudo aptitude update
mkdir -p ~/mine
rm -rf ~/mine/*
cd ~/mine
sudo aptitude -y install git build-essential autotools-dev libcurl4-gnutls-dev autoconf automake fglrx-updates fglrx-amdcccle-updates fglrx-updates-dev tmux curl libncurses5-dev xorg xdm unzip libtool libudev-dev
rm -f AMD-APP*tgz # You can comment/delete this, and the following line, to avoid re-download, if you only want to run certain sections of the script.
# y u not provide normal HTTP/FTP links AMD?
# I'm sure someone has the regular HTTP GET or FTP links, but I can't find them.
# These curl commands are fragile are sure to stop working sometime.
# EDIT stopped working. Do a manual download
#curl -# --data "amd_developer_central_nonce=9104b28532&_wp_http_referer=%2Ftools-and-sdks%2Fheterogeneous-computing%2Famd-accelerated-parallel-processing-app-sdk%2Fdownloads%2F&f=QU1ELUFQUC1TREstdjIuOS1sbng2NC50Z3o%3D" http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/ > AMD-APP-SDK-v2.9-lnx64.tgz
tar xvzf AMD-APP-SDK-v2.9-lnx64.tgz
# This command expects an interactive answer at a prompt.
# But if you wait long enough, it assumes "yes" as the answer.
# Theres probably a way to speed it up (with the `yes' command) but I didnt test.
sudo ./Install-AMD-APP.sh
git clone https://github.com/ckolivas/cgminer.git
cd cgminer
git checkout -b scrypt v3.7.2
rm -f ADL_SDK_6.0.zip
#curl -# --data "amd_developer_central_nonce=575c6011c0&_wp_http_referer:%2Ftools-and-sdks%2Fgraphics-development%2Fdisplay-library-adl-sdk%2F&f=QURMX1NES182LjAuemlw" http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk/ > ADL_SDK_6.0.zip
unzip ADL_SDK_6.0.zip
cp include/* ~/mine/cgminer/ADL_SDK/
# REBOOT NOW
echo "rebooting in 10 secs...."
echo "then run the rest of the script manually"
sleep 10
cd ~/mine/cgminer/
# when this command ends, make sure OpenCL, SDK and scrypt are in enabled state.
./autogen.sh --enable-scrypt --enable-opencl
make
sudo cp ~/mine/cgminer/cgminer /usr/local/bin/
sudo cp ~/mine/cgminer/scrypt130511.cl /usr/local/bin/
sudo sed -i -e 's/^DisplayManager\*authorize:.*true/DisplayManager*authorize: false/' /etc/X11/xdm/xdm-config
sudo service xdm restart
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
# if you see your GPU in the following commands output, then all is Ok.
/usr/local/bin/cgminer -n
# This cgminer.conf gets me 736 kH/s :
cat > ~/cgminer.conf <<EOF
{
"intensity" : "13,13",
"vectors" : "1",
"worksize" : "256",
"kernel" : "scrypt",
"lookup-gap" : "2",
"thread-concurrency" : "8192,8192",
"shaders" : "2048",
"gpu-engine" : "1050,1050",
"gpu-fan" : "50-95",
"gpu-memclock" : "1600,1600",
"gpu-memdiff" : "0",
"gpu-powertune" : "20",
"gpu-vddc" : "0.000",
"auto-fan" : true,
"temp-cutoff" : "86",
"temp-overheat" : "82",
"temp-target" : "75",
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "2",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "60",
"scrypt" : true,
"temp-hysteresis" : "3",
"shares" : "0",
"no-submit-stale" : true,
"kernel-path" : "/usr/local/bin"
}
EOF
# finally, run cgminer under tmux or screen:
# /usr/local/bin/cgminer -c ~/cgminer.conf --scrypt -o stratum+tcp://your.pool.com:3339 -u user.username -p password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment