[HELP] Errors while compiling Android kernel - Android Q&A, Help & Troubleshooting

Hey guys,
I wanted to enable KVM on the kernel I use, reached to the kernel source and enabled KVM by adding some lines to defconfig file. But whenever I want to compile, I got these error messages. I could not fix that. Could someone help me please?
Code:
C arch/arm64/kvm/../../../virt/kvm/vfio.o
CC arch/arm64/kvm/../../../arch/arm/kvm/arm.o
CC arch/arm64/kvm/../../../arch/arm/kvm/mmu.o
AS arch/arm64/crypto/poly-hash-ce-core.o
CC arch/arm64/crypto/aes-ce-cipher.o
CC arch/arm64/mm/flush.o
In file included from ../arch/arm64/kvm/../../../arch/arm/kvm/arm.c:42:
../arch/arm64/include/asm/kvm_mmu.h:309:70: error: too few arguments to function call, expected 3, have 2
return (cpuid_feature_extract_field(reg, ID_AA64MMFR1_VMIDBITS_SHIFT) == 2) ? 16 : 8;
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
make[2]: *** [../scripts/Makefile.build:285: arch/arm64/kvm/../../../arch/arm/kvm/arm.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC arch/arm64/crypto/aes-ce-ccm-glue.o
In file included from ../arch/arm64/kvm/../../../arch/arm/kvm/mmu.c:27:
../arch/arm64/include/asm/kvm_mmu.h:309:70: error: too few arguments to function call, expected 3, have 2
return (cpuid_feature_extract_field(reg, ID_AA64MMFR1_VMIDBITS_SHIFT) == 2) ? 16 : 8;
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
make[2]: *** [../scripts/Makefile.build:285: arch/arm64/kvm/../../../arch/arm/kvm/mmu.o] Error 1
AS arch/arm64/crypto/aes-ce-ccm-core.o
CC arch/arm64/crypto/aes-glue-ce.o
make[1]: *** [/home/gorkemoji/android/kernel/Makefile:1034: arch/arm64/kvm] Error 2
make[1]: *** Waiting for unfinished jobs....
Thanks!
Best regards
Device: Redmi Note 7
Kernel source: https://github.com/LineageOS/android_kernel_xiaomi_sdm660

Up.

Anyone?

Related

[Q] CM 10.1 Kernel Compiling - mmu.c does not compile

Hey guys, I am trying to port Ubuntu Touch for my i9100G. All was going well but this error occurred when compiling. It seems there's a problem about mmu.c. I ve searched about it but no luck. Need your help!
Note: I opened the thread here and not Ubuntu Touch section because I think the problem is about compiling CM 10.1 kernel, not about porting Ubuntu.
HTML:
CC [M] /media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild/services4/srvkm/devices/sgx/sgxtransfer.o
CC [M] /media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild/services4/srvkm/devices/sgx/mmu.o
/media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild/services4/srvkm/devices/sgx/mmu.c: In function 'MMU_Alloc':
/media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild/services4/srvkm/devices/sgx/mmu.c:1487:11: error: 'sDevPAddr.uiAddr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild/services4/srvkm/devices/sgx/mmu.c:1427:20: note: 'sDevPAddr.uiAddr' was declared here
cc1: all warnings being treated as errors
make[6]: *** [/media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild/services4/srvkm/devices/sgx/mmu.o] Error 1
make[5]: *** [_module_/media/Yeni_Birim/ubuntu-i9100g/out/target/product/i9100g/target/kbuild] Error 2
make[4]: *** [sub-make] Error 2
make[3]: *** [all] Error 2
make[2]: *** [kbuild] Error 2
make[1]: *** [build] Error 2
make[1]: INTERNAL: Exiting with 9 jobserver tokens available; should be 8!
make[1]: `/media/Yeni_Birim/ubuntu-i9100g/device/samsung/omap4-common/pvr-source/eurasiacon/build/linux2/omap4430_android' dizininden çıkılıyor (that means leaving that directory)
make: *** [SGX_MODULES] Error 2

Kernel Compiling Error

Code:
CC net/netfilter/xt_qtaguid.o
CC net/netfilter/xt_quota.o
CC net/netfilter/xt_quota2.o
CC net/netfilter/xt_socket.o
In file included from include/linux/kernel.h:23:0,
from include/linux/cache.h:4,
from include/linux/time.h:7,
from include/linux/stat.h:60,
from include/linux/module.h:10,
from net/netfilter/xt_socket.c:13:
net/netfilter/xt_socket.c: In function 'xt_socket_get4_sk':
include/linux/dynamic_debug.h:75:21: warning: 'protocol' may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: dynamic_debug.h:75
make[2]: *** [net/netfilter/xt_socket.o] Error 1
make[1]: *** [net/netfilter] Error 2
make: *** [net] Error 2
[email protected]:~/kernel$
Original file here.
I'm using ndk gcc 4.8. This error is present also on gcc 4.7. The only way to get rid of this error is to use toolchain 4.6. I need to compile it using a newer toolchain, that's why I request your help.
Any ideas?
Kernel Compilation
srsdani said:
Code:
CC net/netfilter/xt_qtaguid.o
CC net/netfilter/xt_quota.o
CC net/netfilter/xt_quota2.o
CC net/netfilter/xt_socket.o
In file included from include/linux/kernel.h:23:0,
from include/linux/cache.h:4,
from include/linux/time.h:7,
from include/linux/stat.h:60,
from include/linux/module.h:10,
from net/netfilter/xt_socket.c:13:
net/netfilter/xt_socket.c: In function 'xt_socket_get4_sk':
include/linux/dynamic_debug.h:75:21: warning: 'protocol' may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: dynamic_debug.h:75
make[2]: *** [net/netfilter/xt_socket.o] Error 1
make[1]: *** [net/netfilter] Error 2
make: *** [net] Error 2
[email protected]:~/kernel$
Original file here.
I'm using ndk gcc 4.8. This error is present also on gcc 4.7. The only way to get rid of this error is to use toolchain 4.6. I need to compile it using a newer toolchain, that's why I request your help.
Click to expand...
Click to collapse
I guess you are looking on another file.
Code:
error, forbidden warning: dynamic_debug.h:75
I guess there is a problem in dynamic_debug.h in line 75. I guess you need to initialise something.
Here is dynamic_debug.h but I can't find the problem.
I will appreciate any opinion.
Try this method!
srsdani said:
Here is dynamic_debug.h but I can't find the problem.
Click to expand...
Click to collapse
I am not much used to kernel related development but I analysed your dynamic_debug.h and found the problem (maybe a problem):
Normally, a do-while loop syntax is this:
Code:
do
{
Statement1;
Statement2;
...
}while(condition);
But I don't see a semicolon in the end of those loops in your code. This maybe a syntax error.
Also analyse these codes:
Code:
#if defined(CONFIG_DYNAMIC_DEBUG)
extern int ddebug_remove_module(const char *mod_name);
extern __printf(2, 3)
int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
struct device;
extern __printf(3, 4)
int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
const char *fmt, ...);
struct net_device;
extern __printf(3, 4)
int __dynamic_netdev_dbg(struct _ddebug *descriptor,
const struct net_device *dev,
const char *fmt, ...);
Every intialisation has 4 protocols but the first initialisation contain only 3.
Try the above things and tell me back if it works or not.
So, the problem was in Makefile and .config. I compared and added some flags from Mako (from franco) and it worked. I still have some warning/s, some breakpoints but at least now it's working. Anyway, this thread may be useful for all of us. Thanks a lot for help.
Now, another problem.
Code:
CC fs/proc/loadavg.o
CC fs/proc/meminfo.o
fs/proc/meminfo.c: In function ‘meminfo_proc_show’:
fs/proc/meminfo.c:175:1: internal compiler error: in optimize_sc, at modulo-sched.c:1069
}
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.launchpad.net/gcc-linaro> for instructions.
make[2]: *** [fs/proc/meminfo.o] Error 1
make[1]: *** [fs/proc] Error 2
make: *** [fs] Error 2
[email protected]:~/kernel2$
With linaro 4.8.3 => OK;
linaro 4.8.3 + A15 optimize=> fail, error above. meminfo.c it's exactly like the one from nexus 4.
FIX: compiler bug;
srsdani said:
Code:
CC net/netfilter/xt_qtaguid.o
CC net/netfilter/xt_quota.o
CC net/netfilter/xt_quota2.o
CC net/netfilter/xt_socket.o
In file included from include/linux/kernel.h:23:0,
from include/linux/cache.h:4,
from include/linux/time.h:7,
from include/linux/stat.h:60,
from include/linux/module.h:10,
from net/netfilter/xt_socket.c:13:
net/netfilter/xt_socket.c: In function 'xt_socket_get4_sk':
include/linux/dynamic_debug.h:75:21: warning: 'protocol' may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: dynamic_debug.h:75
make[2]: *** [net/netfilter/xt_socket.o] Error 1
make[1]: *** [net/netfilter] Error 2
make: *** [net] Error 2
[email protected]:~/kernel$
Original file here.
I'm using ndk gcc 4.8. This error is present also on gcc 4.7. The only way to get rid of this error is to use toolchain 4.6. I need to compile it using a newer toolchain, that's why I request your help.
Click to expand...
Click to collapse
Hey sarsdani Apologies that I'm quoting you 12 month later. I am getting an identical error in the same file/address as you had when you posted this question. Im compiling stock HTC m7 Android L kernel with Google tool chain 4.8 - android 5.1 r1
You mentioned later on that you changed the Makefile and .config to fix the [-Wmaybe-uninitialized] error. Can you please detail what those changes were or point me to an example ( if you can remember ) I could just change Wmaybe in Makefile to Wno but turning the flag off altogether seems dangerous.
@Joeisgood99 there are two ways to solve this.
1. using a "hack". So, you need to add in makefile (in root folder from kernel source) at KBUILD_CFLAGS: -Wno-maybe-uninitialized \
2. Open that file with the error and asign a value to protocol.
The first option is not dangerous. Why? Because only the toolchain say this. In gcc 4.6, the reason why you don't get this error is because it assign a value automatically to that "protocol", usualy random value but not always. In gcc 4.7/4.8/4.9(or 4.10) this is threated as warning/error.
/home/austin/cm11/kernel/lge/w3c/net/ipv4/ipconfig.c:264: undefined reference to `msecs_to_jiffies'
/home/austin/cm11/kernel/lge/w3c/Makefile:877: recipe for target '.tmp_vmlinux1' failed
make[2]: *** [.tmp_vmlinux1] Error 1
Makefile:130: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/austin/cm11/kernel/lge/w3c'
build/core/tasks/kernel.mk:188: recipe for target 'TARGET_KERNEL_BINARIES' failed
make: *** [TARGET_KERNEL_BINARIES] Error 2
Any ideas what this could be? I'm a bit stumped i've never seen an error like this before
It's okay i retired the project as of now since trying to modify the kernel source code isn't do anything but causing more errors. I do appreciate any help when everyone has a chance

[Q] Developers: Trouble Compiling CM11 Kernel

So I've done some work on boot images before, but not much, and I wanted to try building a kernel for AOSP KitKat on the EVO 4G LTE. (Why not Lollipop? Data and roaming issues.) But I'm hitting camera-related errors when I try to compile it. Here's the relevant output in the make process:
Code:
CC arch/arm/mach-msm/board-8064-gpiomux.o
CC arch/arm/mach-msm/board-8064-camera.o
In file included from arch/arm/mach-msm/include/mach/camera.h:26:0,
from arch/arm/mach-msm/board-8064-camera.c:19:
include/media/msm_camera.h:1543:6: warning: "CONFIG_HTC_CAMERA_HAL_VERSION" is not defined [-Wundef]
error, forbidden warning: msm_camera.h:1543
make[1]: *** [arch/arm/mach-msm/board-8064-camera.o] Error 1
make: *** [arch/arm/mach-msm] Error 2
I tried to fix it by adding the HTC_CAMERA_HAL_VERSION config to Kconfig, but then I get this error instead:
Code:
CC arch/arm/mach-msm/board-8064-gpiomux.o
CC arch/arm/mach-msm/board-8064-camera.o
In file included from arch/arm/mach-msm/board-8064-camera.c:19:0:
arch/arm/mach-msm/include/mach/camera.h:682:33: warning: 'struct msm_camera_csi_params' declared inside parameter list
error, forbidden warning: camera.h:682
make[1]: *** [arch/arm/mach-msm/board-8064-camera.o] Error 1
make: *** [arch/arm/mach-msm] Error 2
Any ideas?

[HELP] Compiling Kernel : Makefile errors

Hi,
I'm trying to compile the kernel source from @flar2
I didn't find a specific build instructions so followed the usual method
After pointing to toolchain folder
Kernel source: https://github.com/korom42/ocean
My working setup:
Information about my OS:
Virtualization: oracle
OS: Ubuntu 16.04 Fedora 28 (Workstation Edition)
Kernel: Linux 4.17.17-200.fc28.x86_64
CPU: Intel Core i5-7200u @ 2x 2.7GHz [50.0°C]
GPU: intel
RAM: 2048MiB
Prepare :
Code:
export CROSS_COMPILE=/home/korom42/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export ARCH=arm64
export SUBARCH=arm64
export USE_CCACHE=1
make elementalx_defconfig
make /or make O=out
Compile issue:
http://prntscr.com/kl1gyi
lib/Makefile:17: *** recipe commences before first target. Stop.
Makefile:1213: recipe for target '_clean_lib' failed
make: *** [_clean_lib] Error 2
Update: I changed my building environment to Fedora 28 and that problem is fixed now. But, I am getting another error I guess it is related to the source code , I found a similar issue here
Code:
[...]
CC drivers/base/module.o
CC drivers/base/soc.o
CC drivers/base/pinctrl.o
CC drivers/base/platform-msi.o
LD drivers/base/built-in.o
CC drivers/block/brd.o
CC drivers/block/loop.o
CC drivers/block/zram/zcomp_lzo.o
CC drivers/block/zram/zcomp.o
CC drivers/block/zram/zram_drv.o
CC drivers/block/zram/zcomp_lz4.o
LD drivers/block/zram/zram.o
LD drivers/block/zram/built-in.o
LD drivers/block/built-in.o
CC drivers/bluetooth/bluetooth-power.o
CC drivers/bluetooth/btfm_slim.o
drivers/bluetooth/btfm_slim.c:26:23: fatal error: btfm_slim.h: No such file or directory
#include <btfm_slim.h>
^
compilation terminated.
make[2]: *** [scripts/Makefile.build:264: drivers/bluetooth/btfm_slim.o] Error 1
make[1]: *** [scripts/Makefile.build:408: drivers/bluetooth] Error 2
make: *** [Makefile:966: drivers] Error 2
I also tried
Code:
make O=out clean
And got the same error
Update:
Possibly similar issue here
I guess it is source code related ? Any ideas how to fix that

Errors trying to compile a kernel

Hello guys.
I have Galaxy s8 G950F Orero. I'm trying to compile a kernel to support monitoring mode and packet injection on external wifi adapter. I got a few errors when the build started.
I'm using Ubuntu 18.04 and aarch64/aarch64-linux-android-4.9 -b pie-release toolchain64
The error is:
/home/zerocount/kernel/kernel/Makefile:614: recipe for target 'scripts' failed
make[1]: *** [scripts] Error 2
make[1]: *** Waiting for unfinished jobs....
CHK include/generated/timeconst.h
CC kernel/bounds.s
UPD include/generated/timeconst.h
/home/zerocount/kernel/kernel/kernel/bounds.c:1:0: error: unknown value 'exynos-m1+crc+nofp' for -mcpu
/*
^
/home/zerocount/kernel/kernel/kernel/bounds.c:1:0: error: unknown value 'exynos-m1' for -mtune
/home/zerocount/kernel/kernel/./Kbuild:19: recipe for target 'kernel/bounds.s' failed
make[2]: *** [kernel/bounds.s] Error 1
/home/zerocount/kernel/kernel/Makefile:1117: recipe for target 'prepare0' failed
make[1]: *** [prepare0] Error 2
/home/zerocount/kernel/kernel/drivers/sensorhub/brcm/Makefile:57: ANDROID_MAJOR_VERSION : p
/home/zerocount/kernel/kernel/drivers/sensorhub/brcm/Makefile:58: ANDROID_PLATFORM_VERSION : 990000
make[1]: Leaving directory '/home/zerocount/kernel/out'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
I don't get it why it has to be so hard to build a kernel... I got errors and nothing more. Everytime i type make O=../out -j5 i got different errors.

Categories

Resources