PDA

View Full Version : Help with hacking and compiling msm8994 kernel source for HTC himaWL (Verizon One M9)



Ronk
2022-04-13, 14:27
So I recently came into a Verizon HTC One M9 and seeing that it was on a list of phones which are supposed to work with Nethunter and a custom kernel, I decided to get Nethunter going on it. Thanks to Verizon, I ended up having to use the Sunshine app to get s-off on the **** thing since they disabled the OEM unlock. I RUU'd the phone to the latest official Verizon release, (Nouget) flashed TWRP, installed SuperSU and installed a .zip I found of the full Nethunter CHroot and a custom kernel for the HTC One M9 on Nouget that supposedly enabled HID and Wifi packet injection. The one I tried first was from Lavanoid (I believe he even posted links to it on these forums) and while the nethunter zip installed just fine, when it came time to flash the kernel it kept telling me that my device was not supported.
So I tried building the kernel, starting with the build.sh on Lavanoid's github which is supposed to build nethunter and a custom kernel. He said he was only able to get it to work on Arch linux and that's apparently where he stopped because his script's Debian build is SO broken.

This is where I dove in and proceeded to try and add support for a new device by following the instructions on the nethunter site. (Cue montage of me typing away on the computer and swearing a LOT for about 2 weeks). I am currently running Lineage 16.0 rooted with Majisk and with nethunter installed via the magisk nethunter store module. In the store I installed NH terminal and the NH app and then the full CHroot through the CHroot manager in the NH app.

That's great except no USB HID and no wifi packet injection or Monitor mode on WLAN0. No pre-built kernel I have found has worked (they all say device not supported and I THINK that's because no one bothered to include the Himawl codename in Anykernal config?)

I have heard that all these troubles sort-of go away if you happen to be using a kernel that's based on the Linux 4.X kernel. Sadly, that's not an option for me as HTC has not released (nor will they) the kernel source beyond 3.x. I realized that Lineage has it's own kernel and so I tried updating to Lineage 19 since I figured it would be based on 4.x but it's still based on 3.x because it still uses some HTC source code. Unsurprisingly, it was super-unstable and I went back to Lineage16.

I downloaded the latest kernel source from HTC+ and diff'd the USB HID and injection modifications from Lavanoid's source, applied them to the HTC source i DL'd but I cannot for the life of me get ANY kernel source to build properly. Not manually, not with nethunter kernel builder, not by following ANY supposed instructions... ONE TIME I got kernel builder to spit out a test anykernel.zip but when I tried to flash it, IT TOLD ME UNSUPPORTED DEVICE.

I can't even get the HTC source to compile FOLLOWING the directions that were in its readme. Which was, literally:


git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9

Build the kernel:
=================
set the following environment variables:


$ mkdir -p out
$ make ARCH=arm64 CROSS_COMPILE=<path-to-toolchain>/bin/aarch64-linux-android- O=out msm8994_defconfig
$ make ARCH=arm64 CROSS_COMPILE=<path-to-toolchain>/bin/aarch64-linux-android- O=out -j16

we'll start here, cause it's simple. To start with, cloning the toolchain's master doesn't do jack because it's depreciated and they removed it all. Is there a specific branch I SHOULD be using?
But, assuming the gcc toolchain is cloned properly, kernel source is in /home/kernel and toolchain is in /home/kernel/ltc
I did, after make clean and make mrproper:

make ARCH=arm64 CROSS_COMPILE=/home/kernel/ltc/bin/aarch64-linux-android- O=out msm8994_defconfig
(which seemed to work fine, then)
make ARCH=arm64 CROSS_COMPILE=/home/kernel/ltc/bin/aarch64-linux-android- O=out -j16

and here's what resulted. Any help would be appreciated.



