Skip to content

Building a Kali NetHunter Workstation on an Unsupported Motorola: Custom Kernel Development, Android 16, and Remote Penetration Testing

  • by

November 24, 2026 | Linux • Android • Cybersecurity • Kernel Development • Kali NetHunter

What started as an experiment with an older Motorola phone became one of my most challenging—and rewarding—technical projects.

The goal sounded straightforward: install Kali NetHunter on a Motorola Moto G Stylus 5G (2022), gain root access, and turn the device into a portable penetration-testing workstation.

But there was a catch.

My particular device, the Motorola XT2215-4 (milanf), didn’t have a ready-to-use installation path that I had already validated for my target Android version and configuration. Getting the device fully operational meant going beyond installing applications. I needed to understand Android’s boot process, root management, kernel compatibility, hardware drivers, and eventually build my own custom kernel configuration.

By the end of this project, I had a functioning ARM64 Kali environment, a graphical Xfce desktop accessible from Windows and macOS, working Burp Suite HTTP/HTTPS testing, and a published GitHub repository documenting the successful B2 kernel build.

Here’s how it came together.

The Hardware and Software Environment

The device used throughout this project was a Motorola Moto G Stylus 5G (2022), model XT2215-4, codename milanf.

The final tested environment consisted of:

ComponentConfiguration
DeviceMotorola Moto G Stylus 5G (2022)
ModelXT2215-4
Codenamemilanf
Operating systemLineageOS 23.2 / Android 16
Root managementMagisk
Custom kernelLinux 5.4.302-moto, B2 configuration
ArchitectureARM64
Kali environmentKali Rolling ARM64 userspace
Graphical desktopXfce through NetHunter KeX
Remote accessWireless ADB and wired USB ADB
Security validationNmap, tcpdump, Burp Suite

The objective wasn’t to replace Android with Kali. NetHunter provides a Kali environment alongside Android, allowing the phone to retain its ordinary smartphone capabilities while supporting additional security tools.

Preserving those everyday functions turned out to be one of the hardest requirements.

Phase 1 — Unlocking the Device and Installing LineageOS

The first milestone was unlocking the Motorola bootloader and installing a compatible version of LineageOS.

Using the Android platform tools, I worked with the device’s fastboot interface and installed LineageOS 23.2.

The installation included the relevant device-specific boot components, including dtbo.img and vendor_boot.img.

Following installation, I verified the basics:

  • Android successfully booted.
  • Cellular calling and text messaging worked.
  • Wi-Fi and mobile data functioned.
  • The touchscreen and stylus were responsive.
  • Battery reporting and charging behaved normally.

Those tests provided a baseline before making additional changes.

Phase 2 — Root Access and the First NetHunter Problem

With LineageOS operational, the next step was Magisk root.

After installation and verification, the device successfully provided root access through the Android shell:

su -c id

The result confirmed that Magisk could execute commands as root.

I then added the NetHunter components, including the application environment and Kali userspace.

This is where things became complicated.

An initial attempt involving a NetHunter kernel package left the device with a nonfunctional touchscreen and incorrect battery reporting.

The phone could still boot, but those hardware failures made it unsuitable for everyday use.

Rather than continue flashing kernels blindly, I restored the matching LineageOS device boot components and returned the phone to a known-working state.

The touchscreen and battery functionality recovered.

That incident established an important principle for the rest of the project:

A kernel that boots isn’t necessarily a kernel that’s compatible with the device’s hardware.

Phase 3 — Understanding the Kernel Compatibility Problem

The Motorola relies on device-specific kernel components and hardware modules for functions such as touchscreen input, charging, and other platform services.

Simply replacing the kernel with another build could introduce compatibility problems even when the operating system reached the Android home screen.

I investigated the existing kernel configuration and module requirements, including touchscreen and charging-related components.

The development goal became more precise:

Start from the matching Motorola kernel source, preserve the existing hardware configuration, and introduce only the additional features needed for NetHunter.

The original upstream kernel revision used in the successful build was:

c63a2b5a1b970f8b9a231ea6a536a14bad15eab2

The build used Android Clang 21.0.0, based on r563880c.

My kernel development environment ran on Dragon, a Linux system used for compiling and validating the ARM64 kernel.

I also worked from the community kernel builder maintained by TigerClips1, whose project provided important upstream tooling and configuration support.

Upstream builder:

https://github.com/TigerClips1/Kernel-milanf-nethunter-builder

Phase 4 — Kernel B1: Establishing USB Networking Support

Before attempting a larger feature set, I created an initial custom configuration labeled B1.

The goal was to keep changes small.

B1 introduced these USB ConfigFS options:

CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y

RNDIS and ECM are USB networking mechanisms that can allow devices to expose network interfaces over USB when the necessary Android and host-side functionality is configured.

