View Full Version : Rpi2+Kali 2.0.1: how to get almost all the 1GB RAM instead of only 750MB

2015-09-08, 07:22
This is what you get with Kali 2.0.1 stock image for Raspberry PI 2:

root@kali:~# free
total used free shared buffers cached
Mem: 762468 97792 664676 5416 10276 44072
-/+ buffers/cache: 43444 719024
Swap: 0 0 0

To assign almost all the 1GB RAM to the ARM CPU instead of the GPU you must:
1. Patch and rebuild the kernel.
2. Add to the FAT boot partition a config.txt file containing gpu_mem=16

Here is the Linux kernel patch:

< # CONFIG_HIGHMEM is not set
> # CONFIG_HIGHPTE is not set

Here is the config.txt:


This is what you should get after booting the patched Kali image:

root@kali:~# free
total used free shared buffers cached
Mem: 998136 152244 845892 13168 13464 84704
-/+ buffers/cache: 54076 944060
Swap: 0 0 0

Note: the used RAM is 150KB because stock Kali image starts in graphical mode, but you can disable lightdm autostart:

systemctl set-default multi-user.target

WARNING: while 256MB more memory is a big deal especially for text-mode usages, it may break SonicPI (http://sonic-pi.net/) and few other tricky apps.

A detailed tutorial on how-to cross-compile ARM (Rpi2) on a Kali 2.0 host VM or PC, and gain 256MB RAM on your Rpi2 is here: http://cybersecnow.blogspot.it/2015/09/kalipi-custom-build-how-to-cross.html

2015-09-15, 05:17
Thanks for the guide and resources. I already have a full package of Kali installed on my SD card.
I installed the meta package which include all the available tools. So I did a fair share of downloading.
Building the whole image again shall force me to download and install all those meta package tools once again which is time consuming and a pain.
Instead, can I recompile and create just a 'patched-kernel-arm7l.deb' which can be installed via package manager ?
Why a cross-compilation is necessary ? Because RPi2 doesn't have the power to compile fast ?
If someone can create this kernel, can't this be shared on all the Kali RPi2 installs globally (except for the custom device drivers) ?