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.
Related
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.
For cross compiling MPICH2 for Android.
I found the reference here
http://hex.ro/wp/projects/personal-cloud-computing/compiling-mpich2-for-android-and-running-on-two-phones/
and here
www.scientificbulletin.upb.ro/rev_docs_arhiva/fullffc_583765.
I did following
BuildRoot
Used Build Root (buildroot-2016.02) for cross compiling ARM toolchain
Target options :
Target Architecture as ARM little endian
Target binary format as ELF
Selected Toolchain as Buildroot toolchain (Internal)
Kernel headers as 3.12.x
C library as uClibc
After this make command was run.
MPICH2
mpich-3.2.tar.gz was extracted and following commands were executed
1. $ export PATH=/home/mpiuser/CrossBuild/buildroot-2016.02/output/host/usr/bin:$PATH
2. $ sudo ./configure --prefix=/home/mpiuser/CrossBuild/arm-mpich-install --disable-fortran CC=/home/mpiuser/CrossBuild/buildroot-2016.02/output/host/usr/bin/arm-linux-gcc --host=arm-linux
After this make was run for mpich-3.2, and during compilation following error was thrown :
GEN lib/libmpi.la
CXX src/binding/cxx/initcxx.lo
CXXLD lib/libmpicxx.la
lib/.libs/libmpi.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libmpicxx.la] Error 1
make[2]: Leaving directory `/home/mpiuser/CrossBuild/mpich-3.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/mpiuser/CrossBuild/mpich-3.2'
make: *** [all] Error 2
Request to please help. Thanks
I have the source code for android-5.0.0_r7.0.1. After doing:
make -j4
I keep getting this:
error: stdarg.h: No such file or directory
In file included from system/core/include/cutils/log.h:1,
from system/core/include/utils/KeyedVector.h:24,
from frameworks/native/include/input/Input.h:26,
from frameworks/native/include/input/InputDevice.h:20,
from frameworks/native/libs/input/InputDevice.cpp:23:
system/core/include/log/log.h:35:20: error: stdarg.h: No such file or directory
make: *** [out/host/darwin-x86/obj32/EXECUTABLES/validatekeymaps_intermediates/Main.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/Keyboard.o] Error 1
make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/InputDevice.o] Error 1
make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/Input.o] Error 1
#### make failed to build some targets (01:32 (mm:ss)) ####
I have looked at the google groups and other stack overflow questions, but I cannot seem to figure out what is going wrong.
#Meteorite
Well, ultimately after googling I discovered the AOSP for some reason did not support the latest version of Xcode tools and OS X. I dualbooted windows 7 with ubuntu, and did the whole process. And when I did the make command on ubuntu I typed: make -k -i -B. That is, I gave it the keep going, ignore make errors and build unconditionally flags.
I try to build the rt73.ko linux driver for android using cross complile. I have download the android NDK and the Kernel sources of the the target system (Rockchip RK3066) and when I build the driver I am getting the following error:
root#slax:~/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module# make
CROSS_COMPILE=arm-linux-androideabi- make -C /root/kernel
SUBDIRS=/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module mod-ules
make[1]: Entering directory /root/kernel' CC [M]
/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.o
/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.c: In
function 'usb_rtusb_probe':
/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.c:1152:3:
warning: return makes integer from pointer without a cast [enabled by
default] /root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.c:
In function 'usb_rtusb_disconnect':
/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.c:1315:2:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.c: In
function 'usb_rtusb_close':
/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.c:655:1:
warning: the frame size of 2128 bytes is larger than 1024 bytes
[-Wframe-larger-than=]
/root/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/as:
/usr/lib/libz.so.1: no version information available (required by
/root/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/as)
/bin/sh: scripts/basic/fixdep: cannot execute binary file make[2]: ***
[/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module/rtmp_main.o] Error
126 make[1]: ***
[_module_/root/2011_0210_RT73_Linux_STA_Drv1.1.0.5/Module] Error 2
make[1]: Leaving directory/root/kernel' make: * [all] Error 2
Could you please help me to overcome the above error?
Although you cross compile, only the kernel can be compiled. scripts/basic/fixdep is userland program.
To overcome this, you need to use http://crosstool-ng.org/ for example.
When I built Gamekit for Android, I got the follow error:
...(deleted)
[ 98%] Built target OgreKitCore
Linking CXX executable ../../../bin/StripBlend
/usr/local/android-ndk-r8b/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86/bin/../lib/gcc/mipsel-linux-android/4.6.x-google/../../../../mipsel-linux-android/bin/ld: cannot open linker script file /usr/local/android-ndk/toolchains/mipsel-linux-android-4.6/mipself.x: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [../bin/StripBlend] Error 1
make[1]: *** [FileTools/Strip/CMakeFiles/StripBlend.dir/all] Error 2
make: *** [all] Error 2
I google it and found a related post:
https://groups.google.com/forum/#!msg/doubango/TVOUjTxfbtA/y6eaikfcTu0J
They just rollback NDK version to fix this problem.
However, I have to build an Android Gamekit library for MIPS CPU, so I need NDK-r8 or NDK-r8b.
Is there any suggestion to fix this problem?
PS: GameKit is http://code.google.com/p/gamekit/
Copy mipself.x and mipself.xsc, which can be downloaded from the Internet,
into /toolchains/mipsel-linux-android-4.6/ folder, and then fix this problem.