qt-4.5 移植篇章
说明:移植qt4.5时,使用的环境配置
开发板:TQ2440 256MB nandflash 64MB sdram 东华3.5寸屏
uboot:TQ_W35 东华2009 年的uboot
内核:2440+2.6.33 UDA声卡移植(九) 移植后,继续的内核
文件系统:使用自己保存的 root-2.6.33-final.tar.bz2
最原始的文件系统镜像root-2.6.33-final.bin 9.4MB
1.QT4.5的环境建立
3.这里简单介绍建立好 qt 开发环境后使用的方法:
比如说编译tq提供的 hello_cn 这个应用程序 ,这里加上 三个源码附件hello_cn.rar
 hello_cn.rar
 hello_cn.rar   - 我删除了tq提供的/hello_cn/目录下其他的文件,只留下了下面三个文件
- ywx@yuweixian:~/yu/qt/hello_cn$ ls
- 
hello_cn.cpp  hello_cn.h  main.cpp
- ywx@yuweixian:~/yu/qt/hello_cn$
将 qmake 文件指向 arm 架构
ywx@yuweixian:~/yu/qt/hello_cn$ source /usr/local/Trolltech/QtEmbedded-4.5.3-arm/setenv.sh
ywx@yuweixian:~/yu/qt/hello_cn$
编译 源文件
ywx@yuweixian:~/yu/qt/hello_cn$ qmake -project 编译生成 工程文件
ywx@yuweixian:~/yu/qt/hello_cn$ qmake 编译生成 Makefile
ywx@yuweixian:~/yu/qt/hello_cn$ make 编译文件 Makefile
参看生成文件,其中hello_cn 就是我们需要的 二进制应用程序文件
ywx@yuweixian:~/yu/qt/hello_cn$ ls
hello_cn hello_cn.h hello_cn.pro main.o moc_hello_cn.cpp
hello_cn.cpp hello_cn.o main.cpp Makefile moc_hello_cn.o
ywx@yuweixian:~/yu/qt/hello_cn$
当让,我们也可以使用 qt creator 实现上面一样的功能,具体参考 qt-4.5 篇章中的qt creator 使用部分
2.qt4.5 文件系统的制作
1.在文件系统 opt/新建目录 qt-4.5 目录
2.复制 4.5.3-arm/lib 目录到 文件系统 qt-4.5/下,删除掉出“fonts”和*.so* 文件外其他的文件
- ywx@yuweixian:/usr/local/Trolltech/QtEmbedded-4.5.3-arm$ ls
- 
bin    examples  lib      plugins               setenv.sh
- 
demos  include   mkspecs  qtc-debugging-helper
- ywx@yuweixian:/usr/local/Trolltech/QtEmbedded-4.5.3-arm$
3.1 使用 arm-linux-readelf -d hello_cn 查看动态链接库
所以我只复制了 下面三个 qt 库
- ywx@yuweixian:~/yu/qt/hello_cn$ arm-linux-readelf -d hello_cn
- 
- 
Dynamic section at offset 0x2b0c contains 34 entries:
- 
  Tag        Type                         Name/Value
- 
 0x00000001 (NEEDED)                     Shared library: [libQtGui.so.4]
- 
 0x00000001 (NEEDED)                     Shared library: [libQtNetwork.so.4]
- 
 0x00000001 (NEEDED)                     Shared library: [libQtCore.so.4]   ###这三个是 qt库,
- 
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]       ### 下面的都是 busybox 中生成库
- 
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
- 
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
- 
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
- 
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
- 
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
- 
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
- 
 0x0000000f (RPATH)                      Library rpath: [/usr/local/Trolltech/QtEmbedded-4.5.0-arm/lib]
- 
 0x0000000c (INIT)                       0x9d50
- 
 0x0000000d (FINI)                       0xa80c
- 
 0x00000019 (INIT_ARRAY)                 0x12b00
- 
 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
- 
 0x0000001a (FINI_ARRAY)                 0x12b04
- 
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
- 
 0x00000004 (HASH)                       0x8168
