Error "function 'nop'" when building android kernel - android

I am making the android kernel for the first time and after few errors(which I have overcome) I am getting below error log:
casual#Casual-PC:/media/casual/USB/android_kernel_yotaphone2-DKernel$
make O=../out -j4
GEN /media/casual/USB/out/Makefile
CHK include/linux/version.h
Using /media/casual/USB/android_kernel_yotaphone2-DKernel as source for kernel
CHK include/generated/utsrelease.h
make[2]: «include/generated/mach-types.h» не требует обновления. (dont need update)
CC arch/arm/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL /media/casual/USB/android_kernel_yotaphone2- DKernel/scripts/checksyscalls.sh
CC arch/arm/common/vic.o
CC arch/arm/mm/dma-mapping.o
CC init/main.o
CC arch/arm/common/timer-sp.o
AS arch/arm/kernel/entry-armv.o
AS arch/arm/kernel/entry-common.o
LD arch/arm/common/built-in.o
CHK include/generated/compile.h
CC arch/arm/kernel/process.o
CC arch/arm/mm/init.o
LD arch/arm/net/built-in.o
CC arch/arm/kernel/ptrace.o
CC init/do_mounts.o
CC init/do_mounts_rd.o
/media/casual/USB/android_kernel_yotaphone2-DKernel/arch/arm/mm/init.c: In function 'mem_init':
/media/casual/USB/android_kernel_yotaphone2-DKernel/arch/arm/mm/init.c:921:6: warning: format '%d' expects argument of
type 'int', but argument 7 has type 'long int' [-Wformat]
error, forbidden warning: init.c:921
/media/casual/USB/android_kernel_yotaphone2-DKernel/scripts/Makefile.build:307: recipe for target 'arch/arm/mm/init.o' failed
make[2]: *** [arch/arm/mm/init.o] Error 1
/media/casual/USB/android_kernel_yotaphone2-DKernel/Makefile:957: recipe for target 'arch/arm/mm' failed
make[1]: *** [arch/arm/mm] Error 2
make[1]: *** Ожидание завершения заданий…
CC arch/arm/kernel/sched_clock.o
CC init/do_mounts_initrd.o
CC init/do_mounts_md.o
CC arch/arm/kernel/signal.o
CC arch/arm/kernel/armksyms.o
CC arch/arm/kernel/bios32.o
LD init/mounts.o
LD init/built-in.o
CC arch/arm/kernel/isa.o
AS arch/arm/kernel/sleep.o
CC arch/arm/kernel/machine_kexec.o
CC arch/arm/kernel/io.o
CC arch/arm/kernel/crash_dump.o
/media/casual/USB/android_kernel_yotaphone2-DKernel/arch/arm/kernel/io.c: In function '_memcpy_fromio':
/media/casual/USB/android_kernel_yotaphone2-DKernel/arch/arm/kernel/io.c:14:3: error: implicit declaration of function 'nop' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
/media/casual/USB/android_kernel_yotaphone2-DKernel/scripts/Makefile.build:307: recipe for target 'arch/arm/kernel/io.o' failed
make[2]: *** [arch/arm/kernel/io.o] Error 1
make[2]: *** Ожидание завершения заданий…
/media/casual/USB/android_kernel_yotaphone2-DKernel/Makefile:957: recipe for target 'arch/arm/kernel' failed
make[1]: *** [arch/arm/kernel] Error 2
Makefile:130: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
(sry for bad code blocks)
So, I have found similar questions, but I didn't understand the answer:
android kernel build (first time)
when i make it throw
`LC_ALL=C make O=../out`
it gives me(spoiler - LC_ALL=C don't work how i thought, so i translated it(as #) by myself):
casual#Casual-PC:/media/casual/USB/android_kernel_yotaphone2-DKernel$ LC_ALL=C make O=../out
Using /media/casual/USB/android_kernel_yotaphone2-DKernel as source for kernel
GEN /media/casual/USB/out/Makefile
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[2]: «include/generated/mach-types.h» не требует обновления. #dont need updates
CALL /media/casual/USB/android_kernel_yotaphone2-DKernel/scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm/kernel/io.o
/media/casual/USB/android_kernel_yotaphone2-DKernel/arch/arm/kernel/io.c: In function '_memcpy_fromio':
/media/casual/USB/android_kernel_yotaphone2-DKernel/arch/arm/kernel/io.c:14:3: error: implicit declaration of function 'nop' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
/media/casual/USB/android_kernel_yotaphone2-DKernel/scripts/Makefile.build:307: recipe for target 'arch/arm/kernel/io.o' failed
make[2]: *** [arch/arm/kernel/io.o] Error 1
/media/casual/USB/android_kernel_yotaphone2-DKernel/Makefile:957: recipe for target 'arch/arm/kernel' failed
make[1]: *** [arch/arm/kernel] Error 2
Makefile:130: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Related

Got errors while compiling Android kernel

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?
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....

Android 7.1.1 kernel compile errors (tool chain)

The build environment is ubuntu 16.04 with latest gcc 5.4.0 and GNU Make 3.82. My target is an am335x custom board which can run android 4.4. I am going to support it for android 7.1.1.
The project is fetched from google android manifest tag android-7.1.1_r46 and the kernel is from msm tag android-7.1.1_r0.63. The cross compiler I am using is from prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin.
That is the environment information. I haven't installed the NDK or SDK yet because I saw the api level for android 7.1.1 is 25 while the newest NDK only support up to 24, so I get a bit confused what to do.
If I run the command: m -j8 uboot linux
The uboot compiles fine, but there are a lot of errors when compiling the linux kernel.
/media/yangjiel/disk2/android/kernel/arch/arm/mach-omap2/prm_common.c: In function 'omap_prcm_register_chain_handler':
/media/yangjiel/disk2/android/kernel/arch/arm/mach-omap2/prm_common.c:293:2: warning: passing argument 2 of 'irq_set_chained_handler' from incompatible pointer type [enabled by default]
error, forbidden warning: prm_common.c:293
make[2]: *** [arch/arm/mach-omap2/prm_common.o] Error 1
make[1]: *** [arch/arm/mach-omap2] Error 2
make[1]: *** Waiting for unfinished jobs....
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:141:13: error: 'KERN_BOOT_REASON' undeclared here (not in a function)
{ CTL_INT, KERN_BOOT_REASON, "boot_reason" },
^
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:528:13: error: 'NET_IPV6_ACCEPT_RA_PREFIX_ROUTE' undeclared here (not in a function)
{ CTL_INT, NET_IPV6_ACCEPT_RA_PREFIX_ROUTE, "accept_ra_prefix_route" },
^
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:528:2: error: initializer element is not constant
{ CTL_INT, NET_IPV6_ACCEPT_RA_PREFIX_ROUTE, "accept_ra_prefix_route" },
^
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:528:2: error: (near initialization for 'bin_net_ipv6_conf_var_table[24].ctl_name')
make[2]: *** [kernel/sysctl_binary.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [kernel] Error 2
make: *** [sub-make] Error 2
make: Leaving directory `/media/yangjiel/disk2/android/kernel'
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/media/yangjiel/disk2/android'
If I drop the lines in that file which causing this error, the error above is resolved but I would get another
/media/yangjiel/disk2/android/kernel/kernel/cgroup.c: In function 'subsys_cgroup_allow_attach':
/media/yangjiel/disk2/android/kernel/kernel/cgroup.c:2138:37: error: invalid operands to binary != (have 'kuid_t' and 'kuid_t')
if (current != task && cred->euid != tcred->uid &&
^
/media/yangjiel/disk2/android/kernel/kernel/cgroup.c:2139:18: error: invalid operands to binary != (have 'kuid_t' and 'kuid_t')
cred->euid != tcred->suid)
^
make[2]: *** [kernel/cgroup.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC kernel/trace/power-traces.o
CC kernel/trace/rpm-traces.o
CC kernel/trace/trace_probe.o
LD kernel/trace/libftrace.o
LD kernel/trace/built-in.o
make[1]: *** [kernel] Error 2
make: *** [sub-make] Error 2
make: Leaving directory `/media/yangjiel/disk2/android/kernel'
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/media/yangjiel/disk2/android'
There are more errors behind.
I have googled around and most of the people say this is a tool chain problem. But I don't find a lot of instruction about how to install the tool chain properly especially for 7.1.1. There seems to be no tool chain needed for the android 4.4 kernel. I fetch the custom android 4.4 kernel and it compiles fine.
The problem above is because I downloaded a wrong version of Android kernel. What I downloaded is https://android.googlesource.com/kernel/msm/+/android-7.1.1_r0.63, and this is kernel v3.10.
Obviously this is not for Android 7.1.1 (which should be using kernel v4.4). So when I am trying to compile "old" kernel with the "new" cross compiler from the prebuilt, it generated whole bunch errors that the "old" compiler won't. I end up using the kernel from https://android.googlesource.com/kernel/common/+/upstream-linux-4.4.y upstream-linux-4.4.y branch, it is compatible with Android 7.0 to 7.1.2.
I have no idea why google name it as android-7.1.1_r0.63, but that definitely not for Android 7.1.1 to use. Hope nobody has the same problem as I did.

android kernel error: 'struct dentry' has no member named 'd_alias'

So I have cloned the android kernel source for my motorola mobile, and was in the process of building it.
Android Kernel Info:
Name: Android Kernel Motorola MSM8610
Device(Intended): Moto E
Hardware: MSM8610
Github: Kernel Source Link
Procedure:
First, I made the .config file using
make ARCH=arm msm8610_defconfig
then I tried to build the kernel image by creating a file name startBuild
startBuild:
make ARCH=arm SUBARCH=arm CROSS_COMPILE=/media/mohit/776b997b-f9a1-46c2-92a0-7f438c7b78e3/code/toolchain/arm-eabi-4.6/bin/arm-eabi- -j4
giving it required permissions
chmod +x startBuild
and executing it
./startBuild
But I am getting the following error message:
CHK include/linux/version.h
make[1]: Nothing to be done for 'arch/arm/boot/dtbs'.
CHK include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC fs/overlayfs/inode.o
fs/overlayfs/inode.c: In function 'ovl_permission':
fs/overlayfs/inode.c:71:11: error: 'struct dentry' has no member named 'd_alias'
fs/overlayfs/inode.c:71:11: warning: initialization from incompatible pointer type [enabled by default]
error, forbidden warning: inode.c:71
scripts/Makefile.build:307: recipe for target 'fs/overlayfs/inode.o' failed
make[2]: *** [fs/overlayfs/inode.o] Error 1
scripts/Makefile.build:443: recipe for target 'fs/overlayfs' failed
make[1]: *** [fs/overlayfs] Error 2
Makefile:957: recipe for target 'fs' failed
make: *** [fs] Error 2
make: *** Waiting for unfinished jobs..
So how to fix this error?
Thank you.
Since version 3.19 of Linux kernel d_alias member of struct dentry has been moved to the member's union d_u, see definition of struct dentry in include/linux/dcache.h.
So, replacing reference to d_alias member to d_u.d_alias should help with that compatibility problem.
That replasing may also be performed globally in all files, see e.g. this post about fixing given error in vmware-tools.

Error compiling kernel Galaxy Note3

I'm getting the following error when trying to compile the kernel of Note3.
This is a kernel from Samsung.
Does someone has any suggestion how to fix it?
make[1]: Leaving directory `/home/ran/android/system/kernel/samsung/ha3g'
make -C kernel/samsung/ha3g O=/home/ran/android/system/out/target/product/ha3g/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE=" /home/ran/android/system/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-" headers_install
make[1]: Entering directory `/home/ran/android/system/kernel/samsung/ha3g'
CHK include/linux/version.h
make[1]: Leaving directory `/home/ran/android/system/kernel/samsung/ha3g'
make -C kernel/samsung/ha3g O=/home/ran/android/system/out/target/product/ha3g/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE=" /home/ran/android/system/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-" zImage
make[1]: Entering directory `/home/ran/android/system/kernel/samsung/ha3g'
GEN /home/ran/android/system/out/target/product/ha3g/obj/KERNEL_OBJ/Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
Using /home/ran/android/system/kernel/samsung/ha3g as source for kernel
GEN /home/ran/android/system/out/target/product/ha3g/obj/KERNEL_OBJ/Makefile
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[3]: `include/generated/mach-types.h' is up to date.
CALL /home/ran/android/system/kernel/samsung/ha3g/scripts/checksyscalls.sh
CHK include/generated/compile.h
CC drivers/sensorhub/stm/factory/light_max88921.o
/home/ran/android/system/kernel/samsung/ha3g/drivers/sensorhub/stm/factory/light_max88921.c:78:1: fatal error: opening dependency file drivers/sensorhub/stm/factory/.light_max88921.o.d: No such file or directory
compilation terminated.
make[5]: *** [drivers/sensorhub/stm/factory/light_max88921.o] Error 1
make[4]: *** [drivers/sensorhub/stm] Error 2
make[3]: *** [drivers/sensorhub] Error 2
make[2]: *** [drivers] Error 2
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/ran/android/system/kernel/samsung/ha3g'
make: *** [TARGET_KERNEL_BINARIES] Error 2
Somehow the folder factory was missing under out/target/product/ha3g/obj/KERNEL_OBJ/drivers/sensorhub/stm
When I added this folder (with mkdir) it worked.

Syntax error: Unterminated quoted string [Makefile]

Not able to find the problem:
make PLATFORM=android
make[2]: Entering directory `/home/debian/Downloads/nonemaioq3'
CC code/client/cl_cgame.c
/prog/toolchain/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: 4: /prog/toolchain/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: Syntax error: Unterminated quoted string
make[2]: *** [build/release-android-arm/client/cl_cgame.o] Error 2
make[2]: Leaving directory `/home/debian/Downloads/nonemaioq3'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/home/debian/Downloads/nonemaioq3'
make: *** [release] Error 2
and this is the Makefile I got:
http://pastebin.com/QYZYVvTn
I don't find any problem there :S Help please.
The line
CC code/client/cl_cgame.c
starts the compiler (C Compiler or CC). The error message is after the CC and doesn't start with make, so it relates to the compiler, not the Makefile.
/prog/toolchain/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: 4: /prog/toolchain/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: Syntax error: Unterminated quoted string
gcc is the GNU C compiler. The error is in the file /prog/toolchain/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc, on line 4.
In view of your comment, "arm-linux" means that version of GCC is meant to run on ARM processors. If you are running this on a PC, you want a gcc with "x86" or "x64" in place of "arm." That would be a cross-compiling situation; see here for links on how to set that up.

Categories

Resources