Error while trying to compile android kernel in ubuntu - android

I'm trying to compile a Android Kernel from source and I have downloaded all the right packages to do it but for some reason I get this error:
arm-linux-androideabi-gcc: error: unrecognized command line option '-mgeneral-regs-only'
/home/livlogik/android/kernel/H901BK_L_Kernel/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:858: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
I have the latest NDK and I'm using Ubuntu 15.10 64bit if this helps.
Here is where I have the NDK and kernel:
NDK ---- /home/livlogik/android/ndk/
Kernel ---- /home/livlogik/android/kernel/H901bk_L_Kernel/
If someone could help me that would be great. Sorry if this was already posted I could find a answer to it.
Thanks,
Zach

As it can be seen from build error message:
drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c:20:27: fatal error: ./mh1/msm_mh1.h: No such file or directory
#include <./mh1/msm_mh1.h>
compiler just can't find msm_mh1.h file. This is because the path specified for #include directive isn't correct. Most probably it's typo: instead ./ there should be ../.
To fix that error, in drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c file change this line:
#include <./mh1/msm_mh1.h>
to this line
#include "../mh1/msm_mh1.h"
After this make command should work fine. Also, kernel image file will be available at arch/arm64/boot, and it's not zImage as stated in documentation, it's actually Image.gz. Uncompressed kernel image is Image file.
Update
Answering your question in comments:
Is there any way to make it compress into a zImage?
From Documentation/arm64/booting.txt:
The AArch64 kernel does not currently provide a decompressor and
therefore requires decompression (gzip etc.) to be performed by the boot
loader if a compressed Image target (e.g. Image.gz) is used. For
bootloaders that do not implement this requirement, the uncompressed
Image target is available instead.
Basically zImage is just gzipped and self-extracted Image. So zImage file consists of program for unpacking gzip archive in the beginning, followed by gzipped Image, and when kernel is run by bootloader its unpacking itself (hense "self-extracted" term) and then start running.
...So I can make it flashable
In case of arm64, you don't have zImage, so most likely you need to use Image file (which acts in the same way, but only its size is bigger). You can create boot.img from Image file and built AFS ramdisk (using mkbootimg tool) and then just do fastboot flash boot boot.img. Refer to this documentation for example. Of course for your platform some things can be different, so try to find instructions for your platform.

You have to install the right toolchain:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
And configure the Makefile appropriately
The wrong toolchain is at
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-android-4.9

Related

Can't compile Chromium for android on Debian 9 - Unable to create file. File name too long

I am trying to compile chromium for android on Debian 9 and I get this error, can someone help me on this?
dacod#phoenix:~/Devel/chromium/src$ ninja -C out/Default cast_shell_apk
ninja: Entering directory `out/Default'
[0/21317] ACTION //third_party/WebKit/Source/bindings/modules/v8:generate...snapshot_external_references(//build/toolchain/android:android_clang_arm)
ninja: error:
WriteFile(__third_party_WebKit_Source_bindings_modules_v8_generate_v8_context_snapshot_external_references___build_toolchain_android_android_clang_arm__rule.rsp):
Unable to create file. File name too long
ninja: build stopped: .
The file system you are building on does not support name sizes long enough to accommodate the 150 character filename:
__third_party_WebKit_Source_bindings_modules_v8_generate_v8_context_snapshot_external_references___build_toolchain_android_android_clang_arm__rule.rsp
Typical file systems will support 255 character file names. Here is a reference:
https://serverfault.com/questions/9546/filename-length-limits-on-linux
However, eCryptfs only supports 143 character file names if it is also configured to encrypt the file names themselves [source]. Are you building in your home folder and is it encrypted? If so, this may be the reason. To check the file name size, run the following in your build folder:
$ getconf NAME_MAX .
143
If it is not 255 you may be building on an ecryptfs partition. Try building in /tmp instead, as it may not be encrypted. You can check this with:
$ getconf NAME_MAX /tmp
255

Android build error (Slim7.1) because of ALSA

Totally new to ROM building! Trying to build slim for the LG K20 Plus TP260 (MSM8917)
I've downloaded LG's source and have tried to assimilate it into Slim's source (basically merging everything but the frameworks folder) and am now trying to build.
But this is the Ninja error I get:
ninja: Entering directory `.'
ninja: error: '/home/android/Desktop/cheap_android_love/out/target/product/generic_arm64/obj/KERNEL_OBJ/usr', needed by '/home/android/Desktop/cheap_android_love/out/target/product/generic_arm64/obj/SHARED_LIBRARIES/libtinyalsa_intermediates/mixer.o', missing and no known rule to make it
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
I've checked the directory, and the "obj" folder doesn't even exist, so this error seems impossible to me... What files do I need to look at?
After changes to BoardConfig.mk and Kernel.mk makefiles regarding target kernel config and target source, everything goes together fine!

