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 <asm/processor.h>

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 <linux/sched.h>

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)
{
	...
}

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)

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

#include <linux/uaccess.h>

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" */
}
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云淡风轻ing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值