Enabling these kernel options alone doesn’t guarantee USB networking works end to end, but they establish the relevant kernel capabilities.

The important part of B1 was proving that a custom build could preserve the Motorola’s essential hardware functionality.

Phase 5 — Kernel B2: Expanding External Wi-Fi Driver Support

After establishing the baseline, I built B2, adding selected external USB wireless drivers while retaining the existing Motorola configuration.

The main additions included:

CONFIG_ATH9K_HTC=y
CONFIG_RT2800USB=y
CONFIG_MT76x2U=y

These options target supported devices in the Atheros, Ralink, and MediaTek USB wireless adapter families.

The final B2 configuration retained the B1 USB networking options.

The ARM64 kernel compiled successfully, producing:

Image
Image.gz

I also preserved the complete final kernel configuration and SHA-256 fingerprints of the build artifacts.

At this stage, the additional wireless drivers were configured and compiled, but external adapters, monitor mode, and packet injection had not yet been fully validated.

That distinction matters. Kernel support should not be described as confirmed hardware functionality until it has actually been tested.

Phase 6 — Testing the Custom Boot Image Safely

A successful compilation was only one part of the process.

I still needed to integrate the kernel into a boot image without losing Android functionality or Magisk root.

The working approach preserved the matching boot-image components, including the Android ramdisk and existing Magisk environment.

I tested the resulting B2 boot image temporarily before installing it permanently.

Only after the temporary boot succeeded did I proceed with the tested active boot slot.

The validation process included confirming:

  • Android startup
  • Touchscreen and stylus operation
  • Battery status and charging
  • Cellular connectivity
  • Built-in Wi-Fi and Bluetooth
  • Magisk root
  • Kali terminal access

The final B2 boot image was installed to the tested A-slot configuration.

The resulting system retained the device’s everyday smartphone functionality while running the custom kernel.

Phase 7 — Building the Kali Graphical Desktop

With the kernel working, I returned to the Kali NetHunter environment.

The Kali ARM64 userspace successfully ran tools including Nmap, iw, and tcpdump.

I then configured NetHunter KeX, which provides remote access to the graphical desktop environment.

Using Xfce, the Motorola could present a familiar Kali desktop with a terminal, application menu, browser, and installed security applications.

The first successful graphical session ran through the NetHunter KeX client on the phone itself.

But I wanted something more practical.

I wanted to connect to the phone from another computer and use the desktop with a full keyboard, mouse, and larger screen.

Phase 8 — Wireless Remote Desktop Access

My first successful remote desktop connection used Android Wireless Debugging.

The Motorola and a Windows computer joined the same Wi-Fi network.

After pairing the phone with ADB, I verified that the device appeared as an authorized debugging connection.

Then I forwarded KeX’s VNC port:

adb forward tcp:5901 tcp:5901

On Windows, TigerVNC connected to:

127.0.0.1::5901

The result was a full Kali Xfce desktop running on the Motorola and displayed remotely on Windows.

The Motorola performed the actual computation. Windows simply provided the remote graphical interface.

This was a major milestone because it demonstrated that the phone could serve as a portable Linux workstation rather than merely running terminal-based tools.

Phase 9 — Troubleshooting Wired USB Access

Wireless access worked, but I also wanted a wired connection that didn’t depend on Wi-Fi.

That led to an unexpectedly long USB troubleshooting session.

Initially, Windows failed to recognize the Motorola as a usable USB debugging device.

Investigation showed that Android’s debugging service was running, the USB gadget was associated with the physical controller, and the ADB function appeared configured.

However, the connection wasn’t completing normally.

Because the custom B2 kernel had already demonstrated working USB ADB earlier, I avoided immediately blaming the kernel.

Eventually, I switched to my daily MacBook and tested a different USB-C data cable.

The results changed immediately.

macOS recognized the Motorola, and ADB reported an authorized USB device:

ZY22FS4FFZ    device usb:...

I then ran:

adb forward tcp:5901 tcp:5901
open vnc://127.0.0.1:5901

macOS Screen Sharing opened the Kali desktop successfully over the physical USB connection.

This didn’t conclusively prove every Windows USB problem was caused by the earlier cable, but it showed that the custom B2 kernel and phone could establish working USB ADB connections.

Most importantly, the USB issue didn’t require another kernel rebuild.

Phase 10 — Testing Real Security Tools with Burp Suite

Next came application-level validation.

A graphical desktop is useful, but I wanted evidence that NetHunter could perform actual security-testing workflows.

I installed Burp Suite Community Edition in the Kali ARM64 environment.

Burp launched successfully and remained responsive through the remote desktop connection.

There were two complications.

First, Burp’s bundled browser failed to start. I used Firefox inside Kali instead and configured its proxy settings to point to Burp’s local listener at 127.0.0.1:8080.

