开发者社区 问答 正文

编译Android kernel-3.4.0 ,大家用的什么交叉编译链? 400 请求报错 

@邓凡平 大神帮忙看看 。如题:编译Android kernel-3.4.0 ,大家用的什么交叉编译链?
我要编译编译小米公布的kernel-3.4.0,用Android-4.2的arm-eabi-4.6编译链会报错,不知道大家用的是什么工具链啊?
错误为:

GEN     .version CHK     include/generated/compile.h UPD     include/generated/compile.h CC      init/version.o LD      init/built-in.o LD      .tmp_vmlinux1 arch/arm/kernel/built-in.o: In function handle_arch_irq': bootinfo.c:(.data+0x14): undefined reference toarch_idle' lib/built-in.o: In function longkstrtoull_from_user': dynamic_queue_limits.c:(.text+0x4034): undefined reference tolongkstrtoull' drivers/built-in.o: In function pmem_cache_maint': clkdev.c:(.text+0x3f51c): undefined reference toinvalidate_caches' clkdev.c:(.text+0x3f52c): undefined reference to clean_and_invalidate_caches' clkdev.c:(.text+0x3f540): undefined reference toclean_caches' lib/lib.a(memory_alloc.o): In function __free': memory_alloc.c:(.text+0x314): undefined reference togen_pool_free' lib/lib.a(memory_alloc.o): In function mem_type_to_memory_pool': memory_alloc.c:(.text+0x414): undefined reference togen_pool_create' memory_alloc.c:(.text+0x434): undefined reference to gen_pool_add_virt' memory_alloc.c:(.text+0x450): undefined reference togen_pool_destroy' lib/lib.a(memory_alloc.o): In function _allocate_contiguous_memory_nomap': memory_alloc.c:(.text+0x55c): undefined reference togen_pool_alloc_aligned' memory_alloc.c:(.text+0x5e0): undefined reference to gen_pool_free' lib/lib.a(memory_alloc.o): In functionallocate_contiguous_memory': memory_alloc.c:(.text+0x664): undefined reference to gen_pool_alloc_aligned' memory_alloc.c:(.text+0x710): undefined reference togen_pool_free' make: *** [.tmp_vmlinux1] Error 1 ubuntu@ubuntu:~/modified-miui-kernel/mi2_kernel-master$

@邓凡平  大牛帮忙看看,谢谢!

展开
收起
kun坤 2020-05-28 16:03:53 443 分享 版权
阿里云 AI 助理回答

您好!看起来您在编译Android kernel 3.4.0时遇到了链接错误,这通常是因为交叉编译工具链不匹配或者内核配置与所使用的工具链不兼容导致的。对于您的问题,建议以下几步来尝试解决:

  1. 确认正确的交叉编译工具链:对于Android 4.2(Jelly Bean)及基于ARM架构的设备,推荐使用arm-linux-androideabi-4.7或更高版本的交叉编译器。确保您的工具链是完整且安装正确的。如果可能的话,尝试获取小米官方推荐的编译工具链版本。

  2. 检查内核配置:确保您的内核配置(.config)文件正确设置了体系结构相关的选项,特别是与CPU架构、平台和编译器相关的设置。有时候,错误可能是由于某些配置项未被正确启用或禁用引起的。可以尝试使用小米提供的.config文件作为起点,或者重新配置内核,确保所有必要的模块和功能都被正确选中。

  3. 清理并重新构建:在更改了编译工具链或配置后,务必执行一次完整的清理操作,以避免旧的编译产物干扰新的构建过程。可以通过在内核根目录下运行make cleanmake mrproper命令来实现。

  4. 依赖性检查:报错信息中的“undefined reference”表明某些函数或变量在链接阶段找不到定义。这可能意味着一些必要的库或模块没有被正确链接。检查Makefile以及相关Kconfig文件,确保所有必要的依赖都已经被包含。

  5. 查看内核文档:查阅kernel源码树中的Documentation目录,特别是关于交叉编译的部分,可能会有针对特定平台或版本的编译指南和注意事项。

  6. 社区求助:如果上述步骤不能解决问题,考虑在XDA Developers、MIUI论坛或者Linux Kernel Mailing List等技术社区发帖求助,提供详细的错误信息和已尝试的解决步骤,那里有很多经验丰富的开发者可能会遇到过类似的问题并能提供帮助。

希望这些建议对您有所帮助!如果您有阿里云产品相关的问题,也欢迎随时提问。

有帮助
无帮助
AI 助理回答生成答案可能存在不准确,仅供参考
0 条回答
写回答
取消 提交回答