尝试在 ubuntu 中编译 android 内核时出错 [英] Error while trying to compile android kernel in ubuntu

查看:31
本文介绍了尝试在 ubuntu 中编译 android 内核时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从源代码编译 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

我有最新的 NDK,如果有帮助,我正在使用 Ubuntu 15.10 64 位.

I have the latest NDK and I'm using Ubuntu 15.10 64bit if this helps.

这里是我有 NDK 和内核的地方:

Here is where I have the NDK and kernel:

NDK ----/home/livlogik/android/ndk/

NDK ---- /home/livlogik/android/ndk/

内核 ----/home/livlogik/android/kernel/H901bk_L_Kernel/

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.

谢谢,

扎克

推荐答案

从构建错误信息中可以看出:

As it can be seen from build error message:

drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c:20:27:致命错误:./mh1/msm_mh1.h:没有那个文件或目录

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>

编译器找不到 msm_mh1.h 文件.这是因为为 #include 指令指定的路径不正确.很可能是拼写错误:./ 应该是 ../.

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

要修复该错误,请在 drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c 文件中更改此行:

To fix that error, in drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c file change this line:

#include <./mh1/msm_mh1.h>

到这一行

#include "../mh1/msm_mh1.h"

在这个 make 命令之后应该可以正常工作.此外,内核映像文件将在 arch/arm64/boot 中可用,它不是文档中所述的 zImage,它实际上是 Image.gz.未压缩的内核映像是 Image 文件.

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.

在评论中回答您的问题:

Answering your question in comments:

有什么办法可以把它压缩成zImage吗?

来自 文档/arm64/booting.txt:

AArch64 内核目前不提供解压器和因此需要由引导执行解压(gzip 等)如果使用压缩的 Image 目标(例如 Image.gz),则加载器.为了未实现此要求的引导加载程序,未压缩的Image 目标可用.

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.

基本上zImage 只是gzipped 和自解压Image.所以 zImage 文件首先由用于解包 gzip 存档的程序组成,然后是 gzip 压缩的 Image,当内核由引导加载程序运行时,它会自行解包(因此自解压")term) 然后开始运行.

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.

...所以我可以让它变得可闪

在 arm64 的情况下,你没有 zImage,所以很可能你需要使用 Image 文件(它的作用相同,但只有它的大小更大).您可以从 Image 文件创建 boot.img 并构建 AFS ramdisk(使用 mkbootimg 工具),然后只需执行 fastboot flash boot boot.img.例如,请参阅文档.当然,对于您的平台,有些事情可能会有所不同,因此请尝试查找适用于您平台的说明.

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.

这篇关于尝试在 ubuntu 中编译 android 内核时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