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.

4 inch touch screen case kit for raspberry pi 4
The case in question with the screen, case, fan and Raspberry Pi 4

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:

  1. 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)
  2. 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
  3. Eject SD card and put it in the raspberry pi
  4. Run Nmap to see you current network devices (update your subnet if needed):
    $ sudo nmap -sn
  5. Before plugging the usb power into the Rpi, plug your ethernet cable and
  6. Wait 5 minutes if you have no other screens attached (like me) or until you get a login prompt if you do
  7. Run Nmap again, find the one for the raspberry pi and ssh into it (password will be “kali”):
    $ ssh [email protected]
  8. Install this library:
    $ sudo apt install xserver-xorg-input-libinput
  9. Clone the repo:
    $ git clone https://github.com/danielcshn/LCD-show-kali.git
  10. run the LCD-show-kali script, mine was:
    $ sudo ./MPI4008-show 180
  11. when it asks to reboot, hit ctrl+c and power off the Raspberry Pi instead:
    $ sudo poweroff
  12. once the ACT light (green) on your Raspberry Pi stops flashing, remove usb power
  13. remove your SD card from your Rpi and plug it back in your computer
  14. 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!
  15. Eject the SD card and put back in your Raspberry Pi and power it up
  16. 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

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border

# uncomment to force a console size. By default it will be display's size minus
# overscan.

# uncomment if hdmi display is not detected and composite is being output

# uncomment to force a specific HDMI mode (this will force VGA)

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display

# uncomment for composite PAL

#uncomment to overclock the arm. 700 MHz is the default.

# Uncomment some or all of these to enable the optional hardware interfaces

# Uncomment this to enable infrared communication.

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)

# USB mass storage boot is available on Raspberry Pi 2B v1.2, 3A+, 3B, and 3B+ only.

# Pi2 is 64bit only on v1.2+
# 64bit kernel for Raspberry Pi 2 is called kernel8 (armv8a)
# 64bit kernel for Raspberry Pi 3 is called kernel8 (armv8a)
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
# 64bit kernel for Raspberry Pi 4 is called kernel8l (armv8a)
# Tell firmware to go 64bit mode.

# 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+
hdmi_cvt 480 800 60 6 0 0 0

Leave a Reply

Your email address will not be published. Required fields are marked *