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
#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
11、進入開發板 ts 測試目錄 我的是 /usr/local/tslib/bin
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前面的 # 號,並刪除空格即可並去掉前面空格