CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
12
返回列表 发新帖
楼主: 天下第七

ubuntu 12.04 交叉编译工具链安装问题

[复制链接]
发表于 2014-8-20 16:17:14 | 显示全部楼层
攀越顶峰 发表于 2014-8-20 15:28
是说我的宿主机也必须是同个内核版本的吗?
cb2的lubuntu的内核3.4.43的,宿主机也要是安装lubuntu的内核 ...

不是要用主机ubuntu的内核,是你在宿主机上要编译一个cb2的内核,然后用这个内核跟源码交叉编译驱动。
回复 支持 反对

使用道具 举报

发表于 2014-8-20 22:51:01 | 显示全部楼层
facat 发表于 2014-8-20 16:17
不是要用主机ubuntu的内核,是你在宿主机上要编译一个cb2的内核,然后用这个内核跟源码交叉编译驱动。 ...

谢谢!有点明白了
今天根据这个编译了一个img文件。
http://www.eeboard.com/bbs/thread-37911-1-1.html
最后一步:lib复制到sd卡的linux分区
原来的tf卡上的lib文件夹里除了firmware和modules外,还有很多其他的文件,而我编译出来的lib文件夹里只有firemware,modules文件夹。
感觉相差比较多。

还有一个问题,我查了一下在原来的img里也有sun-ts。ko的文件,但是为什么会加载不进去呢?报错提示如下:
root@cubieboard2:/lib/modules/3.4.43+/kernel/drivers/input/touchscreen# insmod sun4i-ts.ko
insmod: error inserting 'sun4i-ts.ko': -1 Operation not permitted
这个模块的信息如下:
root@cubieboard2:/lib/modules/3.4.43+/kernel/drivers/input/touchscreen# modinfo sun4i-ts.ko
filename:       sun4i-ts.ko
license:        GPL
description:    sun4i touchscreen driver
author:         zhengdixu <@>
srcversion:     9808EE988A21248B1F64382
depends:        
intree:         Y
vermagic:       3.4.43+ SMP preempt mod_unload modversions ARMv7 p2v8
内核的信息如下:
root@cubieboard2:/lib/modules/3.4.43+/kernel/drivers/input/touchscreen# uname -a
Linux cubieboard2 3.4.43+ #1 SMP PREEMPT Sat Sep 7 16:45:20 CST 2013 armv7l armv7l armv7l GNU/Linux
内核版本应该是一样的吧,请教怎么解决呀
回复 支持 反对

使用道具 举报

发表于 2014-8-21 10:47:11 | 显示全部楼层
攀越顶峰 发表于 2014-8-20 22:51
谢谢!有点明白了
今天根据这个编译了一个img文件。
http://www.eeboard.com/bbs/thread-37911-1-1.html
原来的tf卡上的lib文件夹里除了firmware和modules外,还有很多其他的文件,而我编译出来的lib文件夹里只有firemware,modules文件夹。
感觉相差比较多。

有一些文件是其他的库,不一定是必须的。
还有一个问题,我查了一下在原来的img里也有sun-ts。ko的文件,但是为什么会加载不进去呢?报错提示如下:
root@cubieboard2:/lib/modules/3.4.43+/kernel/drivers/input/touchscreen# insmod sun4i-ts.ko
insmod: error inserting 'sun4i-ts.ko': -1 Operation not permitted
这个模块的信息如下:
root@cubieboard2:/lib/modules/3.4.43+/kernel/drivers/input/touchscreen# modinfo sun4i-ts.ko
filename:       sun4i-ts.ko
license:        GPL
description:    sun4i touchscreen driver
author:         zhengdixu <@>
srcversion:     9808EE988A21248B1F64382
depends:        
intree:         Y
vermagic:       3.4.43+ SMP preempt mod_unload modversions ARMv7 p2v8
内核的信息如下:
root@cubieboard2:/lib/modules/3.4.43+/kernel/drivers/input/touchscreen# uname -a
Linux cubieboard2 3.4.43+ #1 SMP PREEMPT Sat Sep 7 16:45:20 CST 2013 armv7l armv7l armv7l GNU/Linux
内核版本应该是一样的吧,请教怎么解决呀

加载出错后,用dmesg 看一下错误信息
回复 支持 反对

使用道具 举报

发表于 2014-8-21 15:08:50 | 显示全部楼层
facat 发表于 2014-8-21 10:47
有一些文件是其他的库,不一定是必须的。

加载出错后,用dmesg 看一下错误信息 ...

谢谢帮忙解答
用dmesg看了一下
[  487.128139] sun4i-ts sun4i-ts: Cannot request keypad IRQ
[  487.136706] sun4i-ts.c: sun4i_ts_probe: failed!
[  487.141431] sun4i-ts: probe of sun4i-ts failed with error -22
[ 4834.645377] sun4i_ts: disagrees about version of symbol module_layout

