[Help]Enabling USB HID Support - Android Q&A, Help & Troubleshooting

i have gt-i9301i running resurrection remix 5.1.1 .currently my kernel doesnt have usb hid emulation support to run badusb type attacks .
i found pelya's keyboard app.but my device dont have prebuilt kernel to flash and use hid emulation.but he has a kernel patch in github repo to add support for more devices.
question is how can i apply patch to my current kernel.do i need source code of kernel and recompile it or backup of my kernel and then patch it.if you know how to apply this patch please teach me i need it .

Related

[Q]Create CM Kernelpatch

Hello everybody,
I have the Stock kernel for my device and I downlaoded the Cm-Kernel. Is there a way to create a patch containing all the Kerneltweaks from Cm-Kernel for the Stockkernel. I know how to handle diff, but I don't know which files are changed and which I should leave like they are. Or if its easier to patch the device specific configurations to the CM-Kernel?
These are the folders both Kernels contain:
Code:
arch crypto include kernel net security
block Documentation init lib README sound
drivers ipc MAINTAINERS REPORTING-BUGS tools
COPYING firmware Kbuild Makefile samples usr
CREDITS fs Kconfig mm scripts virt
chaoskoch said:
Hello everybody,
I have the Stock kernel for my device and I downlaoded the Cm-Kernel. Is there a way to create a patch containing all the Kerneltweaks from Cm-Kernel for the Stockkernel. I know how to handle diff, but I don't know which files are changed and which I should leave like they are. Or if its easier to patch the device specific configurations to the CM-Kernel?
These are the folders both Kernels contain:
Code:
arch crypto include kernel net security
block Documentation init lib README sound
drivers ipc MAINTAINERS REPORTING-BUGS tools
COPYING firmware Kbuild Makefile samples usr
CREDITS fs Kconfig mm scripts virt
Click to expand...
Click to collapse
If you are going to be using all the cm kernel tweaks anyway, why not just use the cm-kernel? Maybe there is something I am missing.
lithid-cm said:
If you are going to be using all the cm kernel tweaks anyway, why not just use the cm-kernel? Maybe there is something I am missing.
Click to expand...
Click to collapse
But in the Kernel are some device specific information and drivers,
is there a way to get them all in the CM-Kernel?
Or aren't there any and I just need the .config-file?

Kexec-hardboot patch

In this post, I would like to explain what kexec-hardboot patch is and also bring it to light a bit more since until now, it was only burried in MultiROM thread.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 7. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.
What is the difference between normal and hardboot exec?
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Unlike grouper's kexec-hardboot patch, this one only requires the host kernel to be patched. This is one of the improvements I made, and I think it is pretty significant.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Kernel patch: https://gist.github.com/Tasssadar/6687647, 4.3 AOSP kernel repo, cm 10.2 kernel repo
This is the kernel patch. Only the host kernel needs to be patched.
Related CONFIG options:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
All these options must be enabled.​
Userspace kexec binary: View attachment kexec-tools.zip
That ZIP file contains kexec source, patches and README. It is from the original patch from Mike Kasick. It also contains precompiled, statically linked kexec binary, so you probably just want to use that.​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x85000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
For flo, I've improved the patch a bit - only the host needs to be patched now and I also fixed a bug with /proc/atags not reading all tags.
The patch was updated with commit https://github.com/Tasssadar/androi...mmit/20f59235cf61694f8118b943e33aa382fc9ad494 in repositories and on gist.
The reason is that my initial ramdisk address was not compatible with all kernels, and changing it resulted in a problem to appear on CM kernel - it just crashes on kexec-hardboot call. AOSP kernel worked just fine after the change, but I applied the patch just to be sure. Sorry about this, I didn't expect the patch to change at all, but it happened :/ I really hope this is the last time.
@ayysir originaly made this change, thanks.
@Tasssadar I would like to port your kexec-hardboot patch on my device which has a Qualcomm MSM7225A chipset with a locked bootloader. How do I locate the memory addresses in adb shell to boot the kernel? Thanks. I'm currently using Fedora 64-bit on my computer.

[Q] Android .mk makefiles, prebuilt tools, NDK roles