Why do I get this error: /system/bin/sh: ./mksquashfs: not executable: magic 7F45?

As I could not get mksquashfs tool for android. I compiled it for arm using cross compilation and got it built, toolchain is same for kernel as well mksquashfs.
I pushed mksquashfs to /data/ partition of target.
#: cd /data/
#: mkdir xyz
#: ./mksquashfs xyz xyz.sqsh
Error message is:
/system/bin/sh: ./mksquashfs: not executable: magic 7F45
Please let know how to get a working mksquashfs for android, if I am missing any cross compile toolchain etc.
Magic number 7F45 specifies the Executable and Linkable Format (ELF) file type, a format that is not executable on ARM processors.
Reason could be either improper cross compilation or either using wrong toolchain.
Using correct toolchain should fix this problem

PowerVR Android sample: makefile not working

I'm having a hard time setting up PowerVR SDK for Android on Windows 8 64, assuming I met all requirements:
Android SDK (fresh Eclipse)
Android NDK
Cygwin (with make)
PowerVR Android SDK 3.0
I can perfectly make and run an Android NDK sample. However, the same process fails for building any PowerVR sample (from the SDK). Here's the output when I try to run the makefile:
$ ndk
Compile++ thumb : OGLES2Texturing <= OGLES2Texturing.cpp
arm-linux-androideabi-g++.exe: error: C:/cygwin///cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.cpp: No such file or directory
arm-linux-androideabi-g++.exe: fatal error: no input files
compilation terminated.
/cygdrive/c/android-ndk-r8d/build/core/build-binary.mk:269: recipe for target `obj/local/armeabi/objs/OGLES2Texturing//cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.o' failed
make: * [obj/local/armeabi/objs/OGLES2Texturing//cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.o] Error 1
I suppose the error should be related to a wrong path given to the compiler. To me it looks like a mixture of standard Windows and Cygwin/Unix paths: * C:/cygwin///cygdrive/c/Users/stfn/...*
If been through so many makefiles now trying to resolve this issue but I just don't know where else to look. This is the first time I tried messing with the NDK. I'm afraid this could be my last.
Any help would be greatly appreciated
1.in the Android.mk file, for the PVRSDKDIR, set the path of your project folder in your workspace.
2.Copy the build, tools, and shell folders from the powervr sdk folder to your project folder

objdump on android kernel

I have taken android linux kernel split it from the gzip header and decompressed it. However when I try to do an objdump from the android ndk to dump the file I am getting a File format not recognized error.
Anyone know how get a symbol table from the binary image.
On my android device I can do the following to get a symbol table:
cat /proc/kallsyms
This is not unique to Android - it happens on most (all?) Linux systems. The bootable image of the Linux kernel (on which Android is based) is not a proper ELF binary:
# file /boot/vmlinuz-2.6.38.7-desktop-1mnb2
/boot/vmlinuz-2.6.38.7-desktop-1mnb2: Linux kernel x86 boot executable bzImage, version 2.6.38.7-desktop-1mnb2 (thomas#celeste.mandriva.com) #1 SMP Sun, RO-rootFS, root_dev 0x902, swap_dev 0x3, Normal VGA
# nm /boot/vmlinuz-2.6.38.7-desktop-1mnb2
nm: /boot/vmlinuz-2.6.38.7-desktop-1mnb2: File format not recognized
The bootable image is created by wrapping the vmlinux kernel ELF binary in a compressed container and adding a set of boot and decompression utilities. If you need a kernel image for debugging. the vmlinux file is what you need - I don't know if/where it exists in the Android NDK though.
Try using nm.
$ nm path/to/someobj

Categories

Resources