I recently purchased a Raspberry Pi 4 to play with its new features and decided to make it a dedicated Kali linux ethical hacking device with a 4 inch touch screen case kit I got off Amazon for pretty cheap.
Setting up the device with Kali Linux and Drivers
Since the instructions guide you to a pre-made Kali linux image you burn on your SD card and that it’s an old version of Kali Linux and because I don’t trust pre-made images, I decided to install the latest from the Kali Linux’s website and install drivers manually. Turns out it’s not really plug and play (as they say on Amazon).
After some research on the device, I stumbled upon install scripts for these screens that ends up into a kernel panic every time. Nice.
Then I stumbled on this Git repo from a guy that fixed the original scripts and someone that pretended it to work on Kali 2020. Still ended up into a kernel panic for me on Kali 2021…
The solution (for me) to install the screen drivers on Kali Linux 2021
For this, I used my Mac, Nmap, an SD card reader and Balena Etcher. You might need to adjust your subnet accordingly.
Tweaked the steps some more and ended up with this:
- Burn the latest disk image from the Kali Linux website to SD card (I used balenaEtcher with the “kali-linux-2021.1-rpi4-nexmon-64.img.xz” image)
- Remove and re-mount SD Card, copy the config.txt file in there on your computer and create a blank file named “ssh” in there
- Eject SD card and put it in the raspberry pi
- Run Nmap to see you current network devices (update your subnet if needed):
$ sudo nmap -sn 192.168.0.0/24
- Before plugging the usb power into the Rpi, plug your ethernet cable and
- Wait 5 minutes if you have no other screens attached (like me) or until you get a login prompt if you do
- Run Nmap again, find the one for the raspberry pi and ssh into it (password will be “kali”):
$ ssh [email protected]
- Install this library:
$ sudo apt install xserver-xorg-input-libinput
- Clone the repo:
$ git clone https://github.com/danielcshn/LCD-show-kali.git
- run the LCD-show-kali script, mine was:
$ sudo ./MPI4008-show 180
- when it asks to reboot, hit ctrl+c and power off the Raspberry Pi instead:
$ sudo poweroff
- once the ACT light (green) on your Raspberry Pi stops flashing, remove usb power
- remove your SD card from your Rpi and plug it back in your computer
- open the config.txt file on the boot partition that’ll show up, delete everything above the last section and replace with the whole original config.txt file you copied earlier (step 2). I replaced everything above this:
# If you would like to enable USB booting on your Pi, uncomment the following line. # Boot from microsd card with it, then reboot. # Don't forget to comment this back out after using, especially if you plan to use # sdcard with multiple machines!
- Eject the SD card and put back in your Raspberry Pi and power it up
- Screen should work along with touch
The working config.txt file that worked for me
# For more options and information see # http://rpf.io/configtxt # Some settings may impact device functionality. See link above for details # uncomment if you get no picture on HDMI for a default "safe" mode #hdmi_safe=1 # uncomment this if your display has a black border of unused pixels visible # and your display can output without overscan #disable_overscan=1 # uncomment the following to adjust overscan. Use positive numbers if console # goes off screen, and negative if there is too much border #overscan_left=16 #overscan_right=16 #overscan_top=16 #overscan_bottom=16 # uncomment to force a console size. By default it will be display's size minus # overscan. #framebuffer_width=1280 #framebuffer_height=720 # uncomment if hdmi display is not detected and composite is being output #hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode (this will force VGA) #hdmi_group=1 #hdmi_mode=1 # uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes #hdmi_drive=2 # uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4 # uncomment for composite PAL #sdtv_mode=2 #uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800 # Uncomment some or all of these to enable the optional hardware interfaces #dtparam=i2c_arm=on #dtparam=i2s=on #dtparam=spi=on # Uncomment this to enable infrared communication. #dtoverlay=gpio-ir,gpio_pin=17 #dtoverlay=gpio-ir-tx,gpio_pin=18 # Additional overlays and parameters are documented /boot/overlays/README # Enable audio (loads snd_bcm2835) dtparam=audio=on # USB mass storage boot is available on Raspberry Pi 2B v1.2, 3A+, 3B, and 3B+ only. #program_usb_boot_mode=1 [pi2] # Pi2 is 64bit only on v1.2+ # 64bit kernel for Raspberry Pi 2 is called kernel8 (armv8a) kernel=kernel8-alt.img [pi3] # 64bit kernel for Raspberry Pi 3 is called kernel8 (armv8a) kernel=kernel8-alt.img [pi4] # Enable DRM VC4 V3D driver on top of the dispmanx display stack #dtoverlay=vc4-fkms-v3d #max_framebuffers=2 # 64bit kernel for Raspberry Pi 4 is called kernel8l (armv8a) kernel=kernel8l-alt.img [all] #dtoverlay=vc4-fkms-v3d # Tell firmware to go 64bit mode. arm_64bit=1 # If you would like to enable USB booting on your Pi, uncomment the following line. # Boot from microsd card with it, then reboot. # Don't forget to comment this back out after using, especially if you plan to use # sdcard with multiple machines! # NOTE: This ONLY works with the Raspberry Pi 3+ #program_usb_boot_mode=1 hdmi_force_hotplug=1 hdmi_force_edid_audio=1 dtparam=i2c_arm=on dtparam=spi=on enable_uart=1 display_rotate=3 max_usb_current=1 config_hdmi_boost=7 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_drive=2 hdmi_cvt 480 800 60 6 0 0 0 dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900