This has been left here for historical purposes, please see the new fully working guide here!
Ok I had a previous attempt running the install from Linux Mint 17 and I had some issues, one of those issues being a 3GB partition with only one script in it and nothing else which was a bit strange, I did however notice during creation certain folders failed to be found like “init” for example which at the time I figured was a bit odd but I proceeded nonetheless. What follows is a full guide on how I got Kali Linux running on the Raspberry Pi 2 successfully:
Create a directory to work out of and navigate into it
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7 to pull down for the “armhf” image creation
Output once finished it should look as follows
Check your working directory with “pwd” and then ls to check the gcc-arm directory is there and use this information to export the path
Export the path with /root/Kali-Git being the working directory and gcc-arm-linux-gnueabihf-4.7/bin being the directory and bin directory contained within that you just cloned from git
Clone the kali-arm-build-scripts from github
Output once finished it should look as follows
Now as the Pi has a different architecture you need to modify the rpi.sh script in the cloned repository with the editor of your choice
Modifying two separate locations as outlined in the below image
I also choose to comment out the last few lines at the end in order to be able to troubleshoot and not compress or build a shasum as you can see below and make sure to save it
Copy the following pastebin script from here and create a new file in the kernel directory or alternatively run wget http://pastebin.com/download.php?i=Rv3zpsiv -O rpi-3.1.8.config from the terminal to do this for you and download it straight to the directory ready to edit.
Paste the above pastebin content into the new file, save it and then modify the following line so that we can copy the Raspbian boot directory over afterwards as this is also required in order to make things run smoothly and get rid of X freezing. CONFIG_LOCALVERSION=”-v7″ to CONFIG_LOCALVERSION=”-v7+” you only need to add a + to the end.
Fix any local dependencies you may require by running the following script
Output of the above script should finish like the following with no errors
Now modify the rpi.sh script for the kernel changes to be picked up and change the kernel number to match the file that you just created
The output should initiate as below when the rpi.sh script is run with the version number of your choice and be patient as depending on your internet connection this can take some time to complete
When finished it should look something like this
Check the directory and your image are there
Now it’s time to burn your image to your micro sd card with dd but first you will have to find your micro sd card. Use “fdisk -l” to list available partitions /dev/sda is my main local disk and /dev/sdb is the micro sd card. If you don’t know which one is your micro sd just unplug it and run “fdisk -l” again and see what has changed, then plug it back in again and you should see it now.
Now it’s time to run the dd command to burn the image to the micro sd
dd – to run and copy the image file
if=/the directory of your image file in this case the rpi-1.0.1 file directory
of=/the micro sd card to copy the image to
bs=1M – for a blocksize of 1MB
Output should look similar to the following
I booted up at this stage and I was getting the freeze that was talked about on the Kali Linux forum once Kali is installed.
I then copied the boot loader partition from the Raspbian image over and replaced the files that had been installed on the Kali Pi image just created. First though you need to mount the Raspbian image to extract the boot loader
Calculate the block size for mounting first by calculating the number of bytes by the starting block so in this case 512 x 122880.
Once you have this information you can then mount Raspbian with the following command
mount -o loop,offset=$((512 * 122880)) 2015-01-31-raspbian.img /mnt/raspbian
Insert your Micro SD card create a folder in the Kali Pi /lib/ directory on the main partition called modules
Copy the directory “3.18.5-v7+” from the Raspbian image over to theKali Pi /lib/modules/ directory that was just created. I advise opening a new terminal window for this though so you can check with “pwd” and get the correct working directory
So from this we need to copy /mnt/raspbian/lib/modules/3.18.5-v7+ to the Kali Micro SD card which is in the following directory for me and yours will be different to this /media/96ceeab2-4f55-41fb-8e55-91cd598e066e/lib/modules
cp -r (Copy the directory)
/mnt/raspbian/lib/modules/3.18.5-v7+ (The Raspbian directory we are copying)
/media/96ceeab2-4f55-41fb-8e55-91cd598e066e/lib/modules (Kali on the Micro SD card)
cp -r /mnt/raspbian/lib/modules/3.18.5-v7+ /media/96ceeab2-4f55-41fb-8e55-91cd598e066e/lib/modules
Check the directory copied over correctly
Now to repeat a somewhat similar process of mounting and copying with the boot loader
Calculate the block size for mounting first by calculating the number of bytes by the starting block so in this case 512 x 8192.
Now to Copy the boot-loader contents from the Raspbian Pi image to replace the contents of the Kali boot-loader but first remove all the contents on the Kali Micro SD card in the bootloader with “rm -rf *” Be careful with this as if you don’t know what you are doing you will remove the contents of the directory you are currently in. You have been warned.
Copy the full directory, all contents on the Raspbian boot loader to the Kali Micro SD boot loader
Check the Kali boot-loader again with ls and you should now see the Raspbian contents in the Kali boot-loader
Result: Kali Pi is booting up and X is also working and I have to say it is extremely fast! The first Pi was so slow compared to this and I only ever used it via SSH and used the terminal. I don’t think I can use the old one any longer now after this, I might re-purpose it as something but from now all focus is on the RPi 2!
BUT! We need to also get the kernel patched for Wi-Fi injection also so
SSH into your Kali distro
Using the editor of your choosing create a file called “recompile_kernel” or whatever you want like below and then copy and paste into your new file. Thanks to Cyberkryption for this as I hadn’t spotted it yet but this was the reason I was wanted to boot Kali on the Pi
-4.6 libc-bin libc-dev-bin libc6 libc6-dev linux-libc-dev
git clone --depth=1 https:
.gz > ~
.12.patch -O ..
patch -p1 --no-backup-
-mismatch < ..
Should look like this
Now chmod +x the file to make it executable
Should look like this
Step 20 is not working for me yet and I am getting a few errors that I need to look into a bit further, Cyberkryption on the other hand has this working.
Going back to the start of step 20 again to get wi-fi injection working on the Pi
Step 20 revisited:
I was having problems with installing “linux-source” so I had to run “apt-get update –fix-missing” first to rectify the problem, most likely due to something I was doing last night
It finished like this
Now to run “apt-get install linux-source” again and accept with -y
It finishes like this
Now run “apt-get install bc gcc gcc-4.6 libc-bin libc-dev-bin libc6 libc6-dev linux-libc-dev make manpages-dev” but as that step had ran without issue previously this step was already completed last night.
Now run “git clone –depth=1 https://github.com/raspberrypi/linux” and it should finish like below
“cd” into linux and “ls” to check the contents
Make a directory called patches in the previous directory where you created the linux file
patch -p1 –no-backup-if-mismatch < ../patches/mac80211.patch
make modules – currently looks like this after a few hours so be patient!
TO BE CONTINUED!
Congratulations on making it this far, have fun!
Big thanks to:
mame82, Ram0n & Cyberkryption for fixes along the way and sharing their knowledge.