• Linux编译SDK时报错


    CPU模块为 :海光AMD
    操作系统为:统信UOS

    1、 error: unknown type name ‘mm_segment_t’; did you mean ‘apm_event_t’?
    static inline void set_fs(mm_segment_t fs)

    $ vim /lib/modules/$(uname -r)/build/arch/x86/include/asm/uaccess.h

    添加头文件

    #include 
    
    • 1

    2、 error: dereferencing pointer to incomplete type ‘struct task_struct’
    current->thread.addr_limit = fs;

    $ vim /lib/modules/$(uname -r)/build/arch/x86/include/asm/uaccess.h

    添加头文件

    #include 
    
    • 1

    3、 error: passing argument 1 of ‘kthread_create_on_node’ from incompatible pointer type
    kport_monitor_task = kthread_run(_Hal_PortMonitorThread, NULL, “portmonitor”);

    找到_Hal_PortMonitorThread函数定义的地方改为

    static int _Hal_PortMonitorThread(void *data)
    {
    	...
    }
    
    • 1
    • 2
    • 3
    • 4

    4、error: implicit declaration of function ‘pci_enable_msi_exact’; did you mean ‘pci_enable_msix_exact’

    将pci_enable_msix_exact修改成pci_enable_msix_range,参数也要相应修改

    #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
            ret = pci_enable_msix_range(dal_dev, NULL, msi_num, msi_num)
    
    • 1
    • 2

    5、implicit declaration of function ‘copy_from_user’;
    implicit declaration of function ‘copy_to_user’

    #include 
    
    • 1

    6、error: implicit declaration of function ‘init_timer’

    #if (LINUX_VERSION_CODE  < KERNEL_VERSION(4,14,0))
        init_timer(&dev->getIntrTimer);
        dev->getIntrTimer.data = (unsigned long) dev;
        dev->getIntrTimer.function = GetIntrTimerCallback;
        /* ... */
        add_timer(&dev->getIntrTimer);
    #else
        timer_setup(&dev->getIntrTimer, GetIntrTimerCallback, 0);
        /* the third argument may include TIMER_* flags */
        /* ... */
    #endif
    
    
    #if (LINUX_VERSION_CODE  < KERNEL_VERSION(4,14,0))
    void GetIntrTimerCallback(unsigned long devAddr)
    {
        myDevice *dev = (myDevice *) devAddr;
    #else
    void GetIntrTimerCallback(struct timer_list *t)
    {
        myDevice *dev = from_timer(dev, t, getIntrTimer);
    #endif
        /* Do something with "dev" */
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
  • 相关阅读:
    docker知识点
    EFLK日志平台(filebeat-->kafka-->logstash-->es-->kiabana)
    如何使用pid
    SpringCloud学习笔记(四)
    Postgresql-xl全局快照与GTM代码走读(支线)
    内核驱动踩坑记录
    Java 实现MD5
    python多线程系列—线程池ThreadPoolExecutor(八)
    使用Spark清洗统计业务数据并保存到数据库中
    计算机毕业设计选题推荐-社区团购管理系统-Python项目实战
  • 原文地址:https://blog.csdn.net/qq_37076942/article/details/128114959