I do get different issues trying to compile it.This problem is fixed, it was the GCC wrapper, the build progresses for a bit, but a new, unrelated problem crops up.
Code:/bin/sh: line 1: -Wp,-MD,arch/arm64/kernel/vdso/.vdso.lds.d: No such file or directory VDSOA arch/arm64/kernel/vdso/note.o make[2]: *** [/home/smee/Downloads/twrp/kernel/motorola/cebu/scripts/Makefile.build:450: arch/arm64/kernel/vdso/vdso.lds] Error 127 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [arch/arm64/Makefile:188: vdso_prepare] Error 2
Once again, Google-fu fails me. I don't quite know what to do here. Any help appreciated.
Is this the official way how Motorola is publishing kernel sources?
Could you please provide a config file from your phone?
adb pull /proc/config.gz
What defconfig do you use?
Could you also please provide your stock kernel file?
Or a link where to download the firmware image.
What are your exact kernel download/clone/config/export steps?
I tried the following with the build.config.gki.aarch64 as config base:
Code:
### Download Sources, Toolchain, Buildtools etc. ###
mkdir mistersmee && cd mistersmee
git clone -b MMI-QZC30.Q4-22-57 --single-branch https://github.com/MotorolaMobilityLLC/kernel-msm.git
VER=r353983c
mkdir clang-$VER && cd clang-$VER
BRANCH=android10-release
wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/$BRANCH/clang-$VER.tar.gz
tar -xzf clang-$VER.tar.gz && cd ..
git clone https://android.googlesource.com/kernel/prebuilts/build-tools
git clone \
-b $BRANCH \
--single-branch https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
### Exports: (must be done in kernel-source directory)
VER=r353983c
cd kernel-msm
export ARCH=arm64
export CLANG_TRIPLE=aarch64-linux-gnu-
export CROSS_COMPILE=aarch64-linux-androidkernel-
export LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=$(pwd)/../aarch64-linux-android-4.9/bin
export CLANG_PREBUILT_BIN=$(pwd)/../clang-$VER/bin
export BUILDTOOLS_PREBUILT_BIN=$(pwd)/../build-tools/linux-x86/bin
DEVEXPS="CC=clang EXTRA_CMDS='' STOP_SHIP_TRACEPRINTK=1 ABI_DEFINITION=abi_gki_aarch64.xml"
export KBUILD_BUILD_USER=build-user
export KBUILD_BUILD_HOST=build-host
export PATH=$LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN:$CLANG_PREBUILT_BIN:$BUILDTOOLS_PREBUILT_BIN:$PATH
./scripts/kconfig/merge_config.sh -m -r \
./arch/arm64/configs/gki_defconfig \
./arch/arm64/configs/vendor/ext_config/cebu-default.config
make $DEVEXPS savedefconfig
mv defconfig arch/arm64/configs/cebu_gki_defconfig && rm .config
make $DEVEXPS mrproper
make $DEVEXPS distclean
make $DEVEXPS cebu_gki_defconfig
make $DEVEXPS xconfig
time make $DEVEXPS -j$(nproc)
And the build error:
Code:
CC fs/notify/fsnotify.o
mm/huge_memory.c:2389:46: error: too few arguments to function call, expected 3, have 2
unmap_success = try_to_unmap(page, ttu_flags);
~~~~~~~~~~~~ ^
./include/linux/rmap.h:211:1: note: 'try_to_unmap' declared here
bool try_to_unmap(struct page *page, enum ttu_flags flags,
^
1 error generated.
scripts/Makefile.build:338: recipe for target 'mm/huge_memory.o' failed
make[1]: *** [mm/huge_memory.o] Error 1
Makefile:1143: recipe for target 'mm' failed
make: *** [mm] Error 2
CC fs/overlayfs/namei.o
[Update 17.04.2021]
I've managed to get the kernel build within the AOSP Build Env. It might be bit much (ap. 28GB), but it did the trick.
Code:
### Download Sources, Toolchain, Buildtools etc. ###
mkdir misterAOSP && cd misterAOSP
repo init --depth=1 -u https://android.googlesource.com/kernel/manifest -b common-android-4.19-stable
repo sync -f --force-sync --no-clone-bundle --no-tags -j$(nproc)
### replace common Kernel Dir with MMI-QZC30.Q4-22-57 aka android-10-release-qzc
mv common common_ori
git clone -b android-10-release-qzc --single-branch https://github.com/MotorolaMobilityLLC/kernel-msm.git common
### Downloaded the Stock Firmware and extracted the defconfig from the boot.img with (Android Image Kitchen from @osm0sis), AIK-linux -> boot.img-zImage
Motorola_Moto_G9_Power_XT2091-3_RETUK_CEBU_RETAIL_QZC30.Q4-22-57_10_by_(motostockrom.com).zip
./common/scripts/extract-ikconfig boot.img-zImage > common/arch/arm64/configs/motog9Pwr_defconfig
Code:
### add CLang Version r353983c to prebuilts-master
VER=r353983c
clangDIR=prebuilts-master/clang/host/linux-x86/clang-$VER
mkdir -p $clangDIR && cd $clangDIR
BRANCH=android10-release
wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/$BRANCH/clang-$VER.tar.gz
tar -xzf clang-$VER.tar.gz && cd -
### add GCC to prebuilts
GCCDIR=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
mkdir -p $GCCDIR
git clone \
-b $BRANCH \
--single-branch https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 $GCCDIR
### create build.config.motog9Pwr in common
Code:
ARCH=arm64
BRANCH=android-4.19
KERNEL_DIR=common
DEFCONFIG=motog9Pwr_defconfig
CC=clang
EXTRA_CMDS=''
STOP_SHIP_TRACEPRINTK=1
ABI_DEFINITION=abi_gki_aarch64.xml
CLANG_TRIPLE=aarch64-linux-gnu-
CROSS_COMPILE=aarch64-linux-androidkernel-
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r353983c/bin
FILES="
arch/arm64/boot/Image.gz
vmlinux
System.map
"
Code:
### build the kernel
BUILD_CONFIG=common/build.config.motog9Pwr build/build.sh -j$(nproc)
The Kernel file gets placed into
out/android-4.19/dist
The new kernel size compared to the stock kernel differ quiet much. There is perhaps
something more needed to get the kernel booting.
Code:
31508992 Apr 17 17:06 boot.img-zImage
11487928 Apr 17 15:35 boot.img-zImage.gz
25762304 Apr 17 17:06 Image
9993603 Apr 17 16:38 Image.gz
I also noticed, that inside the defconfig from the firmware, it says:
# Linux/arm64 4.19.95 Kernel Configuration
# Compiler: clang version 8.0.16 for Android NDK
But inside your kernel source from github, it refers to clang-r353983c, which is clang version 9.0.3.
The Kernel Version 4.19.95 is identical.
Cheers NewBit
Attachments
Last edited: