am335x linux源码,TI am335x sdk 自带linux源码下编译驱动出错解决办法

在使用beaglebone black的时候从TI官网下载了最新版的sdk: ti-processor-sdk-linux-am335x-evm-01.00.00.00-Linux-x86-Install.bin

在linux下安装之后 kernel的默认路径是 /opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/ 然后执行make all就可以设置好所有的东西, 包括kernel也会编译一遍

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02就是kernel的源码目录

接下来我用了一个最简单的test驱动来测试:

#include

#include

static int myspi_init(void)

{

printk ("myspi_init \n");

return 0;

}

static void myspi_exit(void)

{

printk ("myspi_exit\n");

return 0;

}

module_init(myspi_init);

module_exit(myspi_exit);

MODULE_LICENSE("GPL");对应的Makefile

ifeq ($(KERNELRELEASE), )

KERNELDIR ?= /opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02

PWD := $(shell pwd)

modules:

$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

modules_install:

$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

clean:

rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

.PHONY: moudules modules_install clean

else

obj-m := myspidriver.o

endif然后在make的时候竟然出错,

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/arch_hweight.h:53:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64’

asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)

^

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/alternative.h:98:31: note: in definition of macro ‘ALTINSTR_REPLACEMENT’

b_replacement(number)":\n\t" newinstr "\n" e_replacement(number) ":\n\t"

^

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/arch_hweight.h:53:7: note: in expansion of macro ‘ALTERNATIVE’

asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)

^

In file included from include/linux/cache.h:5:0,

from include/linux/time.h:4,

from include/linux/stat.h:18,

from include/linux/module.h:10,

from /home/cxh/bbb_driver/myspidriver.c:2:

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/processor.h: At top level:

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/cache.h:7:25: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function)

#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)

^

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/cache.h:8:30: note: in expansion of macro ‘L1_CACHE_SHIFT’

#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)

^

include/linux/cache.h:12:25: note: in expansion of macro ‘L1_CACHE_BYTES’

#define SMP_CACHE_BYTES L1_CACHE_BYTES

^

/opt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/board-support/linux-3.14.26-g2489c02/arch/x86/include/asm/processor.h:131:30: note: in expansion of macro ‘SMP_CACHE_BYTES’

} __attribute__((__aligned__(SMP_CACHE_BYTES)));好奇怪, 最后发现出错的都是在x86文件夹下, 解决办法:

make ARCH=arm CORSS_COMPILE=arm-linux-gnueabihf-这样就不会报错了, 但是还不清楚为啥会这个样子,难道源码的顶层Makefile有问题, 可是sdk的make all之后生成的文件确实是arm平台的, 有高手看到本文的话望指点一下.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值