Second, Burp initially displayed unusual font rendering. Launching Java with adjusted antialiasing settings improved readability:

_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true" burpsuite

Once configured, I validated the proxy using a request to example.com.

Burp successfully captured an HTTP request and displayed a 200 OK response.

I then tested HTTPS traffic against my own website, hbtechsolutions.com.

Burp successfully displayed the site’s HTTPS request and response data, populated its site map, and exposed the returned HTML and supporting resources.

Finally, I sent the homepage request to Burp Repeater and replayed it successfully.

The Repeater response returned:

HTTP/2 200 OK

At that point, I had validated more than a graphical desktop.

The Motorola was successfully running a Java-based web testing application, proxying browser traffic, inspecting HTTPS responses, and independently replaying requests.

The testing was limited to public connectivity checks and systems I was authorized to assess.

Phase 11 — Publishing the B2 Kernel Configuration

With the working configuration validated, I decided to publish the development work.

Rather than upload a mysterious boot image, I assembled a GitHub repository containing:

  • B1 and B2 configuration fragments
  • The complete final B2 kernel configuration
  • Configuration differences between B1 and B2
  • SHA-256 checksums for the original build artifacts
  • Build documentation
  • Validation records
  • Flashing and recovery considerations
  • GPLv2 licensing and upstream attribution

The source work was committed and published to GitHub.

On November 24, 2026, I released:

v1.0.0-b2 — Motorola milanf NetHunter B2 Configuration Release

Repository:

https://github.com/iireddrag0nii/motorola-milanf-nethunter-b2

Versioned release:

https://github.com/iireddrag0nii/motorola-milanf-nethunter-b2/releases/tag/v1.0.0-b2

This initial release contains configuration and documentation only.

It does not distribute a personal Magisk-patched boot image or claim to provide a universally compatible flashable kernel.

What Works—and What Still Needs Testing

CapabilityStatus
LineageOS 23.2 bootValidated
Magisk rootValidated
Custom B2 kernelValidated on test device
Touchscreen and stylusValidated
Battery and chargingValidated
Cellular, Wi-Fi, BluetoothValidated
Kali ARM64 environmentValidated
KeX desktopValidated
Wireless ADB remote accessValidated
Wired USB ADB on macOSValidated
Burp HTTP/HTTPS proxyValidated
Burp RepeaterValidated
External USB Wi-Fi adaptersNot fully tested
Monitor modeNot tested
Packet injectionNot tested
USB HID featuresNot fully tested
Clean-room kernel rebuildNot independently validated

A working kernel doesn’t automatically make every NetHunter hardware feature operational. Those require separate device and adapter testing.

Lessons Learned

Several lessons stood out during this project.

Preserve the device’s hardware baseline. A kernel that boots but breaks touchscreen or charging functionality isn’t a successful port.

Change one group of features at a time. Separating the USB networking work in B1 from the wireless driver additions in B2 made the configuration easier to understand and troubleshoot.

Verify the source and toolchain. Exact source revisions and compiler information matter when troubleshooting kernel compatibility.

Test before permanently flashing. Temporary boot testing provided a safer way to validate major changes.

Don’t immediately blame custom code. The USB debugging problem initially appeared related to the kernel, but changing the USB-C cable and host computer produced a working wired connection.

Document successful and unsuccessful experiments. The recovery process, kernel differences, and remaining limitations are as useful to future developers as the final working build.

Publish reproducible evidence, not just results. Kernel configurations, build fingerprints, validation records, and attribution make an open-source project more useful.

What’s Next?

The project is functional, but development doesn’t necessarily end here.

Potential future work includes testing supported external USB Wi-Fi adapters, verifying monitor mode and injection behavior in an authorized lab, further investigating USB HID capabilities, and validating a clean rebuild from the published configuration.

I also plan to keep documenting improvements and lessons learned through hbtechsolutions.

Final Thoughts

This project started as an attempt to run Kali NetHunter on an older Motorola phone.

It became a hands-on exercise in Android boot architecture, kernel development, Linux configuration, hardware compatibility, remote access, and security-tool validation.

Today, the device can operate as a normal Android phone, run a Kali ARM64 environment, display a full Xfce desktop, and provide wired or wireless remote access from another computer.

The custom B2 kernel configuration is also publicly documented and versioned on GitHub.

More importantly, I learned a great deal about how Android and Linux fit together beneath the graphical interface.

Sometimes the biggest value in a homelab project isn’t the final system. It’s the engineering required to make it work.


Project: hbtechsolutions

GitHub: https://github.com/iireddrag0nii/motorola-milanf-nethunter-b2

Release: https://github.com/iireddrag0nii/motorola-milanf-nethunter-b2/releases/tag/v1.0.0-b2

This project is intended for education, research, and authorized security testing. It is not an official Kali NetHunter release.

Leave a Reply

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