- 
 0x00000005 (STRTAB)                     0x8c50
- 
 0x00000006 (SYMTAB)                     0x85f0
- 
 0x0000000a (STRSZ)                      3315 (bytes)
- 
 0x0000000b (SYMENT)                     16 (bytes)
- 
 0x00000015 (DEBUG)                      0x0
- 
 0x00000003 (PLTGOT)                     0x12c44
- 
 0x00000002 (PLTRELSZ)                   672 (bytes)
- 
 0x00000014 (PLTREL)                     REL
- 
 0x00000017 (JMPREL)                     0x9ab0
- 
 0x00000011 (REL)                        0x9a80
- 
 0x00000012 (RELSZ)                      48 (bytes)
- 
 0x00000013 (RELENT)                     8 (bytes)
- 
 0x6ffffffe (VERNEED)                    0x9a10
- 
 0x6fffffff (VERNEEDNUM)                 3
- 
 0x6ffffff0 (VERSYM)                     0x9944
- 
 0x00000000 (NULL)                       0x0
- ywx@yuweixian:~/yu/qt/hello_cn$
3.2 复制上面提到的 qt 动态链接库 到文件系统 qt-4.5/lib/下
- fonts               libQtGui.so        libQtNetwork.so.4
- 
libQtCore.so        libQtGui.so.4      libQtNetwork.so.4.5
- 
libQtCore.so.4      libQtGui.so.4.5    libQtNetwork.so.4.5.3
- 
libQtCore.so.4.5    libQtGui.so.4.5.3
- libQtCore.so.4.5.3 libQtNetwork.so
4.复制 -arm/plugins/imageformates 文件到 文件系统/opt/qt-4.5/plugins/
- ywx@yuweixian:/usr/local/Trolltech/QtEmbedded-4.5.3-arm/plugins$ ls
- 
accessible  iconengines  imageformats  sqldrivers
- ywx@yuweixian:/usr/local/Trolltech/QtEmbedded-4.5.3-arm/plugins$
5.建立 opt/qt-4.5/bin 目录
在bin 目录中加入我们上面制作的二进制应用程序 hell0_cn
6.修改文件系统的/etc/profiel 文件, 为了单独运行QT程序
- # Ash profile 
- 
# vim: syntax=sh
- 
- 
# No core files by default
- 
#ulimit -S -c 0 > /dev/null 2>&1
- 
- 
###################################### qt 添加开始
- 
export set HOME=/root
- 
export set QTDIR=/opt/qt-4.5
- 
export set QPEDIR=/opt/qt-4.5
- 
export set QWS_DISPLAY="LinuxFB:/dev/fb0"
- 
export set QWS_DISPLAY="LinuxFB:mmWidth130:mmHeight100:0"   注意这里没有空格 哟
- 
export set QWS_KEYBOARD="TTY:/dev/tty1"
- 
- 
export set QT_PLUGIN_PATH=$QTDIR/plugins/
- 
export set QT_QWS_FONTDIR=$QTDIR/lib/fonts
- 
export set PATH=$QPEDIR/bin:$PATH
- 
export set LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/plugins/imageformats:$LD_LIBRARY_PATH
- 
- 
####################################### qt 添加结束
- 
- 
- 
USER="`id -un`"
- 
LOGNAME=$USER
- 
PS1='[\u@\h \W]# '
- 
PATH=$PATH
- 
- 
HOSTNAME=`/bin/hostname`
- 
- export USER LOGNAME PS1 PATH
7.在/bin/建立 qt4 执行文件
- #!/bin/sh
- 
- 
echo Start qt-4.5 > /dev/ywx_serial0
- 
- 
export set HOME=/root
- 
export set QTDIR=/opt/qt-4.5
- 
export set QPEDIR=/opt/qt-4.5
- 
export set QWS_DISPLAY="LinuxFB:/dev/fb0"
- 
export set QWS_DISPLAY="LinuxFB:mmWidth130:mmHeight100:0"
- 
export set QWS_KEYBOARD="TTY:/dev/tty1"
- 
- 
export set QT_PLUGIN_PATH=$QTDIR/plugins/
- 
export set QT_QWS_FONTDIR=$QTDIR/lib/fonts
- 
export set PATH=$QPEDIR/bin:$PATH
- 
export set LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/plugins/imageformats:$LD_LIBRARY_PATH
- 
- $QPEDIR/bin/hello_cn -qws 1>/dev/null 2>/dev/null
8.加入自动启动项 gedit /etc/init.d/rcS
- ifconfig lo 127.0.0.1
- 
net_set&
- 
- 
qt4 &   加入 qt4 自动启动
- 
- /bin/hostname -F /etc/sysconfig/HOSTNAME
9.好了,这样就可以了
mkyaffs2image root-2.6.33-final root-2.6.33-fianl.bin
.bin 文件有 30 MB
注意:生成的bin 文件太大,会出错 ,下都下不进开发板,自己遇到了这个问题
10.启动,详细信息
- ##### EmbedSky BIOS for SKY2440/TQ2440 #####
- 
Press Space key to Download Mode !
- 
Booting Linux ...
- 
Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00200000 ... Copy Kernel to SDRAM done,NOW, Booting Linux......
- 
Uncompressing Linux... done, booting the kernel.
- 
Linux version 2.6.33-yuweixian (root@yuweixian) (gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50) ) #18 Mon Apr 11 10:50:44 CST 2011
- 
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
- 
CPU: VIVT data cache, VIVT instruction cache
- 
Machine: SMDK2440
- 
ATAG_INITRD is deprecated; please update your bootloader.
- 
Memory policy: ECC disabled, Data cache writeback
- 
CPU S3C2440A (id 0x32440001)
- 
S3C24XX Clocks, Copyright 2004 Simtec Electronics
- 
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
- 
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
- 
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
- 
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
- 
PID hash table entries: 256 (order: -2, 1024 bytes)
- 
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
- 
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
- 
Memory: 64MB = 64MB total
- 
Memory: 60864KB available (3372K code, 312K data, 196K init, 0K highmem)
- 
Hierarchical RCU implementation.
- 
NR_IRQS:85
- 
irq: clearing pending ext status 00080000
- 
irq: clearing subpending status 00000002
- 
Console: colour dummy device 80x30
- 
console [ttySAC0] enabled
- 
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
- 
Mount-cache hash table entries: 512
- 
CPU: Testing write buffer coherency: ok
- 
NET: Registered protocol family 16
- 
S3C Power Management, Copyright 2004 Simtec Electronics
- 
S3C2440: Initialising architecture
- 
S3C2440: IRQ Support
- 
S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics
- 
DMA channel 0 at c4808000, irq 33
- 
DMA channel 1 at c4808040, irq 34
- 
DMA channel 2 at c4808080, irq 35
- 
DMA channel 3 at c48080c0, irq 36
- 
S3C244X: Clock Support, DVS off
- 
bio: create slab <bio-0> at 0
- 
SCSI subsystem initialized
- 
usbcore: registered new interface driver usbfs
- 
usbcore: registered new interface driver hub
- 
usbcore: registered new device driver usb
- 
s3c-i2c s3c2440-i2c: slave address 0x10
- 
s3c-i2c s3c2440-i2c: bus frequency set to 97 KHz
- 
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
- 
Advanced Linux Sound Architecture Driver Version 1.0.21.
- 
NET: Registered protocol family 2
- 
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
- 
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
- 
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
- 
TCP: Hash tables configured (established 2048 bind 2048)
- 
TCP reno registered
- 
UDP hash table entries: 256 (order: 0, 4096 bytes)
- 
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
- 
NET: Registered protocol family 1
- 
RPC: Registered udp transport module.
- 
RPC: Registered tcp transport module.
- 
RPC: Registered tcp NFSv4.1 backchannel transport module.
- 
NetWinder Floating Point Emulator V0.97 (extended precision)
- 
ROMFS MTD (C) 2007 Red Hat, Inc.
- 
yaffs Apr  5 2011 12:09:55 Installing. 
- 
msgmni has been set to 119
- 
io scheduler noop registered
- 
io scheduler deadline registered
- 
io scheduler cfq registered (default)
- 
Console: switching to colour frame buffer device 40x30
- 
fb0: s3c2410fb frame buffer device
- 
lp: driver loaded but no devices found
- 
ppdev: user-space parallel port driver
- 
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
- 
s3c2440-uart.0: ywx-serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
- 
s3c2440-uart.1: ywx-serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
- 
s3c2440-uart.2: ywx-serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
- 
brd: module loaded
- 
loop: module loaded
- 
Uniform Multi-Platform E-IDE driver
- 
ide-gd driver 1.18
- 
ide-cd driver 5.00
- 
st: Version 20081215, fixed bufsize 32768, s/g segs 256
- 
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
- 
s3c24xx-nand s3c2440-nand: Tacls=2, 20ns Twrph0=6 60ns, Twrph1=2 20ns
- 
s3c24xx-nand s3c2440-nand: NAND hardware ECC
- 
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
- 
Scanning device for bad blocks
- 
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
- 
0x000000000000-0x000000040000 : "ywx-boot"
- 
0x000000200000-0x000000400000 : "ywx-kernel"
- 
0x000000400000-0x00000ff80000 : "ywx-yaffs2"
- 
dm9000 Ethernet Driver, V1.31
- 
Now use the default MAC address: 10:23:45:67:89:ab
- 
eth0: dm9000e at c481c000,c4820004 IRQ 51 MAC: 10:23:45:67:89:ab (yuweixian-MAC)
- 
usbmon: debugfs is not available
- 
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 bus number 1
- 
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
- 
hub 1-0:1.0: USB hub found
- 
hub 1-0:1.0: 2 ports detected
- 
Initializing USB Mass Storage driver...
- 
usbcore: registered new interface driver usb-storage
- 
USB Mass Storage support registered.
- 
usbcore: registered new interface driver libusual
- 
usbcore: registered new interface driver usbserial
- 
USB Serial support registered for generic
- 
usbcore: registered new interface driver usbserial_generic
- 
usbserial: USB Serial Driver core
- 
USB Serial support registered for FTDI USB Serial Device
- 
usbcore: registered new interface driver ftdi_sio
- 
ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver
- 
USB 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
- 
TQ2440 TouchScreen successfully loaded
- 
input: TQ2440 TouchScreen as /class/input/input0
- 
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
- 
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
- 
s3c-sdi s3c2440-sdi: host detect has no irq available
- 
s3c-sdi s3c2440-sdi: failed to get writeprotect
- 
s3c-sdi: probe of s3c2440-sdi failed with error -16
- 
No device for DAI UDA134X
- 
No device for DAI s3c24xx-i2s
- 
S3C24XX_UDA134X SoC Audio driver
- 
UDA134X SoC Audio Codec
- 
asoc: UDA134X <-> s3c24xx-i2s mapping ok
- 
ALSA device list:
- 
  #0: S3C24XX_UDA134X (UDA134X)
- 
TCP cubic registered
- 
NET: Registered protocol family 17
- 
end_request: I/O error, dev mtdblock2, sector 256
- 
isofs_fill_super: bread failed, dev=mtdblock2, iso_blknum=64, block=128
- 
yaffs: dev is 32505858 name is "mtdblock2"
- 
yaffs: passed flags ""
- 
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
- 
yaffs: auto selecting yaffs2
- 
yaffs_read_super: isCheckpointed 0
- 
VFS: Mounted root (yaffs filesystem) on device 31:2.
- 
Freeing init memory: 196K
- 
Try to bring eth0 interface up ...
- 
- 
Please press Enter to activate this console. ifconfig eth0 hw ether 10:23:45:67:89:ab
- 
eth0: link down
- 
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
- 
add default gw 192.168.1.2
- 
Done
- 
- [root@yuweixian /]#
