PDA

View Full Version : Something seems wonky with NetHunter Kernel builder



aaronouthier
2020-04-16, 14:53
So, as I've said in other messages, I'm attempting to compile for LineageOS 16 for a OnePlus 1.

I have done as instructed for the build process, however, when I build a NetHunter kernel zip file (option 5 in the build.sh menu), there is no zImage-dtb, and very little in the modules folder. When I check out/arch/arm/boot, I see 1 file: msm8974pro-ac-pm8941-a0001.dtb

If I rename (with mv) that file to zImage-dtb, then that file is included in the zip file. However, when I extract that to the NH kernel device folder for my build (after backing-up and deleting what was there), I notice there are only a few files in the modules folder, and no actual modules!

I tried creating a kernel-only installer, and installing it anyway. Sure enough, it does not work. Hangs on the OnePlus logo.

Incidentally, creating an anykernel installer directly from build.sh creates an unusable file - when I go to flash it in TWRP, I am told that the package is for a OnePlus 7 pro!!??

aaronouthier
2020-04-16, 14:56
ls -R modules_out/
modules_out/:
lib

modules_out/lib:
modules

modules_out/lib/modules:
3.4.113-NetHunter-ga160ed58b3b-dirty

modules_out/lib/modules/3.4.113-NetHunter-ga160ed58b3b-dirty:
kernel modules.builtin modules.order

modules_out/lib/modules/3.4.113-NetHunter-ga160ed58b3b-dirty/kernel:

aaronouthier
2020-04-16, 18:03
I can't imagine that the problem is due to my build OS being Kali, instead of something more traditional, like Ubuntu or Mint, could it?

re4son
2020-04-16, 22:49
Kali is perfect. I'm using it for all our builds.
Looks like the compilation didn't complete.
Why don't you add the link to your kernel repo to the local.config and post it here? I can give it a go and see where it bombs out.

aaronouthier
2020-04-16, 23:31
D'oh, I just wiped my build environment to start over. Again...

Should be straightforward to build, however:
https://github.com/lineageos/android_kernel_oppo_msm8974
the local.config I used is an unaltered copy of the hammerhad example. The kernel config template I used is 69 - LineageOS Bacon.

build.sh - S - 4-1-1-5-6 - 1 (Made changes from documentation the best I could - many differences between 3.04 and 4.9) - 2 - 5 .

I believe those are the steps I took, but I am going from memory. Let me know if something doesn't make sense.

aaronouthier
2020-04-16, 23:34
Oddly enough, despite specifying only 32-bit tool-chains, the S option still wants to download 2 64-bit clang packages.

aaronouthier
2020-04-17, 00:17
Yeah, I went through everything again. So many of the things in the Docs don't really apply to kernel 3.04, including USB Gadget options, SDR, and some of the USB Ethernet & USB WiFi items.

How big of a headache would it be to try a newer kernel source?

aaronouthier
2020-04-17, 00:19
Forgot to mention: You help is greatly appreciated Re4son.

aaronouthier
2020-04-17, 03:55
@Re4son: Any Luck??

re4son
2020-04-17, 04:58
Yep, all good. The kernel doesn't play nice with the linaro toolchain. Another one is currently on its way into the official repo but I made it available to you on the build server.
Just hop into your "kali-nethunter-kernel" directory and do the following

git stash
git pull
cp local.config.examples/local.config.example.bacon local.config
# edit local.config and replace the "CROSS_COMPILE_ARM32_SRC=" link temporarily with "https://build.nethunter.com/contributors/re4son/toolchains/google_armhf-standalone-4.8.tar.xz"
./build.sh


And then run setup again. That should do the trick.
Before doing all this I'd fork the kernel source and create a nethunter branch in your github repository.

My standard workflow is:


- open "https://github.com/lineageos/android_kernel_oppo_msm8974" in web browser
- Click "Fork"
- Open terminal, cd to build directory, e.g. ~/android
- git clone <remote repo> (e.g. https://github.com/Re4son/android_kernel_oppo_msm8974)
- cd android_kernel_oppo_msm8974
- git checkout -b nethunter-9.0
- git clone https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-kernel
- cd kali-nethunter-kernel
- cp local.config.examples/local.config.example.bacon ./local.config
- vi local.config #If you'de like to customize paths
- ./build.sh
- "S"
- "1"
- Choose "69) lineageos_bacon_defconfig" as default config
- Edit kernel config - Only remove "local version", untick "... append version ...", & change hostname to kali
- "2"; build and rebuild with option #3 adding more and more nethunter config items.
- Add one patch after another, build every time with "3" and git commit after every successful build.
- If all configurations and patches applied successfully, do a clean via "0" and a full NetHunter build via "N"
- Git commit of the nethunter_config and kali-nethunter-kernel/local.config, & push everything to the remote repository


Before you commit your "local.config", better change the download link back to the permanent one.

yesimxev
2020-04-17, 12:19
D'oh, I just wiped my build environment to start over. Again...

Should be straightforward to build, however:
https://github.com/lineageos/android_kernel_oppo_msm8974
the local.config I used is an unaltered copy of the hammerhad example. The kernel config template I used is 69 - LineageOS Bacon.

build.sh - S - 4-1-1-5-6 - 1 (Made changes from documentation the best I could - many differences between 3.04 and 4.9) - 2 - 5 .

I believe those are the steps I took, but I am going from memory. Let me know if something doesn't make sense.


Hey there, LOS16 for OPO is actually done a while ago. Check the install steps https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-project/issues/1351#note_254273238

It might not mentioned but build kalifs with kernel using (after getting devices with bootstrap.py):

build.py -p -d oneplus1 -fs full

It will be also provided as an "Official latest" build effective in 2020.2 release

aaronouthier
2020-04-17, 18:05
Yes, I was aware that the current NetHunter build was available this way. I am using it now. I wasn't aware it was still being worked on. I am chomping at the bit to try the new USB arsenal feature, but figured it would only be available for the stock OS. Since it will be available with the 2020.2 release, I can wait until then. I don't want to wait, of course, but it'll probably happen sooner than if I try to do it myself. I'll perhaps have more hair that way also... :rolleyes:

Thanks fellas!!

yesimxev
2020-04-18, 23:49
USB Arsenal is only for 4.x kernels as it's running without kernel patches, it needs userspace config patches.
Backporting to 3.x kernels is possible but not necessary. The patches they already have for HID attacks and Drivedroid, are to do the same job that USB arsenal does.

We are also happy to accept any MR if you are interested in porting https://cateee.net/lkddb/web-lkddb/USB_CONFIGFS_F_HID.html