移植编译bcm sdk6.4.8 过程-平台arm-linux cortex-a9双核,系xilinx soc

2023-10-08 08:50

本文主要是介绍移植编译bcm sdk6.4.8 过程-平台arm-linux cortex-a9双核,系xilinx soc,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

技术积累,移植编译bcm sdk6.4.8 过程记录

北京华环电子:任晓亮 2015-10-20

                                                                                             一句话总结:代码都是人写的,不试试怎么知道不行

目标平台:BCM-SDK-6.4.8

                   Linux kernel version-3-14-0

                   Xilinx znyq 7020 cortex-a9 双核

                   Zedboard

Sdk 修改内容:

renxl@icserver:~/sdk-xgs-robo-6.4.8/systems/linux/user/xilinx-3_14_0$make

1.  添加version.h文件。文件内容如下:

renxl@icserver:~/linux-xlnx-xilinx-v2014.2/include/linux$ cat version.h

#ifndef_VERSION_H

#define_VERSION_H

 

#ifndefLINUX_VERSION_CODE

#defineLINUX_VERSION_CODE 200192 ##这数字需经过实际v3.14.0,带入下面公式计算

#endif

 

#ifndefKERNEL_VERSION

#defineKERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

#endif

 

#endif

2.  修改复制文件

linux-xlnx-xilinx-v2014.2\arch\arm\include\asm\bitsperlong.h到linux-xlnx-xilinx-v2014.2\include

 

3.  修改Makefile.linux-xilinx-3_14_0

87 ifeq (,$(KFLAGS))

 88 KFLAGS :=-D__KERNEL__  -nostdinc  \

 89         -isystem $(KFLAG_INCLD) \

 90         -I$(LINUX_INCLUDE) \

 91         -include$(LINUX_INCLUDE)/linux/version.h \

 92         -include$(LINUX_INCLUDE)/generated/autoconf.h \

 93         -I$(KERNDIR)/arch/arm \

 94         -I$(KERNDIR)/include/uapi \

 95        -I$(KERNDIR)/arch/arm/include \

 96        -I$(KERNDIR)/arch/arm/include/uapi \

 97        -I$(KERNDIR)/arch/arm/include/generated \

 98        -I$(KERNDIR)/arch/arm/mach-zynq/include \

 99         -Wall -Wundef -Wstrict-prototypes-Wno-trigraphs -fno-strict-aliasing -fno-common-Werror-implicit-function-declarat    ion-Wno-format-security -fno-delete-null-pointer-checks -O2 -marm-mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D    __LINUX_ARM_ARCH__=5 -march=armv5te-mtune=arm9tdmi -msoft-float -Uarm -fno-stack-protector -fomit-frame-pointer-Wdeclarati    on-after-statement-Wno-pointer-sign -fno-strict-overflow

100 endif

 

4.  修改Makefile.linux-kernel-3_14_0 去掉告警错误中断,-Werror

141 ifndef BCM_CFLAGS

142#BCM_CFLAGS   = -Wall -Werror

143 BCM_CFLAGS   = -Wall

144 endif

5.修改

vi include/generated/autoconf.h

注释掉:

482 //#define CONFIG_SMP 1:

 

6.错误

/home/renxl/work/nios-kernel/arm_linux/fae-sdk-robo-6.3.6/src/sal/core/linux/alloc.c:In function 'sal_alloc':

/home/renxl/work/nios-kernel/arm_linux/fae-sdk-robo-6.3.6/src/sal/core/linux/alloc.c:169:5:error: implicit declaration of function 'kmalloc'[-Werror=implicit-function-declaration]

/home/renxl/work/nios-kernel/arm_linux/fae-sdk-robo-6.3.6/src/sal/core/linux/alloc.c:169:13:warning: assignment makes pointer from integer without a cast [enabled bydefault]

/home/renxl/work/nios-kernel/arm_linux/fae-sdk-robo-6.3.6/src/sal/core/linux/alloc.c:In function 'sal_free':

/home/renxl/work/nios-kernel/arm_linux/fae-sdk-robo-6.3.6/src/sal/core/linux/alloc.c:259:9:error: implicit declaration of function 'kfree'[-Werror=implicit-function-declaration]

