offensive-security / nethunter-devices

NetHunter Devices
248 stars 197 forks source link

Added Galaxy S6/S6 Edge AOSP Kernel Files #109

Closed ghost closed 6 years ago

ghost commented 7 years ago

Here is my Galaxy S6/S6 Edge Image files but now with a working Drivedroid patch and with almost all functions (Missing HiD compatibility only). Both devices have the "dtb.img" and the "Image" file for both kernels.

This is based off TeamNexus kernel source code for the LineageOS nougat rom.

kimocoder commented 7 years ago

Has wireless injection patch been included? The mac80211 patch which could be found in the wiki?

ghost commented 7 years ago

yes, it has, you can check the net/mac80211/tx.c file

ghost commented 7 years ago

And has all tge monitor mode drivers

jcadduono commented 7 years ago

Hi, went over your kernel config, can you please include:

CONFIG_FHANDLE=y
CONFIG_EXPORTFS=y
CONFIG_DEFAULT_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_DNS_RESOLVER=m
CONFIG_BT_RFCOMM=m
CONFIG_BT_ATH3K=m
CONFIG_CIFS=m (currently y, CIFS is definitely something you want in module form)
CONFIG_CIFS_SMB2=y

and I can't remember the exact config names to enable RTL2832 DVB, but you can go to device drivers -> multimedia support -> [*] Media USB adapters [*] Digital TV support -> Media USB adapters -> [*] Support for various USB DVB -> [*] Realtek RTL28xxU DVB USB support

that should do it!

You then need to make sure to copy the modules folder into the nethunter device dir properly, to do this:

mkdir modout
make INSTALL_MOD_PATH=modout  INSTALL_MOD_STRIP=1 modules_install

after building, then enter modout/lib and copy the modules folder to the nethunter device folder

it's a good idea to change many wireless drivers to modules and whatever other large things you can think of to make the installer compatible across different roms which may have larger ramdisks, especially with the S6 small boot partition compared to giant kernel Image

ghost commented 7 years ago

Working on it

ghost commented 7 years ago

Ok, so I just added the required files

kimocoder commented 7 years ago

Good job sir

ghost commented 7 years ago

Thanks :)

ghost commented 7 years ago

Added a missing line to devices.cfg

jcadduono commented 7 years ago

Looks good to me, does the install succeed and are you able to use modprobe cifs and see it in lsmod after that without issue

ghost commented 7 years ago

Im goibg to try it, Im having issues with the build.py script. I have to use a old zip file from my library to make the flashable zip file. In the case of the Image I just have to replace it in the boot-patcher folder, but what about the modules folder, what can I do related to that folder. Because I don't know why recently I can't build zip flashable files, I always get a error in the beggining of the process saying "unable to decompress boot image". Every time I try to test a kernel Image I have to go to my old made nethunter zip file and change the Image inside the boot-patcher folder

jcadduono commented 7 years ago

that should have been fixed by adding the arch = arm64 line (because arm dynamic binaries will not run with aarch64 dynamic libs)

the modules will be automatically installed by the installer

ghost commented 7 years ago

Ok, thanks I will try it

ghost commented 7 years ago

OK so firstly after install I've runned the desired command and this was the output ..Output

ghost commented 7 years ago

So then I've navigated to the original root of my phone and then I've discovered that the lib/modules folder was in the lib/modules of my androidsu root so then I've copied the folder to the root of the Kali terminal and I rerwited the command and this was the output ... 2nd output

ghost commented 7 years ago

Is anything wrong or should I do anything else

PS: kalifs are updated and for that reason they have a different md5 hash, when I download kalifs through nethunter app I've a error because md5 hash doesn't match. I've to manually download them from the repo

jcadduono commented 7 years ago

if the kernel installed properly using the latest from build.py then it should have installed the modules in /system/lib/modules and /lib/modules should exist in the boot image/ramdisk and be a symlink to /system/lib/modules

