Installing ATI drivers, AMD APP SDK, CAL++, and Pyrit on Kali Linux 1.05 from start to finish.

I made this how-to in an attempt to gather all the information needed to get cpyrit working on Kali and have it all in one place. Most of the tutorials I have come across are for BackTrack or are focused on one aspect of the process, for example ATI driver installation. I am by no means an expert on the subject, and I have used other tutorials as a guideline. I made this primarily as a reference for myself, but I would like to share it in hopes that someone might find it useful.

This tutorial assumes the following:
  • You are running a clean install of Kali Linux 1.05 x64. A non clean install may cause issues, as well a different version or architecture may have some differences.
  • You have an AMD Radeon HD 5xxx or 6xxx series GPU. Series 3xxx or 4xxx require legacy ATI drivers which I do not cover here. Series 7xxx may need some further workarounds.
  • You are running as root and have some knowledge of Linux command line usage.





Installing ATI drivers:
Credit goes to blackMORE. Most of this was directly copy and pasted from his original post.

Step 1: Remove any previous version of the drivers:
If you are not using a clean install of Kali (not recommended), you may need to clean up previous fglrx drivers.
Code:
apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev* xorg-driver-fglrx
Step 2: Edit your /etc/apt/sources.list to look like this:
Code:
# deb cdrom:[Debian GNU/Linux 7.0 _Kali_ - Official Snapshot amd64 LIVE/INSTALL Binary 20130315-11:02]/ kali contrib main non-free
# deb cdrom:[Debian GNU/Linux 7.0 _Kali_ - Official Snapshot amd64 LIVE/INSTALL Binary 20130315-11:02]/ kali contrib main non-free

deb http://http.kali.org/kali kali main non-free contrib
deb-src http://http.kali.org/kali kali main non-free contrib

## Security updates
deb http://security.kali.org/kali-security kali/updates main contrib non-free
deb-src http://security.kali.org/kali-security kali/updates main contrib non-free
Step 3: Update your sources:
Code:
apt-get update
Step 4: Install Linux headers:
Code:
apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
Step 5: Attempt installation of ATI drivers:
Code:
apt-get install fglrx-driver fglrx-control fglrx-glx fglrx-atieventsd fglrx-modules-dkms
You will get the following error:
Error! Bad return status for module build on kernel: 3.7-trunk-amd64 (x86_64)
Consult /var/lib/dkms/fglrx/12-6+point/build/make.log for more information.


Step 6: Patch fglrx module:
Code:
cd /root
wget http://www.blackmoreops.com/wp-content/uploads/2013/10/fglrx-3.71.patch
cp /var/cache/apt/archives/fglrx-modules-dkms_1%3a12-6+point-3_amd64.deb /root
mkdir -p extract/DEBIAN
dpkg-deb -x fglrx-modules-dkms_1%3a12-6+point-3_amd64.deb extract/
dpkg-deb -e fglrx-modules-dkms_1%3a12-6+point-3_amd64.deb extract/DEBIAN
cp fglrx-3.71.patch extract/usr/src/fglrx-12-6+point/
cd extract/usr/src/fglrx-12-6+point/
patch -p0 < fglrx-3.71.patch
When successful you will see:
patching file firegl_public.c
Hunk #1 succeeded at 3890 (offset -2 lines).
Hunk #2 succeeded at 3924 (offset -2 lines).
Hunk #3 succeeded at 3947 (offset -2 lines).
Hunk #4 succeeded at 3960 (offset -2 lines).
Hunk #5 succeeded at 4006 (offset -2 lines).
Hunk #6 succeeded at 4045 (offset -2 lines).
Hunk #7 succeeded at 4063 (offset -2 lines).
Hunk #8 succeeded at 4088 (offset -2 lines).


Step 7: Repack and install fglrx module:
Code:
cd /root
mkdir build
dpkg-deb -b extract/ build/
cd build
dpkg -i *.deb
When successful you will see:
DKMS: install completed.

Step 8: Initial configuration:
Code:
aticonfig --initial -f
Step 9: Configure GRUB:
Open /boot/grub/grub.cfg with your favorite text editor. Look for a section that begins with:
### BEGIN /etc/grub.d/10_linux ###

In that section there will be a line similar to this one:
linux /boot/vmlinuz-3.7-trunk-amd64 root=UUID=7f79eea2-1668-407f-b7ed-d5613fecd26c ro initrd=/install/gtk/initrd.gz quiet

Append radeon.modeset=0 to the end of the line so it looks like this:
linux /boot/vmlinuz-3.7-trunk-amd64 root=UUID=7f79eea2-1668-407f-b7ed-d5613fecd26c ro initrd=/install/gtk/initrd.gz quiet radeon.modeset=0

Save the file and reboot.

Step 10: Check if fglrx module is installed:
Code:
lsmod | grep fglrx
You should get a response similar to:
fglrx 2635205 82
button 12945 1 fglrx





Installing AMD APP SDK:

Step 1: Download AMD APP SDK v2.7 from:
http://developer.amd.com/tools-and-s...nload-archive/

Step 2: Install the SDK:
Code:
mkdir amdappsdk
cp AMD-APP-SDK-v2.7-lnx64.tar amdappsdk/
cd amdappsk
tar -xvf AMD-APP-SDK-v2.7-lnx64.tar
./Install-AMD-APP.sh
Step 3: Edit /root/.bashrc, add the following lines to the end of the file:
Code:
# AMD APP SDK
export AMDAPPSDKROOT=/opt/AMDAPP
export AMDAPPSDKSAMPLESROOT=/opt/AMDAPP/
export LD_LIBRARY_PATH=${AMDAPPSDKROOT}lib/x86_64:${LD_LIBRARY_PATH}
export ATISTREAMSDKROOT=$AMDAPPSDKROOT
Save and quit, then issue the following command:
Code:
source ~/.bashrc



Installing CAL++

Step 1: Install prerequisites:
Code:
apt-get install cmake libboost-all-dev
Step 2: Download calpp 0.90 from:
http://sourceforge.net/projects/calp...ar.gz/download

Step 3: Install CAL++:
Code:
tar -xvf calpp-0.90.tar.gz
cd calpp-0.90/
Edit CMakeLists.txt:
Find the lines starting with FIND_LIBRARY and FIND_PATH and replace them with this:
Code:
FIND_LIBRARY( LIB_ATICALCL aticalcl PATHS "$ENV{ATISTREAMSDKROOT}" )
FIND_LIBRARY( LIB_ATICALRT aticalrt PATHS "$ENV{ATISTREAMSDKROOT}" ) 
FIND_PATH( LIB_ATICAL_INCLUDE NAMES cal.h calcl.h PATHS "$ENV{ATISTREAMSDKROOT}/include/CAL" )
Save and quit, then issue the following commands:
Code:
cmake .
make
make install



Installing Pyrit

Step 1: Install prerequisites
Code:
apt-get install libpcap-dev
Step 2: Remove existing installation of pyrit
Code:
apt-get remove --purge pyrit
If you are not using a clean install of Kali (not recommended), you may need to issue the following command:
Code:
rm -r /usr/local/lib/python2.7/dist-packages/cpyrit/
Step 3: Download pyrit
Code:
svn checkout http://pyrit.googlecode.com/svn/trunk/ pyrit_svn
Step 4: Install pyrit
Code:
cd pyrit_svn/pyrit/
./setup.py build install
Step 5: Install CAL++ plugin
Code:
cd ../cpyrit_calpp/
Edit setup.py:
find VERSION = '0.4.0-dev' and replace with VERSION = '0.4.1-dev'
find CALPP_INC_DIRS.append(os.path.join(CALPP_INC_DIR, 'include')) and replace with CALPP_INC_DIRS.append(os.path.join(CALPP_INC_DIR, 'include/CAL'))

Save and quit, then issue the following command:
Code:
./setup.py build install
There will be several warnings, but hopefully no errors and everything will be installed.

Step 6: Test cpyrit
Code:
pyrit list_cores
...
The following cores seem available...
#1: 'CAL++ Device #1 'AMD GPU DEVICE''
#2: 'CPU-Core (SSE2)'
#3: 'CPU-Core (SSE2)'
#4: 'CPU-Core (SSE2)'


Code:
pyrit benchmark
...
Computed 7548.89 PMKs/s total.
#1: 'CAL++ Device #1 'AMD GPU DEVICE'': 5599.3 PMKs/s (RTT 1.4)
#2: 'CPU-Core (SSE2)': 685.6 PMKs/s (RTT 3.0)
#3: 'CPU-Core (SSE2)': 688.5 PMKs/s (RTT 3.0)
#4: 'CPU-Core (SSE2)': 691.9 PMKs/s (RTT 3.0)