cc1: some warnings being treated as errors

在alloc.c添加这个头文件:

#include <linux/slab.h>

7.错误

In file included from/home/renxl/work/nios-kernel/arm_linux/xilinx/linux-xlnx-xilinx-v2014.2/include/linux/kmemcheck.h:4:0,

                 from/home/renxl/work/nios-kernel/arm_linux/xilinx/linux-xlnx-xilinx-v2014.2/include/linux/net.h:25,

                 from/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/src/appl/diag/esw/txrx.c:65:

/home/renxl/work/nios-kernel/arm_linux/xilinx/linux-xlnx-xilinx-v2014.2/include/linux/mm_types.h:144:45: error: missing binary operator before token "("

/home/renxl/work/nios-kernel/arm_linux/xilinx/linux-xlnx-xilinx-v2014.2/include/linux/mm_types.h:427:46: error: missing binary operator before token "("

make[5]: ***[/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/build/linux-xilinx-3_14_0/src/appl/diag/esw/txrx.o]Error 1

修改:

vi include/linux/mm_types.h (内存页映射数据结构,错误提示这个宏定义有问题,注释掉宏开关)

144// #ifdefined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS

145                 pgtable_t pmd_huge_pte; /*protected by page->ptl */

146// #endif

427 行同样修改

 

8.错误

/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/systems/bde/linux/kernel/linux-kernel-bde.c:In function '_sinval':

/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/systems/bde/linux/kernel/linux-kernel-bde.c:4207:5:error: implicit declaration of function 'dma_cache_sync'[-Werror=implicit-function-declaration]

cc1: some warnings being treated as errors

 

9.错误,GPL开源协议错误

FATAL: modpost: GPL-incompatible modulelinux-uk-proxy.ko uses GPL-only symbol 'lockdep_init_map'

make[6]: *** [__modpost] Error 1

make[5]: *** [modules] Error 2

 

MODULE_LICENSE("Proprietary");  --------à>>>>>>>>>MODULE_LICENSE("GPL");

10.错误


Arm options:

https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

-Wall

-Wundef

-Wstrict-prototypes

-Wno-trigraphs

-fno-strict-aliasing

-fno-common

-Wno-format-security

-fno-delete-null-pointer-checks

-O2

-marm

-mabi=aapcs-linux

-mno-thumb-interwork

-funwind-tables

-D__LINUX_ARM_ARCH__=7

-march=armv7-a

-mtune=cortex-a9

-msoft-float

-Uarm

-fno-stack-protector

-fomit-frame-pointer

-Wdeclaration-after-statement

-Wno-pointer-sign

-fno-strict-overflow

-mfpu=vfp===== 硬件浮点运算

11.错误  sdk-6.3.6

[root@GXR05/usr/app]$insmod linux-kernel-bde.ko

[85743.129419] linux_kernel_bde: Unknown symbol dma_cache_sync (err 0)

insmod: can't insert 'linux-kernel-bde.ko': unknown symbol in module orinvalid parameter

./systems/bde/linux/kernel/linux-kernel-bde.c:4207:    dma_cache_sync(NULL, ptr, length,DMA_BIDIRECTIONAL);

./systems/bde/linux/kernel/linux-kernel-bde.c:4223:    dma_cache_sync(NULL, ptr, length,DMA_BIDIRECTIONAL);

 注释掉:=====//dma_cache_sync(NULL,ptr, length, DMA_BIDIRECTIONAL);

12.错误 ==== http://blog.chinaunix.net/uid-25597477-id-4834426.html

In file included from/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/systems/linux/kernel/modules/bcm-core/bcm-core.c:747:0:

/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/systems/linux/kernel/modules/bcm-core/bcm-core-symbols.h:At top level:

/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/systems/linux/kernel/modules/bcm-core/bcm-core-symbols.h:920:1:error: 'is_eyescan_algorithm_legacy_mode' undeclaredhere (not in a function)

make[3]: ***[/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/build/linux-xilinx-3_14_0/systems/linux/kernel/modules/bcm-core/bcm-core.o]Error 1

make[2]: *** [bcm-core] Error 2

make[1]: *** [kernel_modules] Error 2

