pomelo 发表于 2022-10-13 15:49:47

rk3568 linux sdk修改内核配置后编译报错,发现存在未开源的文件


在修改内核配置后,编译报错,发现是kernel/drivers/spi/spi-wk2xxx这个文件不是源码引起的,请修复一下。

MODPOST vmlinux.o
drivers/spi/spi-wk2xxx: In function `wk2xxx_set_mctrl':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:828: undefined reference to `_mcount'
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:828:(.text+0xc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_get_mctrl':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:835: undefined reference to `_mcount'
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:835:(.text+0x24): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_enable_ms':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:958: undefined reference to `_mcount'
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:958:(.text+0x40): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_break_ctl':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:968: undefined reference to `_mcount'
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:968:(.text+0x58): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_type':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1460: undefined reference to `_mcount'
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1460:(.text+0x78): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx:/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1505: more undefined references to `_mcount' follow
drivers/spi/spi-wk2xxx: In function `wk2xxx_verify_port':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1505:(.text+0xbc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_request_port':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1479:(.text+0x120): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_config_port':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1488:(.text+0x154): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_release_port':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1471:(.text+0x188): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_remove':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:1750:(.text+0x1bc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `_mcount'
drivers/spi/spi-wk2xxx: In function `wk2xxx_dowork':
/home/llq/p/proj/rk3568/kernel/drivers/spi/spi-wk2xxx.c:266:(.text+0x248): additional relocation overflows omitted from the output
drivers/spi/spi-wk2xxx: In function `kmalloc':
/home/llq/p/proj/rk3568/kernel/./include/linux/slab.h:548: undefined reference to `kmem_cache_alloc_trace'
drivers/spi/spi-wk2xxx: In function `wk2xxx_tx_empty':

pomelo 发表于 2022-10-13 16:19:59

看了一下,3566 3568 linux和android sdk中都存在固件,都会有修改配置无法编译的风险

895816513 发表于 2022-10-13 16:46:26

这个是你裁剪配置项造成的。



就拿undefined reference to `kmem_cache_alloc_trace'
在连接文件的时候找不到这个定义,你看看mm/slab.c这个文件是不是被你裁剪了config,造成没有被链接到。

mm/slab.c:kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size)
mm/slab.c:EXPORT_SYMBOL(kmem_cache_alloc_trace);
mm/slub.c:void *kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size)
mm/slub.c:EXPORT_SYMBOL(kmem_cache_alloc_trace);


还有这个undefined reference to `_mcount'

arch/arm64/kernel/arm64ksyms.c:EXPORT_SYMBOL(_mcount);
arch/arm64/kernel/arm64ksyms.c:NOKPROBE_SYMBOL(_mcount);

pomelo 发表于 2022-10-13 19:52:56

895816513 发表于 2022-10-13 16:46
这个是你裁剪配置项造成的。




我看了一下,应该是kernel/drivers/spi/spi-wk2xxx这个文件没有开源导致的, 这个文件原来是带有ftrace开关进行编译的,我现在需要关闭ftrace开关,然后内核链接这个文件就出问题,_mcount是因为ftrace开关导致的。kernel/drivers/spi/spi-wk2xxx这个可以开发出来吗,我的理解linux内核是gpl的,内核的修改是可以开源出来的,另外还有drivers/mmc/core/mmc_blk_data这也是闭源的,也会引起同样的问题,如果把这2个镜像从makefile中去掉,编译就可以过,但是这2个模块不清楚是啥作用,贸然删掉会不会引起问题。

pomelo 发表于 2022-10-13 19:59:06

895816513 发表于 2022-10-13 16:46
这个是你裁剪配置项造成的。




现在我的工作是需要裁剪内核,因为存在未开源的镜像在内核里面,会导致我的裁剪工作无法实施,也就造成我这边没法使用贵司的单板进行二次开发,请帮忙解决一下,谢谢!

895816513 发表于 2022-10-14 09:58:10

这2份驱动不开源

penguin 发表于 2022-10-17 16:01:21

那你的应用场景中,需要用到这个设备吗? 不用的话,可以把这个驱动关掉。

pomelo 发表于 2022-10-17 17:29:19

penguin 发表于 2022-10-17 16:01
那你的应用场景中,需要用到这个设备吗? 不用的话,可以把这个驱动关掉。

首先第一点,linux内核是gpl开源协议,如果使用linux开发的内核模块,按照开源协议是必须开源的。其次,需要你们说明spi-wk2xxx和mmc_blk_data这2个没有开源的模块主要的功能,才能确定我们是否会不会用。另外怎么关掉也需要做出说明,关掉后会有什么影响,目前看mmc_blk_data直接关掉好像是编译不过的。

penguin 发表于 2022-10-18 09:24:21

spi-wk2xxx 是232和485的接口,是目前这个板子上没有的,可以直接去掉。 mmc_blk_data这个不能关掉。

pomelo 发表于 2022-10-18 11:42:29

penguin 发表于 2022-10-18 09:24
spi-wk2xxx 是232和485的接口,是目前这个板子上没有的,可以直接去掉。 mmc_blk_data这个不能关掉。

mmc_blk_data这个不能关掉,就解决不了这个帖子提出来的问题哦
页: [1] 2
查看完整版本: rk3568 linux sdk修改内核配置后编译报错,发现存在未开源的文件