这个驱动模块是官网上的img带的,可能是不是没有测试过的了。

还有一个问题请教一下:
在网上下了个sunxi-ts.c 文件,是用在A20上的,下载了对应目标板上的源码文件,下载地址
http://docs.cubieboard.org/tutor ... tu_desktop_releases
v1.05的版本。
我根据这个提示编译了内核
http://forum.cubietech.com/forum.php?mod=viewthread&tid=371
现在想把这个sunxi-ts.c的文件编译成ko文件,加载进去目标板上,写的makefile如下:
#=====================================================
ifneq ($(KERNELRELEASE),)
obj-m:=sunxi-ts.o
else
#KERNELDIR:=/lib/modules/$(shell uname -r)/build
KERNELDIR:=/home/up/linux-sunxi/output/lib/modules/3.4.43/build
PWD:=$(shell pwd)
default:
        $(MAKE) -C $(KERNELDIR)  M=$(PWD) modules
clean:
        rm -rf *.o *.mod.c *.mod.o *.ko
endif
#=================================================
/home/up/linux-sunxi/output/lib/modules/3.4.43/build
请问这个路径是对吗?
执行make后出了一堆的错误:其中一部分是这样的
make: Entering directory `/home/up/linux-sunxi'
  CC [M]  /home/up/up/modules/sunxi-ts.o
In file included from /home/up/linux-sunxi/arch/x86/include/asm/bitops.h:505:0,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:19,
                 from include/linux/interrupt.h:5,
                 from /home/up/up/modules/sunxi-ts.c:21:
/home/up/linux-sunxi/arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:

请指教一下,我在哪个地方错误了,谢谢!

回复 支持 反对

使用道具 举报

发表于 2014-8-21 20:15:47 | 显示全部楼层
攀越顶峰 发表于 2014-8-21 15:08
谢谢帮忙解答
用dmesg看了一下
[  487.128139] sun4i-ts sun4i-ts: Cannot request keypad IRQ
用dmesg看了一下
[  487.128139] sun4i-ts sun4i-ts: Cannot request keypad IRQ
[  487.136706] sun4i-ts.c: sun4i_ts_probe: failed!
[  487.141431] sun4i-ts: probe of sun4i-ts failed with error -22
[ 4834.645377] sun4i_ts: disagrees about version of symbol module_layout

这个驱动模块是官网上的img带的,可能是不是没有测试过的了。

由于提供的信息不够多,我暂时也不知道问题出在哪。

make: Entering directory `/home/up/linux-sunxi'
  CC [M]  /home/up/up/modules/sunxi-ts.o
In file included from /home/up/linux-sunxi/arch/x86/include/asm/bitops.h:505:0,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:19,
                 from include/linux/interrupt.h:5,
                 from /home/up/up/modules/sunxi-ts.c:21:
/home/up/linux-sunxi/arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:

请把错误信息贴完。不过我猜是某个函数找不到是吧。没发现路径中有个x86吗?你提供的头文件路径不对,就找不到函数了。cb2一般要调用arch/sun7i下的头文件。
回复 支持 反对

使用道具 举报

发表于 2014-8-21 20:32:27 | 显示全部楼层
facat 发表于 2014-8-21 20:15
由于提供的信息不够多,我暂时也不知道问题出在哪。

在arch下没有sun7i的文件夹。
sunxi-ts.c里面的包含文件,
#include <linux/interrupt.h>

#include <linux/errno.h>

#include <linux/kernel.h>

#include <linux/module.h>

#include <linux/slab.h>

#include <linux/input.h>

#include <linux/device.h>

#include <linux/platform_device.h>

#include <linux/init.h>

#include <linux/delay.h>

#include <linux/ioport.h>

#include <asm/irq.h>

#include <asm/io.h>

#include <linux/fs.h>

#include <asm/uaccess.h>

#include <linux/mm.h>

#include <linux/slab.h>

#include <linux/timer.h>

#include <linux/jiffies.h>

#include <linux/tick.h>

#include <asm-generic/cputime.h>
都没有指向arch/x86的呀
不知道是在哪个地方错了,导致头文件指向这了。
回复 支持 反对

使用道具 举报

发表于 2014-8-21 22:46:37 | 显示全部楼层
是这些头文件间接引用的。

arch有啊,我的是linux-sunxi-pat-3.4.79/arch/arm/mach-sun7i

其中KERNELDIR:=/lib/modules/$(shell uname -r)/build,这句指向的是宿主机的内核路径,

KERNELDIR是指向编译好的内核,你这个搞错了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-5-19 12:26 , Processed in 0.024539 second(s), 13 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部