Raw log:
--------------
Prepare build environment (Kali VM):
--------------------------------------------------
- Install Virtualbox
- Download Kali VM from https://www.offensive-security.com/k...mage-download/
- Import Kali VM into VirtualBox
- Start VBox, log on as root/toor, change password and prep OS:
Code:
apt update && apt full-upgrade
adduser nethunter
usermod -a -G sudo nethunter
- reboot & login as nethunter
Next:
- Install (google) toolchains and dependencies:
Code:
cd ~
mkdir toolchain toolchain64
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b pie-release toolchain64
export ARCH=arm64
export SUBARCH=arm64
export CROSS_COMPILE=`pwd`/toolchain64/bin/aarch64-linux-android-
Prepare kernel:
------------------
- Clone kernel source:
Code:
git clone https://github.com/arter97/android_kernel_razer_sdm845
- install bc
- Build test kernel without any mods:
Code:
cd android_kernel_razer_sdm845
cp defconfig .config ## This seems to be the original authors config
make menuconfig
cp .config arch/arm64/configs/nethunter_defconfig
make
Results in this error
Code:
arch/arm64/Makefile:74: *** /home/arter97/arm32-gcc/bin/arm-eabi-gcc not found, check CROSS_COMPILE_ARM32. Stop.
There seem to be some paths hardcoded somewhere. Probably in the Makefile but let's do a search:
Code:
grep -r "arter97" *
And there it is:
Code:
<snip>
Makefile:override CROSS_COMPILE := /home/arter97/arm64-gcc/bin/aarch64-elf-
Makefile:override CROSS_COMPILE_ARM32 := /home/arter97/arm32-gcc/bin/arm-eabi-
<snip>
Let's edit the Makefile and remove the offending lines:
Code:
vi Makefile
# searching for "override" takes us to the following three lines, let's comment them out like this:
override ARCH := arm64
override CROSS_COMPILE := /home/arter97/arm64-gcc/bin/aarch64-elf-
override CROSS_COMPILE_ARM32 := /home/arter97/arm32-gcc/bin/arm-eabi-
Running make again causes this error:
Code:
arch/arm64/Makefile:74: *** /home/nethunter/toolchain/bin/arm-eabi-gcc not found, check CROSS_COMPILE_ARM32. Stop.
Let's get a 32bit toolchain too then:
Code:
cd ~
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7 toolchain
export CROSS_COMPILE_ARM32=~/toolchain/bin/arm-eabi-
Let's compile again:
Code:
cd ~/android_kernel_razer_sdm845
make
Results in another error:
Code:
make: *** [Makefile:1189: prepare-compiler-check] Error 1
Looks like we need other toolchains. Let's try linaro:
Code:
cd ~
rm -rf toolchain toolchain64
mkdir toolchain toolchain64
wget https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/arm-eabi/gcc-linaro-7.4.1-2019.02-x86_64_arm-eabi.tar.xz
wget https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-elf/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-elf.tar.xz
tar xJf gcc-linaro-7.4.1-2019.02-x86_64_arm-eabi.tar.xz -C toolchain --strip-components=1
tar xJf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-elf.tar.xz -C toolchain64 --strip-components=1
Same error. Looking around I found pre-compiled toolchains in the github account of the original author of this kernel. Let's use these:
Code:
cd ~
rm -rf toolchain toolchain64
mkdir toolchain toolchain64
git clone https://github.com/arter97/arm32-gcc toolchain
git clone https://github.com/arter97/arm64-gcc toolchain64
export ARCH=arm64
export SUBARCH=arm64
export CROSS_COMPILE=~/toolchain64/bin/aarch64-elf-
export CROSS_COMPILE_ARM32=~/toolchain/bin/arm-eabi-
And let's try again:
Code:
cd ~/android_kernel_razer_sdm845
make
Bingo. We have a kernel.
Let's wait for everyone to catch up and aim for step two: packaging up and installing the test kernel tomorrow, ok?