Results 1 to 5 of 5

Thread: How to GPU bitcoin mine in backtrack 4. Your hardware could now pay rent !!.

Threaded View

  1. #1
    Very good friend of the forum drgr33n's Avatar
    Join Date
    Jan 2010
    Location
    Dark side of the moon ...
    Posts
    699

    Default How to GPU bitcoin mine in backtrack 4. Your hardware could now pay rent !!.

    Following on from my supercomputer post I've decided to write a little guide for you guys on how to get bitcoin mining using your GPGPU's via backtrack. This will benefit people that have backtrack installed to there HDD.

    Ok first we need to get our system/s setup and the GPU's running. If you have already installed the relevant drivers etc you can skip these sections.

    First how to ATI.

    If your using SSH to access your machine/s follow this first

    You probably don't want to run a full windows manager that's using resources but you need x running to use ATI cards so I would just install gdm.

    Code:
    apt-get update
    apt-get install gdm
    Next edit /etc/gdm/gdm.conf and add
    Code:
    AllowRoot=true
    Next edit /etc/gdm/Init/Default and add the following code just before the exit 0.
    Code:
    xhost +
    chmod uog+rw /dev/dri/card*
    Your now ready to ssh into your machine and begin.

    Ok lets move on your going to need to grab some package.

    AMD APP SDK v2.4 32 bit
    or
    AMD APP SDK v2.4 64 bit
    and
    ATI Catalyst 11.3

    Here's a patch that fixes the fglrx module to compile with kernels 2.6.37+

    Code:
    --- ./firegl_public.c 
    +++ ./firegl_public.c
    @@ -114,7 +114,7 @@
     #include <linux/pci.h>
     #include <linux/wait.h>
     #include <linux/miscdevice.h>
    -#include <linux/smp_lock.h>
    +#include <linux/sched.h> 
     // newer SuSE kernels need this
     #include <linux/highmem.h>
     
    @@ -848,8 +848,8 @@ static int fglrx_pci_suspend(struct pci_
          * happen much less frequent then without this workaround.
          */
         if (state == PM_EVENT_SUSPEND)
    -        acquire_console_sem();
    -
    +        console_lock();
    +    
         if (firegl_cail_powerdown(privdev, state))
             ret = -EIO;
     
    @@ -870,7 +870,7 @@ static int fglrx_pci_suspend(struct pci_
         }
     
         if (state == PM_EVENT_SUSPEND)
    -        release_console_sem();
    +        console_unlock();
     
         KCL_DEBUG_TRACEOUT(FN_FIREGL_ACPI, ret, NULL);  
         
    @@ -894,7 +894,7 @@ static int fglrx_pci_resume(struct pci_d
         if (PMSG_EVENT(pdev->dev.power.power_state) == 0) return 0;
     
         if (PMSG_EVENT(pdev->dev.power.power_state) == PM_EVENT_SUSPEND)
    -        acquire_console_sem();
    +        console_lock();
     
     #ifdef FIREGL_USWC_SUPPORT
         // Restore the PAT after resuming from S3 or S4.
    @@ -919,7 +919,7 @@ static int fglrx_pci_resume(struct pci_d
         firegl_cail_powerup(privdev);
     
         if (PMSG_EVENT(pdev->dev.power.power_state) == PM_EVENT_SUSPEND)
    -        release_console_sem();
    +        console_unlock();
     
         PMSG_EVENT(pdev->dev.power.power_state) = 0;
         KCL_DEBUG_TRACEOUT(FN_FIREGL_ACPI, 0, NULL);  
    @@ -1894,13 +1894,13 @@ void ATI_API_CALL KCL_spin_unlock(void *
     /** \brief Grab global kernel lock */
     void ATI_API_CALL KCL_GlobalKernelLock(void)
     {
    -    lock_kernel();
    +     /* lock_kernel(); removed */
     }
     
     /** \brief Release global kernel lock */
     void ATI_API_CALL KCL_GlobalKernelUnlock(void)
     {
    -    unlock_kernel();
    +   /* unlock_kernel(); removed */
     }
     
     /*****************************************************************************/
    
    --- ./kcl_ioctl.c	2011-04-22 15:44:24.820781777 +0100
    +++ ./kcl_ioctl.c	2011-04-22 15:41:41.406781778 +0100
    @@ -193,7 +193,7 @@ void ATI_API_CALL KCL_IOCTL_UnregisterCo
      */
     void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
     {
    -    void __user *ret = COMPAT_ALLOC_USER_SPACE(size);
    +    void __user *ret = arch_compat_alloc_user_space(size);
     
         /* prevent stack overflow */
         if (!access_ok(VERIFY_WRITE, ret, size))
    Lets start with catalyst. I always install these while in single user mode. Sometimes I find that the install script cannot disable the old modules running and fails. So lets switch into single user mode.

    Code:
    telinit 1
    and CD into the directory where you have the binary stored and invoke it

    Code:
    ./sh ati-***.run
    Follow the on screen instructions and install. Next check your fglrx log stored in /usr/share/ati/fglrx-install.log. If everything looks ok your ok to move on, if not copy and paste my patch into a txt file and save it as "ati_kernel_patch.patch". Copy the patch over to /lib/modules/fglrx/build_mod/ run the patch and recompile.

    Code:
    patch -p1 < ati_kernel_patch.patch
    sh ./make.sh
    cd ..
    sh ./make_install.sh
    If you have other issues post them here and I'l see if I can help you out. Hopefully you now have the ATI fglrx modules installed. Now lets get the cards running !!

    For a single card run...
    Code:
    aticonfig --initial
    For multi cards run ...
    Code:
    aticonfig --adapter=all --initial
    Lets go back into multi user. This will also restart X

    Code:
    telinit 3
    Now lets check to see if crossfire is active
    Code:
    aticonfig --lscs
    If crossfire is still active you may have to do
    Code:
    aticonfig --adapter=all --cf=off
    and restart X again.

    Congratulations you now have your ATI GPU's setup for bitcoin mining / pyrit etc. Now lets take this one step further and overclock our cards.

    Lets enable overdrive on our card/s. If you only have one card you only need to run this on display 0.

    Code:
    DISPLAY=:0 aticonfig --enable-od
    DISPLAY=:0.1 aticonfig --enable-od
    .....
    Ok now lets look at how far we can push things.

    Code:
    DISPLAY=:*youcard aticonfig --odgc
    And you should see something like the following ..

    Code:
    Default Adapter - ATI Radeon HD 5800 Series  
                                Core (MHz)    Memory (MHz)
                     Current Clocks :    840           1140
                        Current Peak :    840           1140
    Configurable Peak Range : [600-900] [900-1300]
                     GPU load :    98%
    The part we are interested in is Configurable Peak Range : [600-900] [900-1300]. That's the range that you can play with. There is no one set way to configure this you will just have to tinker.

    Here's how you set the clocks
    Code:
    DISPLAY=:*youcard aticonfig --odsc=core,memory
    DISPLAY=:*youcard aticonfig --odcc
    Check the aticonfig manual for more info as explaining all this is way out of the scope of this tutorial. And we still haven't covered the SDK !!

    Now lets extract the SDK into an appropriate directory and build our sdk.

    Code:
    tar -C /opt -xvf AMD-APP-SDK-v2.4-lnx*.tgz
    cd /opt/AMD-APP-SDK-v2.4-lnx*
    LLIBS+="GL GLU" make
    tar -C / -xvf icd-registration.tgz
    Ok now we need to setup our library paths etc. You could just export everything every time you login or add this to the end of /etc/bash.bashrc

    Code:
    ATISTREAMSDKROOT=/opt/AMD-APP-SDK-v2.4-lnx*youversion
    LD_LIBRARY_PATH+=/opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64
    export ATISTREAMSDKROOT LD_LIBRARY_PATH
    and there you have it you have your ATI GPGPU's ready to crunch code .

    For nvidia users. Purehate has wrote an excellent guide on how to get these cards up and running in backtrack. I don't see the need to rewrite this so I'm just going to link it

    Purehates Nvidia guide.

    Give yourself a pat on the back you've come a long way lol. next is to setup pyopencl and get mining !!!

    First lets setup a working directory and get everything.

    Code:
    mkdir /root/bitcoin
    cd /root/bitcoin
    apt-get install python-pyopencl
    wget http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.20/bitcoin-0.3.20.2-linux.tar.gz
    git clone https://github.com/m0mchil/poclbm.git
    tar xvf bitcoin-0.3.20.2-linux.tar.gz
    Ok now we have everything we need to mine bitcoins If python-pyopencl starts downloading lots of nvidia stuff and you don't need it don't worry. So lets configure bitcoin to run as a daemon and get mining.

    Code:
    mkdir /root/.bitcoin
    echo "rpcuser=yourusername" > /root/.bitcoin/bitcoin.conf
    echo "rpcpassword=yoursupersecretpassword" >> /root/.bitcoin/bitcoin.conf
    echo "rpcallowip=127.0.0.1" >> /root/.bitcoin/bitcoin.conf
    Now when I want to run a mining cluster all I have to do is add the ip addresses of the nodes. I had troubles with wildcards so I add every node as a single line.

    Code:
    echo "rpcallowip=10.42.43.52" >> /root/.bitcoin/bitcoin.conf
    echo "rpcallowip=10.42.43.53" >> /root/.bitcoin/bitcoin.conf
    and so on ...
    Now your ready to start up your bitcoin daemon.

    Code:
    /root/bitcoin/bitcoin-*/bin/64/bitcoind
    Next lets get poclbm mining on your daemon.

    Code:
    /root/bitcoin/poclbm
    Now I just wrote a little bash script to get everything fired up on this machine and set the fan speed on my ATI cards. Nvidia users I can't help you too much from now on as I haven't had no experience with these cards. But your most of the way now and google is your friend maybe someone else could add the nvidia stuff for setting up fan speeds etc.

    CONT....
    Last edited by drgr33n; 04-24-2011 at 03:38 PM.

Similar Threads

  1. BackTrack dont see my hardware
    By laryguy in forum Beginners Forum
    Replies: 5
    Last Post: 09-22-2010, 08:21 PM
  2. WEP key found isn't mine?
    By eeepclover in forum Beginners Forum
    Replies: 0
    Last Post: 05-09-2010, 07:55 PM
  3. Replies: 14
    Last Post: 11-16-2009, 06:37 PM
  4. How much hardware does backtrack need?
    By imported_kiloraw in forum OLD Newbie Area
    Replies: 6
    Last Post: 09-09-2008, 08:00 AM
  5. 2 to 1 wifi there mine or will be
    By wallis in forum OLD Wireless
    Replies: 8
    Last Post: 04-13-2008, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •