Bridging The Security Gap

Kali install on a Raspberry Pi 2

Kali install on a Raspberry Pi 2
By Jeroen Mar 05, 2015

The standard RaspberryPi Kali images won't work on the RaspberryPi2, The S-Unit created this blog to tell you how you can compile your own images and install it on your brand new Pi2.

This article is based on other peoples work and adjusted where needed in order to get it working. For more information about the subjects, look at the references in the end of this post. I used a
Kali virtual machine as build environment. This tutorial is meant for people who do have some knowledge about basic Linux commands otherwise you wouldn’t be using Kali I guess. Therefore some simple skills are needed.

First get the latest Raspbian image from the Raspberry Pi website,

Write the .img file to a SD-card in order to boot the Pi. We first need to get two things. A working kernel config file for the Raspberry Pi 2 and the /lib/modules directory. The last one is only needed if you want to get X working on your Raspberry (startx).

Zcat /proc/config.gz > .config

SSH into your booted Pi and get the kernel config with this command:

uname -a

Make a note of which kernel your Pi is using with:
You could copy the .config file and the /lib/modules directory to a simple path so that copying is easier with the use of scp.
You could also shut down your Pi and mount the SD-card in order to get those files.

mkdir RasPi
cd RasPi
git clone
export PATH=${PATH}:/root/RasPi/gcc-arm-linux-gnueabihf-4.7/bin
git clone
cd ~/RasPi/kali-arm-build-scripts

After that we need get our build environment ready to make the image. Again I did this in a Kali virtual machine but you can try it on a different OS.
Take notice of using the correct path while doing the export command, otherwise your arm compiler will be incorrect referenced

cp .config ~/RasPi/kali-arm-build-scripts/kernel-configs/rpi-.config

Copy the .config file which we just got from the Raspbian image to the following location: “kali-arm-build-scripts/kernel-config”. While you’re doing this, use the kernel version in the name of the file to keep track of which config you used.

Next step is to adjust the build script to use ARM hard-float architecture. At the moment of writing you need to adjust line 31 and 41 of your kali-arm-build-scripts/

Change “armel” to “armhf”. Don’t mind the comments and echo statements. The Raspberry Pi 2 CAN use hard floats
Next we need to adjust the kernel config file on line 205 to our own config file

cd ~/RasPi/kali-arm-build-scripts
./ 1.0

Then build the Kali image by running the script. You need to give it an extra parameter. This is a version which is used for naming the directory where the output files are put in.
My build took about 45 minutes to finish. If your build is successful then there are a couple files in a directory named rpi-

It depends on your build environment (32 or 64 bit) if the .img file is compressed with xz or not.

dd if=kali-1.0-rpi.img of=/dev/ bs=1M conv=notrunc,noerror,sync

If you don’t need a graphical environment, then you are almost done. You can write your image after decompressing with unxz, to a SD-card with:
Remember to use the correct output device. You can do some serious damage by choosing a wrong one.
On the forum of Kali ( there are some posts about the problem that X is not working after trying to start it with startx. I first tried the solution to make a symbolic link in the /lib/modules directory and found out that my mouse and keyboard where not working. So I went for another solution. I copied /lib/modules/3.18.7-v7+ directory from a Raspbian image into the Kali Pi /lib/modules directory. I used a kernel 3.18.7 as you can see in the name, so the exact name could be different depending on which kernel version you are using.
There are a couple of ways to copy the directory on your Kali Pi image. You could first write the image to a SD-card and then copy the directory in the correct location. That’s the easiest way I think.
I tried a different method. I mounted the kali image, copied the files and unmounted the image. After that, I wrote it to a SD-card. Look in the references if you need more information about this method.


As a bonus we also made a Raspberry Pi2 case to print yourself on a 3D printer.
You can download the design at our Tinkercad page:

Hacking Raspberrypi tools