CSDN_Acanoe 的博客:http://blog.csdn.net/ACanoe
硬件环境:OK6410 A板,4.3 寸TFT 屏。 移植内核:Linux2.6.36.2 。 参考内核: 飞凌提供Linux2.6.36.2。
操作记录:
一、ts 驱动移植
以下copy 是指需要飞凌提供的内核里的驱动源码, dev-ts.c ts 板载初始化和platform 资源初始化 文件。
arch/arm/mach-s3c64xx/mach-smdk6410.c
1、注销掉头文件 #include<plat/ts.h>
2、添加头文件 #include<mach/ts.h>
2.1 copy arch/arm/mach-s3c64xx/include/mach/ts.h 到目标内核目录
2.2 copy arch/arm/mach-s3c64xx/dev-ts.c 到目标内核目录
2.3 在 arch/arm/mach-s3c64xx/Makefile 中添加
obj-$(CONFIG_TOUCHSCREEN_S3C) += dev-ts.o
注销掉原有的
#obj-$(CONFIG_TOUCHSCREEN_TS) += dev-ts.o
3、添加 ts 设备初始化 ,在smdk6410_machine_init () 结构体中
- //s3c24xx_ts_set_platdata(&s3c_ts_platform); // cancel by acanoe
- s3c_ts_set_platdata(&s3c_ts_platform); // add by acanoe
- //s3c24xx_ts_set_platdata(&s3c_ts_platform); // cancel by acanoe
- s3c_ts_set_platdata(&s3c_ts_platform); // add by acanoe
4、在s3c_ts_platform 结构体中添加
.
- static struct s3c_ts_mach_info s3c_ts_platform __initdata = { // fix by canoe
- .delay = 10000,
- .presc = 49,
- .oversampling_shift = 2,
- .resol_bit = 12, //add by acanoe
- .s3c_adc_con = ADC_TYPE_2, //add by acanoe
- };
- static struct s3c_ts_mach_info s3c_ts_platform __initdata = { // fix by canoe
- .delay = 10000,
- .presc = 49,
- .oversampling_shift = 2,
- .resol_bit = 12, //add by acanoe
- .s3c_adc_con = ADC_TYPE_2, //add by acanoe
- };
5、修改 drivers/input/touchscreen/Makefile
添加 obj-$(CONFIG_TOUCHSCREEN_S3C) += s3c-ts.o
6、修改 drivers/input/tourch/screen/Kconfig
添加 config TOUCHSCREEN_S3C
- config TOUCHSCREEN_S3C
- tristate "S3C touchscreen driver"
- depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX
- default y
- help
- Say Y here to enable the driver for the touchscreen on the
- S3C SMDK board.
- If unsure, say N.
- To compile this driver as a module, choose M here: the
- module will be called s3c_ts.
- config TOUCHSCREEN_S3C
- tristate "S3C touchscreen driver"
- depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX
- default y
- help
- Say Y here to enable the driver for the touchscreen on the
- S3C SMDK board.
- If unsure, say N.
- To compile this driver as a module, choose M here: the
- module will be called s3c_ts.
7、配置内核 make menuconfig
Device Drivers--> Input Device support-->[ * ]Touchscreens -->[ * ]S3C Touchscreen driver
8、编译内核 make zImage
9、下载启动内核的正确打印信息为:
SB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mice: PS/2 mouse device common for all mice
S3C Touchscreen driver, (c) 2008 Samsung Electronics // touchscreen 驱动启动正常。
S3C TouchScreen got loaded successfully : 12 bits
input: S3C TouchScreen as /class/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
lirc_dev: IR Remote Control driver registered, major 253
二、 配置tslib 支持的 NFS 根文件系统。
交叉编译器 arm-linux-gcc 4.4.1。 路径 /usr/local/arm/4.4.1
1、下载tslib 源码包:tslib.tar.gz
2、解压。tar xvf tslib.tar.gz
3、安装软件 autoconf、qutomake、 libtool、 使用 apt-get install 命令安装。
4、进入解压后的tslib 目录 设置交叉编译器路径:
4、1 #export PATH=/usr/local/arm/4.4.1/bin:$PATH
4、2 #export TOOLCHAIN=/usr/local/arm/4.4.1
4、3 #export TB_CC_PREFIX=arm-linux-
4、4 #export PKG_CONFIG_PREFIX=$TOOLCHAIN/arm-linux
5、运行脚本
#./autogen.sh
#echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
6、配置安装参数, 换行为空格,中间无回车
#./configure --host=arm-linux --cache-file=arm-linux.cache --enable-inputapi=no PLUGIN_DIR=/usr/local/arm/tslib/plugins
-prefix=/usr/local/arm/tslib/build -host=arm-linux --cache-file=arm.cache 2>&1 | tee conf_log
7、编译
#make 2>&1 | tee make_log
#make install
8、编译完成后、配置tslib 我的tslib 生成目录在 /usr/local/arm/ 下也就是你上面配置时设定的目录
#cd build/etc
#vim ts.conf
去掉 # module_raw input 前的 # 号和 空格,改为 module_raw input。 保存退出
9、copy build 到 NFS 根文件系统 usr/local 下。该目录名为 tslib 命令 mv build tslib
10、设备etc/profile 下的配置文件,这个文件是你内核启动环境变量设置的地方。我的profile 文件内容为:
#No core file by defaults
USER="`id -un`"
LOGNAME=$USER
PS1='[\u@\h \W]\#'
PATH=$PATH
HOSTNAME=`/bin/hostname`
export USER LOGNAME PS1 PATH
export TSLIB_ROOT=/usr/local/tslib //lib 库文件目录,按照个人情况而定
export TSLIB_TSDEVICE=/dev/input/event0 //TS 设备节点名称,如果你有输入按键,在这里也可以尝试一下 event1 这个节点,按照个人情况而定
export TSLIB_CONFFILE=/usr/local/etc/ts.conf //ts 配置文件目录, 按照个人情况而定
export TSLIB_PLUGINDIR=/usr/local/lib/ts/ //ts
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_INFO_FILE=/sys/class/input/input0/uevent
export LD_LIBRARY_PATH=lib:/usr/lib:$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
- <span style="FONT-SIZE: 12px">#Ash profi
- #vim:syntax=sh
- #No core file by defaults
- USER="`id -un`"
- LOGNAME=$USER
- PS1='[\u@\h \W]\#'
- PATH=$PATH
- HOSTNAME=`/bin/hostname`
- export USER LOGNAME PS1 PATH
- export TSLIB_ROOT=/usr/local/tslib //lib 库文件目录,按照个人情况而定
- export TSLIB_TSDEVICE=/dev/input/event0 //TS 设备节点名称,如果你有输入按键,在这里也可以尝试一下 event1 这个节点,按照个人情况而定
- export TSLIB_CONFFILE=/usr/local/etc/ts.conf //ts 配置文件目录, 按照个人情况而定
- export TSLIB_PLUGINDIR=/usr/local/lib/ts/ //ts
- export TSLIB_CALIBFILE=/etc/pointercal
- export TSLIB_CONSOLEDEVICE=none
- export TSLIB_FBDEVICE=/dev/fb0
- export TSLIB_INFO_FILE=/sys/class/input/input0/uevent
- export LD_LIBRARY_PATH=lib:/usr/lib:$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
- </span>
12、运行测试文件: #./ts_calibrate
13、运行后可能出现的问题可解决办法:
问题1:
./ts_calibrate: error while loading shared libraries: libts-0.0.so.0: cannot open shared object file: Error 40
./ts_calibrate: error while loading shared libraries: libts-0.0.so.0: cannot ope
n shared object file: No such file or directory
解决办法:
#echo $LD_LIBRARY_PATH //查看lib路径,
#export LD_LIBRARY_PATH=$T_ROOT/lib
问题2:
ts_open: No such file or directory
解决办法:
#export TSLIB_TSDEVICE=/dev/input/event0 //触摸屏设备路径
问题3:
Couldnt open tslib config file: No such file or directory ts_config: Illegal seek
解决办法:
#export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
问题4:
Couldnt load module pthres
No raw modules loaded.
ts_config: Success
解决办法:
#export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
问题5:
No raw modules loaded.
Ts_config: No such file or directory
解决办法:
修改$T_ROOT/etc/ts.conf, 至少放开一个module_raw, 打开tslib-1.4/etc/ts.conf 文件,去掉其中一个modules_ raw前面的 # 号,并删除空格即可并去掉前面空格