Ok, it’s been a while since I last built a Custom Kali image for the raspberry Pi 2. It’s become much easier to build an image now and it takes very few steps which is excellent!
First start by creating a new directory called arm-stuff
Change into the arm-stuff directory
Clone the cross compiler for the armhf image from github
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7
Set export PATH to set your cross compiler directory
Clone the kali-arm-build-scripts from git
git clone https://github.com/offensive-security/kali-arm-build-scripts
Change into the newly created kali-arm-build-scripts directory
Running “ls” will show you everything in the kali-arm-build-scripts directory, use your editor of choice and open the Raspberry Pi 2 script “rpi2.sh” and modify it if you want to follow along and install only the wireless tools or you can leave the next two steps and just run “build-deps.sh” to install any dependacies you may require to build your image.
Modify everything after the “tools=” variable and replace the current string with “kali-linux-wireless” to install only the wireless tools. You can get a full list of meta packages to configure different builds.
I also like to keep the image file created during the build creation process so that I don’t have to run unxz against the newly created img.xz file when finished, once again completely optional and a personal preference.
Next before starting off the build process you should also check for any dependencies you may require by running build-deps.sh which should finish without any error.
Run the rpi2.sh script followed by whatever you want to name your finished build. My name below is “Kali_Pi2_Custom_Wireless_Tools” but feel free to change the name to anything else.
Let this run for some time depending on your system and Internet speed and when finished you should see a similar result like I have below:
Checking the contents of the directory with “ls” you will now see a newly created directory with your custom image inside.
Use dd to transfer the image to your microsd card:
dd if=name_of_image.img of=/your/microsd bs=1M
As always be very careful with dd so as not to image your running disk as it will destroy any drive or partition if you copy it to the wrong location, use “fdisk -l” and plug your card in and out and see what changes to get the correct device to copy to. You may see something like “/dev/sdb1” and “/dev/sdb2” in this case you want to use the whole disk so choose “/dev/sdb” to get the root of the drive.
When finished the transfer run “sync” to synchronize any cached writes to persistent storage, the persistent storage being your microsd card because if you remove it to early the copy may not have fully completed yet even though the dd process has finished. Just run it and see how long it takes, if it finishes quickly that just means it’s fully finished. Otherwise it may take a minute or two, when that happens be glad you ran it or you would have had to run the dd transfer again as the image would be corrupted!
Next remove your microsd and plug it into your Raspberry Pi 2 and boot it up!
It might be wise to remove any pets from the process…