does /lib/modules/3.10.107....... exist in androidsu? you should be able to modprobe from androidsu without making any changes

i think i should actually bind mount inside bootkali to fix the issue you ran into

https://github.com/offensive-security/nethunter-app/blob/master/assets/scripts/bootkali_init#L149 after that line should actually be $busybox mount -r -o bind /system/lib/modules $mnt/lib/modules

it looks like everything is ok to me, are you ready to merge?

jcadduono commented 7 years ago

i'm also a little confused about your kernel sources, are you using my build.sh script, is it working for you? if so that's great, they work better when you set in your config

CONFIG_LOCALVERSION="-"
# CONFIG_LOCALVERSION_AUTO is not set

then set https://github.com/madScript01/TeamNexusNethunter/blob/los-14.1/build.sh#L80 to export LOCALVERSION=madScript01-$TARGET-$DEVICE-$VARIANT-$VER (if you wanted your name in the version tag)

and another section

[ "$TARGET" ] || TARGET=nethunter
[ "$1" ] && DEVICE=$1
[ "$2" ] && VARIANT=$2
[ "$DEVICE" ] || DEVICE=zeroflte
[ "$VARIANT" ] || VARIANT=xx

DEFCONFIG=${TARGET}_${DEVICE}${VARIANT}_defconfig

to fix based on your config name scheme

echo 1.0 > VERSION will update the version tag

btw still missing

CONFIG_FHANDLE=y
CONFIG_EXPORTFS=y

(needed for some kali programs)

ghost commented 7 years ago

Ok, I added almost all the the changes but I just don't know which line should I add the "CONFIG_EXPORTFS=y"

Because I did a "crtl-f" and couldn't find any CONFIG_EXPORTFS or only EXPORTFS in the the config :/

jcadduono commented 7 years ago

It exists after adding CONFIG_FHANDLE=y

ghost commented 7 years ago

So, I should add that line after the CONFIG_FHANDLE=y right?

ghost commented 7 years ago

Ok, so I've discovered that in official nougat rom, the s6 has a smaller kernel Image, and it has enough space for all the drivers and patches, should I merge kali nethunter for aosp (less stable) or should I make a new project for official firmware (more stable)?

jcadduono commented 7 years ago

Can do both if you like. Remember, you can turn lots of features into modules to save kernel size. I just need to set that bind mount in NH bootkali script and the kernel should properly auto load them. Official may take a lot of work outside kernel, last time I had worked on a modern Samsung device, custom kernels cannot boot without a custom init binary and a couple system modifications. If that's still a problem you can make those mods with patch.d scripts

ghost commented 7 years ago

I would like to make them both, can you just answer me just in what do I do related to the CONFIG_EXPORTFS please?

jcadduono commented 7 years ago

I don't know what to say about it just enable it

ghost commented 7 years ago

Ok, done now I'm going to rebuild the kernel Image and the Kernel modules so we can proceed with the merge

ghost commented 7 years ago

Ok, everything done and I've also found a Synapse patch which included HiD support that I've commited into a ramdisk patch everything is now ready to merge I think

kimocoder commented 7 years ago

@bozwald take a look at the work been done here, adding HID support in kernel etc.. might be some useful knowledge for our project

bozwald commented 7 years ago

@kimocoder thanks for this,

Great work guys really amazing.

ghost commented 7 years ago

Just added some missing HiD files

ghost commented 7 years ago

I think now its ready to merge

jcadduono commented 7 years ago

is there a reason you filled the ramdisk folder with....everything it is only for files that need to be added to the ramdisk, not replaced or edited if you need to edit specific files in the ramdisk i suggest using sed in a patch.d script

ghost commented 6 years ago

It's not filled with everything its just filled with some files, I did just like the oneplus 5 oos version did with the ramdisk adding of some files

ghost commented 6 years ago

I've done many changes and I'm about to make another pull request because this one is getting to old and outdated