Hello,
I actually have successfully build some kernels. Mainly, this is the linux way:
- get kernel sources
- get hardware specific changes
- get the toolchain -> i'm using google prebuilt tree, with ARM tool chain 4.4.3 already compiled
- build with usual steps: def_config, configure, kernel, modules
All is ok.
Now, i found Android.mk files. Precisely, a previous kernel, with sensors related to my device, that i would like to port.
But here comes the trouble. I have hard time to do the link between Linux kernel for ARM and Android makefile. I don't see how it goes with my kernel, how i could compile this using the prebuilt tools i could grab from Google.
In short, how to include .mk files into a classic kernel ? What should i get in the end ? A module ? A replacement binary ? More precisely, what is exactly NDK and where it stands in the above layers ?
ARM Linux Kernel <--> Dalvik JVM <--> APK
Last, is it possible with Google prebuilt to compile the .mk without referencing your kernel ?
Thank you !
Thank you for your help
Damn ! Either the questions is too obvious, either it is too complex. Any help ?
Self reply: downloading the NDK is mandatory
- you can use your favorite toolchain, provided with the NDK
- you can embed the .mk into your application, for Eclipse / Android studio, it will use the NDK to compile

[request][kernel module compiling]

Hi. So I have an old android phone (galaxy y) and found an useful utility for it since it has BCM4330 wifi chipset. It can be an hipster wifi pententing/analise tool.
To make it work I have to compile a Kernel module for it. I already read thousand posts, and i'm so newbie on Kernel Compiling/ cross compiling.
So what i'm asking is for someone familiar with kernel compiling to compile a loadable module form my kernel( using Kernel Source and Module source already with makefiles, etc)
The Kernel source: github .com/rajamalw/galaxy-s5360/tree/master/kernel
The Kernel Loadable Module Source(from bcmon source): drive. google. com/open?id=0B6scZvDwgLTVbUFXQjIwMkZKSHM
I would be Immeasurably grateful!
Thanks in advance!

[KERNEL][UNOFFICIAL] Kali NetHunter for Galaxy J5 [SM-J500H/F/FN/G/M]

Kali NetHunter for Galaxy J5 (2015)
Spoiler: Disclaimer
I am not responsible if flashing this Kernel bricks your
phone or causes thermonuclear war and ends the
world as we know it. You have been warned.
Also check out the FAQ Section
Spoiler: FAQ (Important)
Q: Why do i need this?
A: To get Nethunter fully work you need a kernel that supports its features, such as put a wireless adapter in monitor mode or perform a HID Keyboard attack.
Q: Why are you using nougat based roms?
A: Because i cannot make packet injection/monitor mode work on any rom past nougat.
Q: My phone restarts when i remove the wifi adapter ie wlan1
A: Its a common issue, workaround is to "iw dev wlan1 del" and remove the adapter your phone won't restart, And you can add the card again when using nethunter again by "iw phy phy1 interface add wlan1 type managed"
Q: Will you add HID patches & Bluetooth patches in the future?
A: Currently i cannot make them work, but will try in the future.
Features:
Packet Injection
Monitor mode
Ralink support
Realtek support
Atheros support
Installation :
- Always Take a Nandroid backup
- Download LineageOS 14.1/Resurrection-Remix-N
- Recommended - Full wipe and factory reset
- Flash LineageOS 14.1/Resurrection-Remix-N using TWRP
- Flash This Kernel using TWRP
- Flash Magisk
- Flash Nethunter-2023.2-generic-armhf-kalifs-nano [Yes Nano no space for anything else in our device xD]
- Profit!
Downloads:
Download Link - v0.5beta
Working:
Check rom's thread for that this is just a kernel xD
Not working:
HID attacks
Bluetooth attacks
XDA: DevDB Information
NetHunter, Kernel for the Samsung Galaxy J5
Contributors
djkido316
Source Code: https://github.com/djkido316/android_kernel_samsung_msm8916
Special Credits:
vince2678 for LineageOS 14.1 & Kernel Source
has.007 for RR-N 5.8.5
ROM Firmware Required : Nougat 7.1.2 LineageOS based roms
ROM Kernel: Linux 3.10.108
Version Information
Status: Beta
Created 2023-06-21
Last Updated 2023-06-21
R E S E R V E D
hellow thanks
Kudos @ djkido316 !!
Now, we could do an experiment further more with our J5 Device, Thanks!
Tajil said:
Kudos @ djkido316 !!
Now, we could do an experiment further more with our J5 Device, Thanks!
Click to expand...
Click to collapse
That's the idea, and you're welcome!

Categories

Resources