如何修复android交叉编译过程中的分段错配错误

时间:2022-10-16 10:15:17

I am using the google ndk toolchain to cross compile an image for my Samsung Note 3 SM-N900P model. I downloaded the Kitkat version of Samsung Source code, and believe I have followed the instructions in the Kernel Readme file. It stated to use 4.7 toolchain, and I found it in NDK version 8d. But I get the following error:

我正在使用谷歌ndk工具链交叉编译我的三星Note 3 SM-N900P模型的图像。我下载了三星源代码的Kitkat版本,相信我已经遵循了内核Readme文件中的说明。它声明使用4.7工具链,我在NDK版本8d中找到了它。但是我得到了以下错误:

ERROR: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
(NOTE: This is not recommended)
/home/sansari/android/kernel/scripts/Makefile.modpost:98: recipe for target 'vmlinux.o' failed
make[1]: *** [vmlinux.o] Error 1
Makefile:935: recipe for target 'vmlinux.o' failed
make: *** [vmlinux.o] Error

After doing some searching online, I see two different posts hereand here. One seems to imply that I can not fix the issue, while the other says somewhat the opposite. This is based on my limited knowledge of the make file. I have basically read the first three chapters of the user's guide. I know what recepies are, and what it's basic structure is. I did look at line 935 of my Makefile and Here it is:

在网上搜索之后,我看到了两个不同的帖子。一个似乎在暗示我不能解决这个问题,而另一个似乎在说相反的话。这是基于我对make文件的有限了解。我基本上阅读了用户指南的前三章。我知道容器是什么,它的基本结构是什么。我看了Makefile的第935行,这里是:

modpost-init := $(filter-out init/built-in.o, $(vmlinux-init))
vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
$(call if_changed_rule,vmlinux-modpost)

I am posting this to find out if I can fix this error, and how I should go about it. Can anyone provide advice on how involved this problem is? Is it something I can fix?

我发布这篇文章是为了找出我是否能修正这个错误,以及我该如何去做。有人能就这个问题有多复杂提出建议吗?我能修好它吗?

Here is the error when make debug option is turned on:

这是调试选项打开时的错误:

WARNING: vmlinux.o(.data+0x8434): Section mismatch in reference from the variable     msm_mpm_debug_mask to the function .init.text:mpm_irq_domain_linear_size()
The variable msm_mpm_debug_mask references
the function __init mpm_irq_domain_linear_size()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: vmlinux.o(.data+0x844c): Section mismatch in reference from the variable  msm_mpm_debug_mask to the function .init.text:mpm_irq_domain_legacy_size()
The variable msm_mpm_debug_mask references
the function __init mpm_irq_domain_legacy_size()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
(NOTE: This is not recommended)
/home/sansari/android/kernel/scripts/Makefile.modpost:98: recipe for target 'vmlinux.o' failed
make[1]: *** [vmlinux.o] Error 1
Makefile:935: recipe for target 'vmlinux.o' failed
make: *** [vmlinux.o] Error 2

@user4838781 - Thanks

@user4838781——谢谢

1 个解决方案

#1


3  

Use 4.7, or if 4.8 try starting make with this:

使用4.7,如果4.8尝试用以下方法开始制作:

make -j$NUMBEROFCPUS CONFIG_NO_ERROR_ON_MISMATCH=y 

for example on Nexus 5 I build with

比如我用Nexus 5做的

make -j$NUMBEROFCPUS CONFIG_NO_ERROR_ON_MISMATCH=y zImage-dtb

#1


3  

Use 4.7, or if 4.8 try starting make with this:

使用4.7,如果4.8尝试用以下方法开始制作:

make -j$NUMBEROFCPUS CONFIG_NO_ERROR_ON_MISMATCH=y 

for example on Nexus 5 I build with

比如我用Nexus 5做的

make -j$NUMBEROFCPUS CONFIG_NO_ERROR_ON_MISMATCH=y zImage-dtb