目录
Linux 3.3.5系统移植 2
LED驱动移植 8
按键驱动移植 9
LCD驱动移植 11
DM9000网卡驱动移植 14
搭建NFS网络文件系统 25
移植触摸屏驱动 38
移植Qt4.8.1 42
tslib移植及测试 42
移植qt-everywhere-opensource-src-4.8.145
今天听了宋宝华(http://www.embedu.org/lecture/index.htm)的讲座,一下子恍然大悟,我必须做点什么。。。。。。
Linux 3.3.5系统移植
- 将arch/arm/mach-s3c6410/下的,mach-smdk6410.c cp为mach-my6410.c;
- 打开arch/arm/mach-s3c6410/下的Kconfig,仿照MACH_SMDK6410做一个菜单项:
config MACH_MY6410
bool "MY6410"
select CPU_S3C6410
select SAMSUNG_DEV_ADC
select S3C_DEV_HSMMC
select S3C_DEV_HSMMC1
select S3C_DEV_I2C1
select SAMSUNG_DEV_IDE
select S3C_DEV_FB
select S3C_DEV_RTC
select SAMSUNG_DEV_TS
select S3C_DEV_USB_HOST
select S3C_DEV_USB_HSOTG
select S3C_DEV_WDT
select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_KEYPAD
select SAMSUNG_DEV_PWM
select HAVE_S3C2410_WATCHDOG ifWATCHDOG
select S3C64XX_SETUP_SDHCI
select S3C64XX_SETUP_I2C1
select S3C64XX_SETUP_IDE
selectS3C64XX_SETUP_FB_24BPP
select S3C64XX_SETUP_KEYPAD
help
Machine support for the PillarMY6410
- 打开arch/arm/tools/mach-types文件,这里面存的是机器ID必须要和uboot里面的ID保持一致,将其283行复制添加在后面并修改为:
smdk6410 MACH_SMDK6410 SMDK6410 1626
xx6410 MACH_XX6410 XX6410 1626 这个机器ID和UBOOT里的机器ID相同时才能启动内核;
- 修改BSP文件mach-my6410.c,内容如下:
将mach-mach-my6410.c文件中的所有smdk6410改成my6410(不要改大写SMDK6410的)
MACHINE_START(MY6410, "MY6410")//这个要和Kconfig里的MACH-MY6410匹配
- 在当前目录的Makefile最后一行加上 obj-$(CONFIG_MACH_MY6410) +=mach-my6410.o
- 修改顶层的Makefile:
ARCH ?= arm
CROSS_COMPILE ?=/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-
- 复制arch/arm/configs/下的s3c6400-defconfig文件,然后将其保存为.config,配置内核支持EABI,再选中XX6410board这一项,保存退出;
- 执行make menuconfig对内核进行配置:
执行make编译
执行make zImage生成zImage
将uboot根目录下的mkimage拷贝到/user/bin目录下
执行make uImage生成uImage
通过以上几步linux内核移植完了,剩下就移植驱动了。
这里需要注意,每一次修改Kconfig文件都需要make menuconfig对内核进行配置。
LED驱动移植
- Linu内核下drivers/leds/ledsgpio.c实现了一个体系结构无关的GPIOLED驱动,使用此LED 驱动,开发者不需要修改一行代码,只需要在 BSP 的板文件(对于OK6410为arch/arm/machs3c6410/machmy6410.c)中定义相关的platform设备和数据。在MY6410开发板上,GPM0~GPM3 实现了四个 LED,因此其对应的platform 信息如下:
arch/arm/machs3c6410/machmy6410.c:
static struct gpio_led my6410_leds[]={
[0]= {
.name = "LED1",
.gpio = S3C64XX_GPM(0),
},
[1]= {
.name = "LED2",
.gpio = S3C64XX_GPM(1),
},
[2]= {
.name = "LED3",
.gpio = S3C64XX_GPM(2),
},
[3]= {
.name = "LED4",
.gpio = S3C64XX_GPM(3),
},
};
static struct gpio_led_platform_datamy6410_gpio_led_pdata ={
.num_leds =ARRAY_SIZE(my6410_leds),
.leds =my6410_leds,
};
static struct platform_devicemy6410_device_led ={
.name = "leds-gpio",
.id = -1,
.dev ={
.platform_data =&my6410_gpio_led_pdata,
},
};
- 将&my6410_device_led添加到static struct platform_device*my6410_devices[] __initdata中。
- 配置内核:
Device Drivers--->
[*] LED Support--->
<*> LED Support forGPIO connected LEDs
下载内核后开发板上的四个LED这时候已经全部都亮了
按键驱动移植
- Linux内核下的drivers/input/keyboard/gpio_keys.c 实现了一个体系结构无关的 GPIO按键驱动,使用此按键驱动,开发者不需要修改一行代码,只需要在BSP 的板文件(对于MY6410为arch/arm/machs3c6410/machmy6410.c)中定义相关的platform设备和数据。在 MY6410开发板上,用 GPN0~GPN5实现了DOWN、ENTER、HOME、UP、TAB、END六个按键,因此其对应的 platform 信息如下:
arch/arm/machs3c6410/machmy6410.c:
static struct gpio_keys_buttonmy6410_buttons[] = {
{
.gpio = S3C64XX_GPN(0),
.code = KEY_UP,
.desc = "Up",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(1),
.code = KEY_DOWN,
.desc = "Down",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(2),
.code = KEY_LEFT,
.desc = "Left",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(3),
.code = KEY_RIGHT,
.desc = "Right",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(4),
.code = KEY_ENTER,
.desc = "Enter",
.active_low = 1,
.wakeup = 0,
},
{
.gpio = S3C64XX_GPN(5),
.code = KEY_ESC,
.desc = "Esc",
.active_low = 1,
.wakeup = 0,
}
};
static struct gpio_keys_platform_datamy6410_button_data ={
.buttons =my6410_buttons,
.nbuttons=ARRAY_SIZE(my6410_buttons),
};
static struct platform_devicemy6410_device_button = {
.name ="gpio-keys",
.id = -1,
.dev = {
.platform_data=&my6410_button_data,
},
};
- 将&my6410_device_button添加到static struct platform_device*my6410_devices[] __initdata中
- 配置linux内核
Device Drivers--->
Input device support--->
[*] Keyboards--->
<*> GPIOButtons
在移植按键驱动时候可能出现一下错误:
arch/arm/mach-s3c64xx/mach-my6410.c:298: error: array type hasincomplete element type
arch/arm/mach-s3c64xx/mach-my6410.c:300: error: field name notin record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:300: error: (nearinitialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:301: error: field name notin record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:301: error: (nearinitialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:302: error: field name notin record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:302: error: (nearinitialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:303: error: field name notin record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:303: error: (nearinitialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:304: error: field name notin record or union initialize
………………..
………………………
……………………………………
可以看出这个错误提示的意思是没有找到定义的数组,然后其他的就引起一连串的错误,解决的办法很简单就是把
#include
这个头文件添加进去就可以了。
今天已经就做这么多吧,人都快累垮了。。。。。。明天继续。。。。。。
LCD驱动移植
- 向mach-my6410.c里面填入相应的平台信息:
static struct s3c_fb_pd_winmy6410_fb_win0 = {
.win_mode = {
.left_margin = 2,
.right_margin = 2,
.upper_margin = 2,
.lower_margin = 2,
.hsync_len = 41,
.vsync_len = 10,
.xres = 480,
.yres = 272,
},
.max_bpp = 32,
.default_bpp = 16,
};
pixclock =1000000 / DCLK = 1000000 / 9 =111111
left_margin =Thb = 2
right_margin =Thf = 2
hsync_len = Thp= 41
upper_margin =Tvb = 2
lower_margin =Tvf = 2
vsync_len = Tvp= 10
xres = Thd =480
Yres = Tvd =272
static struct map_desc my6410_iodesc[]= {
{
.virtual =(unsigned long)S3C_VA_LCD,
.pfn =__phys_to_pfn(S3C_PA_FB),
.length =SZ_16K,
.type =MT_DEVICE,
},
};
- 然后将28内核中的drviers/video/samsung拷贝到drviers/video/目录下
- 修改drviers/video/的Kconfig文件,在文件中加入
source "drivers/video/samsung/Kconfig"
- 修改修改drviers/video/的Makefie文件,再最后一行添加:
obj-$(CONFIG_FB_S3C_EXT) += samsung/
- 在arch/arm/plat-samsung/include/plat/map-base.h里面添加
#define S3C_VA_LCD S3C_ADDR(0x01100000)
- 在include/generated/atuoconfig.h里面添加
#define CONFIG_FB_S3C_EXT_NUM 4
- 把drivers/video/samsung/s3cfb_fimd4x.c里面的
第1417行:
s3c6410_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
改成
s3c_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
第1438行
s3c6410_pm_do_restore(s3c_lcd_save,ARRAY_SIZE(s3c_lcd_save));
改成
s3c_pm_do_restore(s3c_lcd_save,ARRAY_SIZE(s3c_lcd_save));
- 配置内核:
Device Drivers--->
Graphics support--->
<*> Support for framebuffer devices ---> (里面的都空选)
<*> Support for framebuffer devices --->
[ ] Backlight & LCDdevice support --->
<*> S3C FramebufferSupport (eXtended)(修改Kconfig之后才有这个选)
Select LCD Type (4.3 inch480x272 TFT LCD) --->
(X) 4.3 inch 480x272 TFTLCD
<*> Advanced optionsfor S3C Framebuffer
Select BPP(Bits Per Pixel)(16 BPP) --->
(4) Number ofFramebuffers
[ ] Enable VirtualScreen
[*] Enable DoubleBuffering
Console display driversupport --->
<*> FramebufferConsole support
[*] Bootup logo--->(显示小企鹅)
[*] Standard 224-color Linuxlogo
如果驱动移植成功内核启动的时候会打印一下信息:
S3C_LCD clock got enabled :: 133.000 Mhz
LCD TYPE :: LTE480WV will be initialized
Window[0] - FB1: map_video_memory: clear ffd80000:0007f800
FB1: map_video_memory: dma=5f900000 cpu=ffd80000size=0007f800
Window[0] - FB2: map_video_memory: clear ffdbfc00:0003fc00
FB2: map_video_memory: dma=5f93fc00 cpu=ffdbfc00size=0003fc00
Console: switching to colour frame buffer device 60x34
fb0: s3cfb frame buffer device
Window[1] - FB1: map_video_memory: clear ffd00000:0007f800
FB1: map_video_memory: dma=5f980000 cpu=ffd00000size=0007f800
Window[1] - FB2: map_video_memory: clear ffd3fc00:0003fc00
FB2: map_video_memory: dma=5f9bfc00 cpu=ffd3fc00size=0003fc00
fb1: s3cfb frame buffer device
Window[2] - FB1: map_video_memory: clear ffcc0000:0003fc00
FB1: map_video_memory: dma=5fa00000 cpu=ffcc0000size=0003fc00
fb2: s3cfb frame buffer device
Window[3] - FB1: map_video_memory: clear ffc80000:0003fc00
FB1: map_video_memory: dma=5fa40000 cpu=ffc80000size=0003fc00
fb3: s3cfb frame buffer device
在LCD还会显示小企鹅:
相应的驱动程序都在
drviers/video/Samsung/s3cfb.c目录下
今天就为这驱动搞了一天,其实早就可以成功的,TMMD的不知道是不是手贱还是怎么的,
竟然把System Type --->
[* ] SMDK6400
选上了,最后系统一直打印都是SMDK6400的信息。幸好我靠
printk(KERN_INFO "DEBUGnnnn");
找到了原因。
以后有时间好好对LCD驱动做一下分析。
DM9000网卡驱动移植
- Linux内核里面已经支持了dm9000的网卡驱动,所以驱动程序我们不需要写了,只需要添加相应的平台信息。在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加都文件#include
- 在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加以下平台信息:
#define S3C64XX_PA_DM9000 (0x18000000)
#define S3C64XX_SZ_DM9000 SZ_1M
static struct resource my6410_dm9000_resources[] = {
[0] = {
.start= S3C64XX_PA_DM9000,
.end= S3C64XX_PA_DM9000 + 3,
.flags= IORESOURCE_MEM,
},
[1] = {
.start= S3C64XX_PA_DM9000 + 4,
.end= S3C64XX_PA_DM9000 + S3C64XX_SZ_DM9000 - 1,
.flags= IORESOURCE_MEM,
},
[2] = {
.start= IRQ_EINT(7),
.end= IRQ_EINT(7),
.flags= IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
},
};
static struct dm9000_plat_datamy6410_dm9000_platdata = {
.flags= DM9000_PLATF_16BITONLY,
.dev_addr= { 0x08, 0x90, 0x00, 0xa0,0x90, 0x90 },
};
static struct platform_devicemy6410_device_dm9000 = {
.name= "dm9000",
.id= 0,
.num_resources=ARRAY_SIZE(my6410_dm9000_resources),
.resource=my6410_dm9000_resources,
.dev= {
.platform_data =&my6410_dm9000_platdata,
}
};
然后在static struct platform_device *my6410_devices[] __initdata=里面添加
&my6410_device_dm9000,
- 配置内核,这里网络配置的选项很多,但都要根据实际选对:
- 出现的问题及解决方案:
- 编译的时候出现:
SYSMAP System.map
SYSMAP .tmp_System.map
Inconsistent kallsyms data
This is a bug - please report about it
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
make: *** [vmlinux] 错误 1
- 编译的时候出现:
这样的错误没有任何提示,经过总结,我发现这样的错误出现的原因就是内核中有些设备没有配置但是在BSP里面却定义了,或者是BSP里面定义了,但是内核没有配置。
解决方法是把static struct platform_device *my6410_devices[]__initdata里面一些三星的东西去掉,其实如果从一个空模版移植是不会出现这类问题的,这里我还是有些偷懒。修改以后的内容如下:
static struct platform_device *my6410_devices[] __initdata ={
#ifdef CONFIG_SMDK6410_SD_CH0
&s3c_device_hsmmc0,
#endif
&my6410_device_button,
&my6410_device_led,
&my6410_device_dm9000,
#ifdef CONFIG_SMDK6410_SD_CH1
&s3c_device_hsmmc1,
#endif
&s3c_device_i2c0,
//&s3c_device_i2c1,
&s3c_device_fb,
&s3c_device_ohci,
&s3c_device_usb_hsotg,
&samsung_asoc_dma,
//&s3c64xx_device_iisv4,
//&samsung_device_keypad,
#ifdef CONFIG_REGULATOR
//&my6410_b_pwr_5v,
#endif
//&my6410_lcd_powerdev,
//&my6410_smsc911x,
//&s3c_device_adc,
//&s3c_device_cfcon,
&s3c_device_rtc,
&s3c_device_ts,
//&s3c_device_wdt,
};
- 启动过程中出现这样的问题:
smsc911x: failed to claim resource0(这个提示原来在这儿我怎么没有发现)
------------[ cut here ]------------
WARNING: at drivers/base/core.c:194device_release+0x74/0x80()
Device 'platform-lcd.0' does not have a release() function, itis broken and must be fixed.
Modules linked in:
[] (unwind_backtrace+0x0/0xf8) from [](warn_slowpath_common+0x4c/0x64)
[] (warn_slowpath_common+0x4c/0x64) from [](warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt+0x30/0x40) from [](device_release+0x74/0x80)
[] (device_release+0x74/0x80) from [](kobject_release+0x44/0x78)
[] (kobject_release+0x44/0x78) from [](platform_add_devices+0x54/0x68)
[] (platform_add_devices+0x54/0x68) from [](customize_machine+0x20/0x30)
[] (customize_machine+0x20/0x30) from [](do_one_initcall+0x11c/0x170)
[] (do_one_initcall+0x11c/0x170) from [](kernel_init+0x84/0x128)
[] (kernel_init+0x84/0x128) from [](kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1c ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:194device_release+0x74/0x80()
Device 'samsung-keypad' does not have a release() function, itis broken and must be fixed.
Modules linked in:
[] (unwind_backtrace+0x0/0xf8) from [](warn_slowpath_common+0x4c/0x64)
[] (warn_slowpath_common+0x4c/0x64) from [](warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt+0x30/0x40) from [](device_release+0x74/0x80)
[] (device_release+0x74/0x80) from [](kobject_release+0x44/0x78)
[] (kobject_release+0x44/0x78) from [](platform_add_devices+0x54/0x68)
[] (platform_add_devices+0x54/0x68) from [](customize_machine+0x20/0x30)
[] (customize_machine+0x20/0x30) from [](do_one_initcall+0x11c/0x170)
[] (do_one_initcall+0x11c/0x170) from [](kernel_init+0x84/0x128)
[] (kernel_init+0x84/0x128) from [](kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1d ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:194device_release+0x74/0x80()
Device 'samsung-i2s.2' does not have a release() function, it isbroken and must be fixed.
Modules linked in:
[] (unwind_backtrace+0x0/0xf8) from [](warn_slowpath_common+0x4c/0x64)
[] (warn_slowpath_common+0x4c/0x64) from [](warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt+0x30/0x40) from [](device_release+0x74/0x80)
[] (device_release+0x74/0x80) from [](kobject_release+0x44/0x78)
[] (kobject_release+0x44/0x78) from [](platform_add_devices+0x54/0x68)
[] (platform_add_devices+0x54/0x68) from [](customize_machine+0x20/0x30)
[] (customize_machine+0x20/0x30) from [](do_one_initcall+0x11c/0x170)
[] (do_one_initcall+0x11c/0x170) from [](kernel_init+0x84/0x128)
[] (kernel_init+0x84/0x128) from [](kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1e ]---
出现这个这个错误的原因根据提示可以知道那个玩意儿没有得到资源。
原来它在arch/arm/mach-s3c64xx/include/mach/map.h 被这样定义
#define S3C64XX_PA_XM0CSN1 (18000000)
这个刚好我我们定义的DM9000的物理地址相同
所以就冲突了。解决方法很简单,就是把
static struct platform_device *my6410_devices[]__initdata里面的
//&my6410_smsc911x,注释掉。
- 最后系统启动信息如下:
SMDK6410 # bootm c0008000
## Booting image at c0008000 ...
Image Name: Linux-3.3.5
Created: 2012-05-10 8:00:27 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1987128 Bytes = 1.9 MB
Load Address: 50008000
Entry Point: 50008000
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.3.5 (root@superzuo) (gcc version 4.2.2) #38 ThuMay 10 16:00:17 CST 2012
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7),cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasinginstruction cache
Machine: my6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x36410101)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
camera: no parent clock specified
S3C64XX: PLL settings, A=532000000, M=532000000, E=24000000
S3C64XX: HCLK2=266000000, HCLK=133000000, PCLK=66500000
mout_apll: source is fout_apll (1), rate is 532000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 532000000
usb-bus-host: source is clk_48m (0), rate is 48000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
irda-bus: source is mout_epll (0), rate is 24000000
camera: no parent clock specified
CPU: found DTCM0 8k @ 00000000, not enabled
CPU: moved DTCM0 8k to fffe8000, enabled
CPU: found DTCM1 8k @ 00000000, not enabled
CPU: moved DTCM1 8k to fffea000, enabled
CPU: found ITCM0 8k @ 00000000, not enabled
CPU: moved ITCM0 8k to fffe0000, enabled
CPU: found ITCM1 8k @ 00000000, not enabled
CPU: moved ITCM1 8k to fffe2000, enabled
Built 1 zonelists in Zone order, mobility grouping on. Totalpages: 65024
Kernel command line: noinitrd root=/dev/mtdblock3rootfstype=yaffs2 console=ttySAC0 init=/linuxrcvideo=fb:AT070TN83
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536bytes)
Memory: 256MB = 256MB total
Memory: 255740k/255740k available, 6404k reserved, 0Khighmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)
ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc037e238 (3545 kB)
.init : 0xc037f000 - 0xc03a0000 ( 132 kB)
.data : 0xc03a0000 - 0xc03c8440 ( 162 kB)
.bss : 0xc03c9024 - 0xc03fe3eb ( 213 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1,Nodes=1
NR_IRQS:246
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
Console: colour dummy device 80x30
Calibrating delay loop... 528.79 BogoMIPS (lpj=2643968)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x50299118 - 0x50299174
gpiochip_add: registered GPIOs 38 to 53 on device: GPF
gpiochip_add: registered GPIOs 74 to 89 on device: GPI
gpiochip_add: registered GPIOs 91 to 102 on device: GPJ
gpiochip_add: registered GPIOs 161 to 176 on device: GPO
gpiochip_add: registered GPIOs 178 to 192 on device: GPP
gpiochip_add: registered GPIOs 194 to 202 on device: GPQ
gpiochip_add: registered GPIOs 144 to 159 on device: GPN
gpiochip_add: registered GPIOs 0 to 7 on device: GPA
gpiochip_add: registered GPIOs 9 to 15 on device: GPB
gpiochip_add: registered GPIOs 17 to 24 on device: GPC
gpiochip_add: registered GPIOs 26 to 30 on device: GPD
gpiochip_add: registered GPIOs 32 to 36 on device: GPE
gpiochip_add: registered GPIOs 55 to 61 on device: GPG
gpiochip_add: registered GPIOs 137 to 142 on device: GPM
gpiochip_add: registered GPIOs 63 to 72 on device: GPH
gpiochip_add: registered GPIOs 104 to 119 on device: GPK
gpiochip_add: registered GPIOs 121 to 135 on device: GPL
NET: Registered protocol family 16
fb frame buffer device
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at d0804000, channels 0..8
PL080: IRQ 74, at d0806000, channels 8..16
S3C6410: Initialising architecture
bio: create slab at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c.0: slave address 0x10
s3c-i2c s3c2440-i2c.0: bus frequency set to 64 KHz
s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
cfg80211: Calling CRDA to update worldregulatory domain
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
start plist test
end plist test
LCD probe
S3C_LCD clock got enabled :: 133.000Mhz(LCD驱动是OK的)
LCD TYPE :: LTE480WV will beinitialized
Window[0] - FB1: map_video_memory:clear ffd80000:0007f800
FB1: map_video_memory: dma=5f900000cpu=ffd80000 size=0007f800
Window[0] - FB2: map_video_memory:clear ffdbfc00:0003fc00
FB2: map_video_memory: dma=5f93fc00cpu=ffdbfc00 size=0003fc00
Console: switching to colour framebuffer device 60x34
fb0: s3cfb frame bufferdevice
Window[1] - FB1: map_video_memory:clear ffd00000:0007f800
FB1: map_video_memory: dma=5f980000cpu=ffd00000 size=0007f800
Window[1] - FB2: map_video_memory:clear ffd3fc00:0003fc00
FB2: map_video_memory: dma=5f9bfc00cpu=ffd3fc00 size=0003fc00
fb1: s3cfb frame bufferdevice
Window[2] - FB1: map_video_memory:clear ffcc0000:0003fc00
FB1: map_video_memory: dma=5fa00000cpu=ffcc0000 size=0003fc00
fb2: s3cfb frame bufferdevice
Window[3] - FB1: map_video_memory:clear ffc80000:0003fc00
FB1: map_video_memory: dma=5fa40000cpu=ffc80000 size=0003fc00
fb3: s3cfb frame bufferdevice
jkq debug VIDCON0 is 353
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is aS3C6400/10
console [ttySAC0] enabled
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is aS3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is aS3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is aS3C6400/10
brd: module loaded
loop: module loaded
at24 0-0050: 1024 byte 24c08 EEPROM, writable, 1 bytes/write
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
dm9000 Ethernet Driver,V1.31(DM9000网卡驱动是OK的)
eth0: dm9000a at d0816000,d0a00004 IRQ108 MAC: 08:90:00:a0:90:90 (platform data)
PPP generic driver version2.4.2
PPP BSD Compression moduleregistered
PPP Deflate Compression moduleregistered
PPP MPPE Compression moduleregistered
NET: Registered protocol family 24
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
usbcore: registered new interface driver rt73usb
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned busnumber 1
s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000
s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
ohci_hcd: can't start s3c24xx
s3c2410-ohci s3c2410-ohci: startup error -75
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -75
mousedev: PS/2 mouse device common for all mice
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
lib80211: common routines for IEEE802.11 drivers
VFP support v0.3: implementor 41 architecture 1 part 20 variantb rev 5
input: gpio-keys as /devices/platform/gpio-keys/input/input0
s3c-rtc s3c64xx-rtc: setting system clock to 2000-07-27 04:53:53UTC (964673633)
VFS: Cannot open root device "mtdblock3" orunknown-block(0,0)
Please append a correct "root=" boot option; here are theavailable partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(0,0)
[] (unwind_backtrace+0x0/0xf8) from [] (panic+0x8c/0x200)
[] (panic+0x8c/0x200) from [] (mount_block_root+0x10c/0x2b0)
[] (mount_block_root+0x10c/0x2b0) from [](prepare_namespace+0x14c/0x1dc)
[] (prepare_namespace+0x14c/0x1dc) from [](kernel_init+0xe8/0x128)
[] (kernel_init+0xe8/0x128) from [](kernel_thread_exit+0x0/0x8)
搭建NFS网络文件系统
- 制作文件系统的工具就是传说中的瑞士军刀busybox在他的官网http://www.busybox.net下载最新的版本为busybox-1.20.0
- 修改busybox的makefile:
CROSS_COMPILE ?= arm-linux-
ARCH ?= arm
- Make menuconfig配置busybox
Busybox Settings --->
Build Options --->
Installation Options ("make install" behavior) --->
Busybox Library Tuning --->
- 编译busybox执行
Make install
这时候会提示一个错误提示说:
miscutils/ubi_tools.c:63:26: error: mtd/ubi-user.h: No such fileor directory
miscutils/ubi_tools.c: In function 'ubi_tools_main':
miscutils/ubi_tools.c:133: error: 'UBI_DEV_NUM_AUTO' undeclared(first use in this function)
miscutils/ubi_tools.c:133: error: (Each undeclared identifier isreported only once
miscutils/ubi_tools.c:133: error: for each function it appearsin.)
miscutils/ubi_tools.c:134: error: 'UBI_VOL_NUM_AUTO' undeclared(first use in this function)
miscutils/ubi_tools.c:153: error: storage size of 'req' isn'tknown
miscutils/ubi_tools.c:161: error: 'UBI_IOCATT' undeclared (firstuse in this function)
miscutils/ubi_tools.c:153: warning: unused variable 'req'
make[1]: *** [miscutils/ubi_tools.o] 错误 1
make: *** [miscutils] 错误 2
出现这么多的错误,核心问题就是出现在miscutils/ubi_tools.c:63:26: error:mtd/ubi-user.h: No such file ordirectory这个上面,无法找到mtd/ubi-user.h头文件,查阅了相关资料后,原来这是一个Linux下新支持的UBI文件系统,需要手工加入。从Linux3.3.5的includemtdubi-user.h拷贝到busybox下的includemtd下,如果busybox下的include没有mtd文件夹,那就先建立一个mtd文件夹,然后复制了。这样做了之后,编译就OK了。出现下面的信息就说明编译成功了。
- 建立根目录,这里我们直接写一个脚本程序运create_rootfs.sh行就可以了,脚本的内容如下:
#!/bin/sh
echo "------Create rootfs directons start...--------"
mkdir rootfs
cd rootfs
echo "--------Create root,dev....----------"
mkdir root dev etc boot tmp var sys proc lib mnt home usr
mkdir etc/init.d etc/rc.d etc/sysconfig
mkdir usr/sbin usr/bin usr/lib usr/modules
echo "make node in dev/console dev/null"
mknod -m 600 dev/console c 5 1
mknod -m 600 dev/null c 1 3
mkdir mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/temp
mkdir var/lib var/lock var/run var/tmp
chmod 777 tmp
chmod 777 var/tmp
echo "-------make direction done---------"运行脚本执行:
./ create_rootfs.sh
ls rootfs
boot dev etc home lib mnt proc root sys tmp usr var
- etc/inittab 系统init进程配置文件,并更改权限chmod +x inittab
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh #没有这就不行,就不能打开console控制台。
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff –a - etc/init.d/rcS系统启动加载项文件,并更改权限chmod+x etc/init.d/rcS
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
mount -a
mkdir /dev/pts
mount -t devpts devpts /dev/pts #用于telnet登录时使用echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
mkdir -p /var/lock
/bin/hostname -F /etc/sysconfig/HOSTNAME - etc/fstab 系统挂载文件系统列表文件
#device mount-point type option dump fsck order
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
mdev /dev ramfs defaults 0 0
none /var ramfs defaults 0 0
none /tmp ramfs defaults 0 0 - etc/profile用户环境配置文件
# Ash profile
# vim: syntax= sh
# No core file by defaults
# ulimit - S - c 0> / dev/ null 2> & 1USER="id -un"
LOGNAME=$USER
PS1="[u@h w]#" #w 目录将显示全路径
PATH=$PATH
HOSTNAME= '/bin/hostname'
alias cls="clear"
export USER LOGNAME PS1 PATH - /etc/passwd shadow 用户文件以及密码
把主机的passwd shadow 文件拷贝到/etc下
# cp /etc/passwd rootfs/etc
# cp /etc/group rootfs/etc
# cp /etc/shadow rootfs/etc - etc/sysconfig/HOSTNAME的内容为你自己的名字即可,内容为"Pillar"
gedit /etc/sysconfig/HOSTNAME 然后键入 Pillar
- 在busybox目录下会看见 _install目录,里面有/bin/sbin l inuxr三个文件
将这三个目录或文件拷到第一步所建的rootfs文件夹下。#cp bin/ sbin/ linuxrc /home/rootfs -ra
在把_install目录的usr里面的bin,sbin也按照刚才的方法拷贝到rootfs目录下
切记一定要带上-a的参数,因为bin目录里大部分都是链接,如果不带-a的参数,拷过去之后会做相应的复制,不再是链接的形式
将交叉编译器下的lib下的库拷贝到lib文件夹下
cp /usr/local/arm/4.2.2-eabi/lib//#ifdef CONFIG_PLAT_S3C24XX
//#endif
//#endif
- 在arch/arm/plat-samsung/include/plat/regs-adc.h的后面添加以下代码:
#define S3C_ADCREG(x) (x)
#define S3C_ADCCON S3C_ADCREG(0x00)
#define S3C_ADCTSC S3C_ADCREG(0x04)
#define S3C_ADCDLY S3C_ADCREG(0x08)
#define S3C_ADCDAT0 S3C_ADCREG(0x0C)
#define S3C_ADCDAT1 S3C_ADCREG(0x10)
#define S3C_ADCUPDN S3C_ADCREG(0x14)
#define S3C_ADCCLRINT S3C_ADCREG(0x18)
#define S3C_ADCMUX S3C_ADCREG(0x1C)
#define S3C_ADCCLRWK S3C_ADCREG(0x20)
#define S3C_ADCCON_RESSEL_10BIT (0x0<<16)
#define S3C_ADCCON_RESSEL_12BIT (0x1<<16)
#define S3C_ADCCON_ECFLG (1<<15)
#define S3C_ADCCON_PRSCEN (1<<14)
#define S3C_ADCCON_PRSCVL(x) (((x)&0xFF)<<6)
#define S3C_ADCCON_PRSCVLMASK (0xFF<<6)
#define S3C_ADCCON_SELMUX(x) (((x)&0x7)<<3)
#define S3C_ADCCON_SELMUX_1(x) (((x)&0xF)<<0)
#define S3C_ADCCON_MUXMASK (0x7<<3)
#define S3C_ADCCON_RESSEL_10BIT_1 (0x0<<3)
#define S3C_ADCCON_RESSEL_12BIT_1 (0x1<<3)
#define S3C_ADCCON_STDBM (1<<2)
#define S3C_ADCCON_READ_START (1<<1)
#define S3C_ADCCON_ENABLE_START (1<<0)
#define S3C_ADCCON_STARTMASK (0x3<<0)
#define S3C_ADCTSC_UD_SEN (1<<8)
#define S3C_ADCTSC_YM_SEN (1<<7)
#define S3C_ADCTSC_YP_SEN (1<<6)
#define S3C_ADCTSC_XM_SEN (1<<5)
#define S3C_ADCTSC_XP_SEN (1<<4)
#define S3C_ADCTSC_PULL_UP_DISABLE (1<<3)
#define S3C_ADCTSC_AUTO_PST (1<<2)
#define S3C_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
#define S3C_ADCDAT0_UPDOWN (1<<15)
#define S3C_ADCDAT0_AUTO_PST (1<<14)
#define S3C_ADCDAT0_XY_PST (0x3<<12)
#define S3C_ADCDAT0_XPDATA_MASK (0x03FF)
#define S3C_ADCDAT0_XPDATA_MASK_12BIT (0x0FFF)
#define S3C_ADCDAT1_UPDOWN (1<<15)
#define S3C_ADCDAT1_AUTO_PST (1<<14)
#define S3C_ADCDAT1_XY_PST (0x3<<12)
#define S3C_ADCDAT1_YPDATA_MASK (0x03FF)
#define S3C_ADCDAT1_YPDATA_MASK_12BIT (0x0FFF)
#endif
- 配置内核:
System Type --->
[*] ADC common driver support
Device Drivers --->
Input device support --->
[*] Touchscreens --->
<*> S3C touchscreen driver(只选这一个,其他的不要选)
<*> Event interface
- 如果触摸屏驱动没有问题的会就会出现以下驱动信息:
S3C Touchscreen driver, (c) 2008 Samsung Electronics
S3C TouchScreen got loadedsuccessfully : 12 bits
input: S3C TouchScreen as/devices/virtual/input/input0
移植Qt4.8.1
tslib移植及测试
在采用触摸屏的移动终端中,触摸屏性能的调试是个重要问题之一,因为电磁噪声的缘故,触摸屏容易存在点击不准确、有抖动等问题。
Tslib是一个开源的程序,能够为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能,通常作为触摸屏驱动的适配层,为上层的应用提供了一个统一的接口。
- 在https://github.com/kergoth/tslib下载了最新的tslib
- 为虚拟机里的Linux系统安装工具:
sudoapt-get install autoconf
sudoapt-get install automake
sudoapt-get install libtool
- 解压后编译
mv xxx(解压后名字) tslib //名字改为tslib
cdtslib
./autogen.sh
mkdirtmp
echo"ac_cv_func_malloc_0_nonnull=yes">arm-linux.cache
./configure--host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/tmp
make
makeinstall
- 打开tmp目录,里面有四个文件夹,分别是bin、etc、include、lib。将etc目录下的ts.conf里的第2行去掉注释。即:
# module_rawinput
改为:
module_rawinput
- 将bin/etc/lib目录下的文件及连接拷贝到文件系统下对应同名目录。include目录估计是编译应用程序时用的,在此可以不使用
- 在文件系统的/etc/profile后面添加以下环节变量:
export USER LOGNAME PS1PATH
exportTSLIB_TSDEVICE=/dev/event0
exportTSLIB_CALIBFILE=/etc/pointercal
exportTSLIB_CONFFILE=/etc/ts.conf
exportTSLIB_PLUGINDIR=/lib/ts
exportTSLIB_CONSOLEDEVICE=none
exportTSLIB_FBDEVICE=/dev/fb0
- 重启开发板执行env命令,查看是否有以下环境变量:
TSLIB_TSDEVICE=/dev/event0
USER=id -un
HOME=/
TSLIB_FBDEVICE=/dev/fb0
PS1=[u@h w]#
TSLIB_PLUGINDIR=/lib/ts
TSLIB_CONSOLEDEVICE=none
LOGNAME=id -un
TERM=vt102
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TSLIB_CONFFILE=/etc/ts.conf
SHELL=/bin/sh
PWD=/
TSLIB_CALIBFILE=/etc/pointercal
这个TSLIB_TSDEVICE=/dev/event0环境变量所指的位置很重要,错了就会出现
ts_open:ts_open no such file or directory这样的错误
- 执行ts_test命令,就会出现以下画面:
如果出现-/bin/sh: ts_test: notfound这样的错误,说明交叉编译器里面的库没有拷贝进来,对于交叉编译器4.3.2是arm-none-linux-gnueabi/libc/lib
执行ts_calibrate命令就会出现以下画面:
移植qt-everywhere-opensource-src-4.8.1
- 解压qt-everywhere-opensource-src-4.8.1,在解压目录下我们自己先写一个autu.sh的脚本,脚本内容如下:
./configure -prefix/usr/local/Qt
> -no-qt3support
> -qt-zlib
> -qt-libtiff
> -qt-libpng
> -qt-libmng
> -qt-libjpeg
> -make libs
> -nomake examples (因为这个是arm版本,所以编译出来的程序只能在arm开发板上运行,编译时把这些给去掉,加快编译过程)
> -nomake demos
> -nomake docs
> -no-nis
> -no-cups
> -no-iconv
> -xplatform qws/linux-arm-g++
> -embedded arm
> -little-endian
> -qt-freetype
> -depths 8,16,24,32
> -qt-gfx-linuxfb
> -no-gfx-transformed
> -no-gfx-qvfb
> -no-gfx-vnc
> -no-gfx-multiscreen
> -qt-kbd-usb
> -qt-kbd-tty
> -qt-mouse-pc
> -no-glib
> -qt-mouse-tslib
-I /usr/local/Tslib/include
-L /usr/local/tslib/lib
make
make install
至于这些选项的含义搭建可以直接到Qt官网上去查。
如果最后出现这个错误:
./autoconfig.sh: 行 37: -I/usr/local/tslib/include:没有那个文件或目录最后直接用
export QMAKE_INCDIR=/usr/local/tslib/include/
export QMAKE_LIBDIR=/usr/local/tslib/lib/
这样的设置经验证好像只有在arm-linux-gcc-4.4.1的版本中可行
- 在rootfs/usr/下新建一个文件为qtlib,将/usr/local/Qt/lib下的所有文件复制到qtlib目录下
- 设置环境变量:将rootfs/etc/profile里面添加一下环境变量:
export QTDIR=/usr/qilib
export QPEDIR=$QTDIR
export QT_PLUGIN_PATH=/usr/qilib
export T_ROOT=/usr/tslib
export PATH=$QTDIR/:$PATH
export QWS_MOUSE_PROTO=Tslib:/dev/event0
export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR
export QT_QWS_FONTDIR=/usr/qilib/fonts
- 修改启动设置,修改rootfs/etc/init.d/rcS,添加一下内容:
source /etc/profile
echo "" > /dev/tty1
echo "" > /dev/tty1
echo "Designer is Pillar !" > /dev/tty1
echo "Staring touch calibrate..." > /dev/tty1
echo "" > /etc/tty1
sleep 1
/bin/ts_calibrate & #开机运行ts_calibrate
到这里qt-everywhere-opensource-src-4.8.1就移植完了
嵌入式Qt开发环境搭建
- 下载Qt集成开发环境
http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp-offline
执行一下命令安装:
chmod u+x Qt_SDK_Lin32_offline_v1_2_en.run
./Qt_SDK_Lin32_offline_v1_2_en.run
配置集成
- 开发环境
新建工程,然后:
最后可以用file 命令查看文件属性
将文件拷贝到rootfs目录下:
执行:./books
就可以运行。
- 修改启动文件让开机就运行改文件,在rootf/etc/init.d/rcS文件中添加以下内容:
if [ -f "$TSLIB_CALIBFILE" ];
then
books -qws&
else
ts_calibrate
- 运行应用程序常见文件及错误分析:
- Cannot create semaphore/tmp/qtembedded-root/QtEmbedded-0
这是说明系统禁止了锁,可以在内核配置的第一个 generated配置里面找到:
[*] System V IPC
选上它,重新编译,再次烧入内核
- Illegal instruction
库添加错误,一定要正确的添加交叉编译器的库和qt-everywhere-opensource-src-4.8.1编译生成的库
- Segmentation fault
编译应用程序的编译器不对,推荐从内核到文件系统都用同一个交叉编译器,经验证
arm-linux-gcc-4.4.1这个编译器稳定性不错
这两天就搞了和Qt相关的这些事,错不多所有的的东西都是在5天的时间内搞定的,今天早上是6点钟起来写文档,不知道什么时候,我自己变得这么疯狂。
还有很多问题没有解决:
- 本来想搞个opia的,比如QtExtended,其实就是Qtopia.我搞的时候才发现:
Qt Extended是由Nokia的子公司QtSoftware(前称Trolltech)所开发。2009年3月3日,Qt Software宣布QtExtended不再继续作为独立产品而开发,部份功能整合进QtFramework。别人都终止了,所以就不提供源码了,网上有很多源码可以都可以下载,但是大多数都是别人改过的。飞凌的提供的源码也被他改的乱七八糟,我死都编译不过去,既然连源码都找不到,我移植就没有办法下手了。
- 还有一个交叉编译器的库的问题。仔细一点你会发现我用的arm-linux-gcc-4.4.1里面有好的的lib还有好的名字是重复的。大家可以看看这篇文章对交叉编译器的理解http://wenku.baidu.com/view/45f3b6f29e31433239689382.html
- Cannot create semaphore/tmp/qtembedded-root/QtEmbedded-0