make[1]: Leaving directory`/home/renxl/work/nios-kernel/arm_linux/sdk-xgs-robo-6.4.8/systems/linux/kernel/common'

make: *** [build] Error 2

 

屏蔽掉bcm-core-symbols.h:920 //EXPORT_SYMBOL(is_eyescan_algorithm_legacy_mode);

 

13.错误 insmod error;

(1)内核版本不一致导致:下面错误

[  59.053845] linux_bcm_diag_full: disagrees about version of symbolmodule_layout

insmod: can't insert'linux-bcm-diag-full.ko': invalid module format

(2)insmod: can't insert 'linux-bcm-diag-full.ko': invalid module format

Busybox:insmod 错误提示位置:

renxl@icserver:~/work/nios-kernel/busybox-1.20.2$grep -r -n "invalid module format" ./*

Binary file ./busybox matches

Binary file ./busybox_unstripped matches

./modutils/modprobe-small.c:164:          return "debug--164=invalid moduleformat";

Binary file ./modutils/modutils.o matches

Binary file ./modutils/lib.a matches

Binary file ./modutils/modprobe-small.omatches

./modutils/modutils.c:191:               return "debug--191-invalid moduleformat";


14:操作顺序

[root@GXR05/mnt]$insmod linux-uk-proxy.ko

[root@GXR05/mnt]$insmod linux-kernel-bde.ko

[root@GXR05/mnt]$insmodlinux-bcm-diag-full.ko

[root@GXR05/mnt]$mknod/dev/linux-uk-proxy c 125 0

15.核心模块error

       这个问题可能跟内核有关,需要深入研究,内核模块太大,申请内存出现错误:

http://bbs.chinaunix.net/thread-4168128-1-1.html

 

Linux 3.0对应修改源码:的memory.h里面的

1.  /*

2.  * PAGE_OFFSET - the virtual address of thestart of the kernel image

3.  * TASK_SIZE - the maximum size of a userspace task.

4.  * TASK_UNMAPPED_BASE - the lower boundaryof the mmap VM area

5.  */

6.  #define PAGE_OFFSET               UL(CONFIG_PAGE_OFFSET)

7.  #define TASK_SIZE               (UL(CONFIG_PAGE_OFFSET) - UL(0x01000000))

8.  #define TASK_UNMAPPED_BASE       (UL(CONFIG_PAGE_OFFSET) / 3)

9.   

10. /*

11. * The maximum size of a 26-bit user spacetask.

12. */

13. #define TASK_SIZE_26               UL(0x04000000)

14.  

15. /*

16. * The module space lives between theaddresses given by TASK_SIZE

17. * and PAGE_OFFSET - it must be within 32MBof the kernel text.

18. */

19. #ifndef CONFIG_THUMB2_KERNEL

20. #define MODULES_VADDR               (PAGE_OFFSET - 16*1024*1024)

21. #else

22. /* smaller range for Thumb-2 symbolsrelocation (2^24)*/

23. #define MODULES_VADDR               (PAGE_OFFSET - 8*1024*1024)

24. #endif

25.  

26. #if TASK_SIZE > MODULES_VADDR

27. #error Top of user space clashes withstart of module space

28. #endif

29.  

30. /*

31. * The highmem pkmap virtual space sharesthe end of the module area.

32. */

33. #ifdef CONFIG_HIGHMEM

34. #define MODULES_END               (PAGE_OFFSET - PMD_SIZE)

35. #else

36. #define MODULES_END               (PAGE_OFFSET)

37. #endif

16, error for insmod linux-bcm-core.ko

[root@GXR05/mnt]$insmod linux-bcm-core.ko

[   76.334104] linux_bcm_core:Unknown symbol soc_mem_array_write (err 0)

[   76.342565] linux_bcm_core:Unknown symbol soc_phy_set_verbose (err 0)

[   76.352435] linux_bcm_core:Unknown symbol soc_custom_reg_above_64_set (err 0)

[   76.360465] linux_bcm_core:Unknown symbol soc_mem_array_read_flags (err 0)

[   76.370004] linux_bcm_core:Unknown symbol bcm5324_trunk_patch_linkscan (err 0)

[   76.382773] linux_bcm_core:Unknown symbol soc_mem_array_read (err 0)

[   76.391729] linux_bcm_core:Unknown symbol soc_custom_reg_above_64_get (err 0)

[   76.399626] linux_bcm_core:Unknown symbol soc_mem_array_write_extended (err 0)

insmod: can't insert 'linux-bcm-core.ko': unknown symbol in module orinvalid parameter

修改:

./systems/linux/kernel/modules/bcm-core/bcm-core-symbols.h:871:EXPORT_SYMBOL(soc_mem_array_write);

这篇关于移植编译bcm sdk6.4.8 过程-平台arm-linux cortex-a9双核,系xilinx soc的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/164116

相关文章

在.NET平台使用C#为PDF添加各种类型的表单域的方法

《在.NET平台使用C#为PDF添加各种类型的表单域的方法》在日常办公系统开发中,涉及PDF处理相关的开发时,生成可填写的PDF表单是一种常见需求,与静态PDF不同,带有**表单域的文档支持用户直接在... 目录引言使用 PdfTextBoxField 添加文本输入域使用 PdfComboBoxField

SQLyog中DELIMITER执行存储过程时出现前置缩进问题的解决方法

《SQLyog中DELIMITER执行存储过程时出现前置缩进问题的解决方法》在SQLyog中执行存储过程时出现的前置缩进问题,实际上反映了SQLyog对SQL语句解析的一个特殊行为,本文给大家介绍了详... 目录问题根源正确写法示例永久解决方案为什么命令行不受影响?最佳实践建议问题根源SQLyog的语句分

windows和Linux使用命令行计算文件的MD5值

《windows和Linux使用命令行计算文件的MD5值》在Windows和Linux系统中,您可以使用命令行(终端或命令提示符)来计算文件的MD5值,文章介绍了在Windows和Linux/macO... 目录在Windows上:在linux或MACOS上:总结在Windows上:可以使用certuti

Linux之systemV共享内存方式

《Linux之systemV共享内存方式》:本文主要介绍Linux之systemV共享内存方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、工作原理二、系统调用接口1、申请共享内存(一)key的获取(二)共享内存的申请2、将共享内存段连接到进程地址空间3、将

快速修复一个Panic的Linux内核的技巧

《快速修复一个Panic的Linux内核的技巧》Linux系统中运行了不当的mkinitcpio操作导致内核文件不能正常工作,重启的时候,内核启动中止于Panic状态,该怎么解决这个问题呢?下面我们就... 感谢China编程(www.chinasem.cn)网友 鸢一雨音 的投稿写这篇文章是有原因的。为了配置完

Linux命令之firewalld的用法

《Linux命令之firewalld的用法》:本文主要介绍Linux命令之firewalld的用法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux命令之firewalld1、程序包2、启动firewalld3、配置文件4、firewalld规则定义的九大

Linux之计划任务和调度命令at/cron详解

《Linux之计划任务和调度命令at/cron详解》:本文主要介绍Linux之计划任务和调度命令at/cron的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux计划任务和调度命令at/cron一、计划任务二、命令{at}介绍三、命令语法及功能 :at

Linux下如何使用C++获取硬件信息

《Linux下如何使用C++获取硬件信息》这篇文章主要为大家详细介绍了如何使用C++实现获取CPU,主板,磁盘,BIOS信息等硬件信息,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录方法获取CPU信息:读取"/proc/cpuinfo"文件获取磁盘信息:读取"/proc/diskstats"文

Linux内核参数配置与验证详细指南

《Linux内核参数配置与验证详细指南》在Linux系统运维和性能优化中,内核参数(sysctl)的配置至关重要,本文主要来聊聊如何配置与验证这些Linux内核参数,希望对大家有一定的帮助... 目录1. 引言2. 内核参数的作用3. 如何设置内核参数3.1 临时设置(重启失效)3.2 永久设置(重启仍生效

kali linux 无法登录root的问题及解决方法

《kalilinux无法登录root的问题及解决方法》:本文主要介绍kalilinux无法登录root的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,... 目录kali linux 无法登录root1、问题描述1.1、本地登录root1.2、ssh远程登录root2、