/bin/env: ?python?: No such file or directory
HOSTCC scripts/basic/fixdep
GEN /home/kernel/out2/Makefile
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
arch/arm64/configs/msm8994_defconfig:283:warning: override: reassigning to symbol NETFILTER_XT_MATCH_ESP
arch/arm64/configs/msm8994_defconfig:746:warning: override: reassigning to symbol CRYPTO
arch/arm64/configs/msm8994_defconfig:809:warning: override: reassigning to symbol BLK_DEV_IO_TRACE
arch/arm64/configs/msm8994_defconfig:872:warning: override: reassigning to symbol PANIC_ON_RT_THROTTLING
arch/arm64/configs/msm8994_defconfig:887:warning: override: reassigning to symbol AUDIT
arch/arm64/configs/msm8994_defconfig:888:warning: override: reassigning to symbol SECURITY
arch/arm64/configs/msm8994_defconfig:889:warning: override: reassigning to symbol LSM_MMAP_MIN_ADDR
arch/arm64/configs/msm8994_defconfig:890:warning: override: reassigning to symbol SECURITY_NETWORK
arch/arm64/configs/msm8994_defconfig:891:warning: override: reassigning to symbol SECURITY_SELINUX
arch/arm64/configs/msm8994_defconfig:906:warning: override: reassigning to symbol PAGE_OWNER
arch/arm64/configs/msm8994_defconfig:913:warning: override: reassigning to symbol UID_CPUTIME
arch/arm64/configs/msm8994_defconfig:918:warning: override: reassigning to symbol MEDIA_DIGITAL_TV_SUPPORT
arch/arm64/configs/msm8994_defconfig:921:warning: override: reassigning to symbol TSPP
arch/arm64/configs/msm8994_defconfig:923:warning: override: reassigning to symbol DVB_MPQ
arch/arm64/configs/msm8994_defconfig:924:warning: override: reassigning to symbol DVB_MPQ_DEMUX
warning: (PCI_MSM && AMD_IOMMU) selects PCI_MSI which has unmet direct dependencies (PCI && ARCH_SUPPORTS_MSI)
warning: (ARCH_MSM) selects DEVFREQ_GOV_MSM_BW_HWMON which has unmet direct dependencies (PM_DEVFREQ && (ARCH_MSM_KRAIT || ARCH_MSM_BIMC_BWMON))
warning: (PCI_MSM && AMD_IOMMU) selects PCI_MSI which has unmet direct dependencies (PCI && ARCH_SUPPORTS_MSI)
warning: (ARCH_MSM) selects DEVFREQ_GOV_MSM_BW_HWMON which has unmet direct dependencies (PM_DEVFREQ && (ARCH_MSM_KRAIT || ARCH_MSM_BIMC_BWMON))
#
# configuration written to .config
#
root@DESKTOP-8G5R3E6:/home/kernel# make ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=/home/kernel/ltc/bin/aarch64-linux-android- O=out2 -j16
/usr/bin/env: ?python?: No such file or directory
/usr/bin/env: ?python?: No such file or directory
/usr/bin/env: ?python?: No such file or directory
GEN /home/kernel/out2/Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (PCI_MSM && AMD_IOMMU) selects PCI_MSI which has unmet direct dependencies (PCI && ARCH_SUPPORTS_MSI)
warning: (ARCH_MSM) selects DEVFREQ_GOV_MSM_BW_HWMON which has unmet direct dependencies (PM_DEVFREQ && (ARCH_MSM_KRAIT || ARCH_MSM_BIMC_BWMON))
warning: (PCI_MSM && AMD_IOMMU) selects PCI_MSI which has unmet direct dependencies (PCI && ARCH_SUPPORTS_MSI)
warning: (ARCH_MSM) selects DEVFREQ_GOV_MSM_BW_HWMON which has unmet direct dependencies (PM_DEVFREQ && (ARCH_MSM_KRAIT || ARCH_MSM_BIMC_BWMON))
/usr/bin/env: ?python?: No such file or directory
/home/kernel/Makefile:605: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
/usr/bin/env: ?python?: No such file or directory
GEN /home/kernel/out2/Makefile
WRAP arch/arm64/include/generated/asm/bugs.h
WRAP arch/arm64/include/generated/asm/checksum.h
WRAP arch/arm64/include/generated/asm/clkdev.h
WRAP arch/arm64/include/generated/asm/cputime.h
WRAP arch/arm64/include/generated/asm/current.h
WRAP arch/arm64/include/generated/asm/delay.h
WRAP arch/arm64/include/generated/asm/div64.h
WRAP arch/arm64/include/generated/asm/dma.h
WRAP arch/arm64/include/generated/asm/emergency-restart.h
WRAP arch/arm64/include/generated/asm/early_ioremap.h
WRAP arch/arm64/include/generated/asm/errno.h
WRAP arch/arm64/include/generated/asm/ftrace.h
CHK include/generated/uapi/linux/version.h
WRAP arch/arm64/include/generated/asm/ioctls.h
WRAP arch/arm64/include/generated/asm/hw_irq.h
WRAP arch/arm64/include/generated/asm/ipcbuf.h
UPD include/generated/uapi/linux/version.h
WRAP arch/arm64/include/generated/asm/ioctl.h
WRAP arch/arm64/include/generated/asm/irq_regs.h
WRAP arch/arm64/include/generated/asm/kdebug.h
WRAP arch/arm64/include/generated/asm/kmap_types.h
WRAP arch/arm64/include/generated/asm/kvm_para.h
WRAP arch/arm64/include/generated/asm/local.h
WRAP arch/arm64/include/generated/asm/local64.h
WRAP arch/arm64/include/generated/asm/mcs_spinlock.h
WRAP arch/arm64/include/generated/asm/mman.h
WRAP arch/arm64/include/generated/asm/msgbuf.h
WRAP arch/arm64/include/generated/asm/mutex.h
WRAP arch/arm64/include/generated/asm/pci.h
WRAP arch/arm64/include/generated/asm/poll.h
WRAP arch/arm64/include/generated/asm/resource.h
WRAP arch/arm64/include/generated/asm/rwsem.h
WRAP arch/arm64/include/generated/asm/scatterlist.h
WRAP arch/arm64/include/generated/asm/sections.h
WRAP arch/arm64/include/generated/asm/segment.h
WRAP arch/arm64/include/generated/asm/sembuf.h
WRAP arch/arm64/include/generated/asm/serial.h
WRAP arch/arm64/include/generated/asm/shmbuf.h
WRAP arch/arm64/include/generated/asm/simd.h
WRAP arch/arm64/include/generated/asm/sizes.h
WRAP arch/arm64/include/generated/asm/socket.h
CHK include/generated/utsrelease.h
WRAP arch/arm64/include/generated/asm/sockios.h
WRAP arch/arm64/include/generated/asm/swab.h
UPD include/generated/utsrelease.h
WRAP arch/arm64/include/generated/asm/switch_to.h
WRAP arch/arm64/include/generated/asm/termbits.h
WRAP arch/arm64/include/generated/asm/topology.h
WRAP arch/arm64/include/generated/asm/termios.h
WRAP arch/arm64/include/generated/asm/trace_clock.h
WRAP arch/arm64/include/generated/asm/types.h
WRAP arch/arm64/include/generated/asm/unaligned.h
WRAP arch/arm64/include/generated/asm/user.h
WRAP arch/arm64/include/generated/asm/vga.h
WRAP arch/arm64/include/generated/asm/xor.h
WRAP arch/arm64/include/generated/uapi/asm/kvm_para.h
HOSTCC scripts/basic/fixdep
Using /home/kernel as source for kernel
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/genksyms/genksyms.o
SHIPPED scripts/dtc/dtc-lexer.lex.c
CC scripts/mod/empty.o
SHIPPED scripts/dtc/dtc-parser.tab.h
/usr/bin/env: ?python?: No such file or directory
make[3]: *** [/home/kernel/scripts/Makefile.build:309: scripts/mod/empty.o] Error 127
SHIPPED scripts/dtc/dtc-parser.tab.c
make[2]: *** [/home/kernel/scripts/Makefile.build:455: scripts/mod] Error 2
make[2]: *** Waiting for unfinished jobs....
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
SHIPPED scripts/genksyms/lex.lex.c
HOSTCC scripts/dtc/fstree.o
SHIPPED scripts/genksyms/keywords.hash.c
SHIPPED scripts/genksyms/parse.tab.h
SHIPPED scripts/genksyms/parse.tab.c
HOSTCC scripts/genksyms/lex.lex.o
HOSTCC scripts/genksyms/parse.tab.o
HOSTCC scripts/selinux/genheaders/genheaders
HOSTCC scripts/selinux/mdp/mdp
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/srcpos.o
CC kernel/bounds.s
/usr/bin/env: ?python?: No such file or directory
make[2]: *** [/home/kernel/./Kbuild:36: kernel/bounds.s] Error 127
make[1]: *** [/home/kernel/Makefile:868: prepare0] Error 2
make[1]: *** Waiting for unfinished jobs....
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/util.o
HOSTCC scripts/dtc/dtc-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
/home/kernel/scripts/gcc-version.sh: /home/kernel/ltc/bin/aarch64-linux-android-gcc: /usr/bin/python: bad interpreter: No such file or directory
/home/kernel/scripts/gcc-version.sh: /home/kernel/ltc/bin/aarch64-linux-android-gcc: /usr/bin/python: bad interpreter: No such file or directory
/home/kernel/scripts/gcc-version.sh: /home/kernel/ltc/bin/aarch64-linux-android-gcc: /usr/bin/python: bad interpreter: No such file or directory
/home/kernel/scripts/gcc-version.sh: /home/kernel/ltc/bin/aarch64-linux-android-gcc: /usr/bin/python: bad interpreter: No such file or directory
HOSTLD scripts/genksyms/genksyms
HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x50): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [scripts/Makefile.host:127: scripts/dtc/dtc] Error 1
make[2]: *** [/home/kernel/scripts/Makefile.build:455: scripts/dtc] Error 2
make[1]: *** [/home/kernel/Makefile:524: scripts] Error 2
make: *** [Makefile:130: sub-make] Error 2

Fred Sheehan
2022-07-21, 13:53
/home/kernel/scripts/gcc-version.sh: /home/kernel/ltc/bin/aarch64-linux-android-gcc: /usr/bin/python: bad interpreter: No such file or directory

your assumption that everything you need is in /home/kernel/ltc is clearly wrong..

check your actual file paths.. not where you 'think' things are..