[问题]gtk窗口中调用 mplayer 如何实现
时间:2010-09-03
来源:互联网
代码:
. openjtag配置
一、编译usb库
tar jxf libftd2xx0.4.16.tar.bz2
cd libftd2xx0.4.16/
cp libftd2xx.so.0.4.16 /lib
ln -s /lib/libftd2xx.so.0.4.16 /lib/libftd2xx.so //编译openocd时需要
ln -s /lib/libftd2xx.so.0.4.16 /lib/libftd2xx.so.0 //执行openocd时需要
cd libusb-0.1.12
./configure
make
make install
二、编译openocd
tar jxf openocd-0.3.1.tar.bz2
cd openocd-0.3.1
./configure --enable-parport --enable-parport_ppdev --enable-ft2232_ftd2xx --enable-usbprog --enable-jlink --with-ftd2xx-linux-tardir=`pwd`/../libftd2xx0.4.16
make //编译会出错,链接时没有加 -lftd2xx,可以到src目录下手动链接
cd src
//note: change "/xxx/openjtag-0.3.1/" to your work path
gcc -std=gnu99 -g -O2 -I/openjtag/libftd2xx0.4.16 -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -o openocd main.o /openjtag/libftd2xx0.4.16/static_lib/libftd2xx.a.0.4.16 ./.libs/libopenocd.a -lusb -ldl -lpthread -lftd2xx
cd ..
make install
二、配置USB
cd ..
cp 50-ftdi.rules /etc/udev/rules.d/
插入openjtag后会有/dev/ttyUSB0和/dev/ttyUSB1两个设备文件
三、使用openocd
openocd (当前目录下要有openocd.cfg文件)
cp openocd.cfg /tftpboot
cd /tftpboot
openocd -f <openocd.cfg目录>/openocd.cfg
openocd不能直接使用,需要telnet连接使用
telnet 127.0.0.1 4444
127.0.0.1是启用openocd的主机ip,4444是openocd的端口号(在openocd.cfg里配置),可以远程调试
reset
重启cpu
halt
停止cpu,操作时必须先停止cpu
nand probe 0
探测flash,操作flash时必须先探测,0 表示第一个flash
nand dump 0 /tftpboot/dump.bin 0 2048
读第一个flash的 第0 -2048个字节保存在/tftpboot/dump.bin,起始地址和结束地址必须是页大小的倍数
nand erase 0 0 0x20000
擦除第一个flash的第0 -0x20000个字节,起始地址和结束地址必须是块大小的倍数
nand write 0 /tftpboot/write.bin 0
把/tftpboot/write.bin写到第一个flash的第0个字节,大小为文件的大小,起始地址必须是页大小的倍数
必须先擦除flash再写,这是flash的特性
擦除完后第一次写没有写进去,第二次就可以了,dump一下再写也可以写进去,这是openocd的BUG
注: 现在开发板上flash的型号是K9F2G08UOA,页大小是 2048字节,64个页为一个块,块大小是 0x20000字节(128K)
openjtag配置
. 交叉编译器
. 安装
mkdir -p /usr/local/arm
tar xjvf gcc-4.3.2.tar.bz2 -C /usr/local/arm/
. 修改环境变量
修改~/.bashrc
添加
export PATH=$PATH:/usr/local/arm/4.3.2/bin
也可以修改/etc/profile
并执行 . ~/.bashrc
. bootloader
. 编译:
修改配置, vim include/configs/qt2440.h
#make clean
#make distclean
#make qt2440_config
#make
du -sh u-boot.bin (> 237K)
. 烧写bootloader到nandflash
<shell 1>
#cd /tftpboot (下面有对应的openjtag.cfg)
#openocd
<shell 2>
#telnet localhost 4444
openocd>reset;halt
openocd>arm920t cp15 2 0
openocd>step
openocd>nand probe 0
openocd>nand erase 0 0 0x100000
openocd>nand dump 0 /tftpboot/2048.nand 0 2048
root>vim /tftpboot/2048.nand
:%!xxd (看hex)
如果为全"1",或全"0"则正确
如果不成功,
reset;halt
nand erase 0 0 0x100000
nand dump 0 /tmp/2048.nand 0 2048
如果为全"1",或全"0"则正确
openocd>nand write 0 /tftpboot/u-boot.bin 0
openocd>nand dump 0 /tftpboot/2048.nand 0 2048
root>vim /tftpboot/2048.nand
:%!xxd (看hex)
如果为其他不一样的数字,则证明u-boot已经烧进nand flash
openocd>reset
. minicom
切换到minicom窗口,如果minicom窗口无输出,
ls -l /dev/tty*
看一下你的minicom端口对了么?
openocd>minicom -s配置
u-boot#进入bootloader
. 安装tftp服务器:
apt-get --force-yes -y install tftpd-hpa tftp-hpa xinetd
mkdir /tftpboot
chmod 777 /tftpboot
把下面的代码复制到vim /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
wait = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
log_on_success = PID HOST DURATION
log_on_failure = HOST
}
sudo /etc/init.d/xinetd restart
sudo /etc/init.d/tftpd-hpa restart
测试:
touch /tftpboot/aaa
tftp 10.1.0.248(自己的IP)
get aaa 如果没有任何错误,然后按q退出看当前目录下有没有aaa文件,如果有证明tftp服务配置成功
------------------------------------------------
vim /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"
-------------------------------------------------
. kernel
将u-boot/tools/mkimage 拷贝到/usr/local/bin(你PATH中有的目录)
cd 到内核源码目录(kernel/qt2440-2.6.13)
cp qt2440_config .config
vim Makefile
看CROSS_COMPILE=/usr/local/arm/3.4.1/bin/arm-linux-
make menuconfig
make bzImage
...
生成内核镜像在arch/arm/boot
cd arch/arm/boot
//使用mkimage来将linux的zImage转换成uboot能识别的image文件
#./mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008040 -n "linux kernel" -d ./zImage uImage
#cp uImage /tftpboot
//此时执行bootm 30008000启动将失败,是因为没有文件系统导致无法加载启动文件的缘故。
. nfs
#apt-get --force-yes -y install nfs-kernel-server nfs-client nfs-common portmap
配置:
$ mkdir -p /nfs_rootfs
$ sudo chmod 755 /nfs_rootfs -R
$ sudo vi /etc/exports
------------------------------------
/nfs_rootfs *(rw,sync,no_root_squash)
------------------------------------
/etc/init.d/portmap start
/etc/init.d/nfs-kernel-server restart
Note:在开发板ping一下,如果没有通,关闭防火墙
. 搭建根文件系统
------------- make the file system image ----------
//total = bs * count
1. dd if=/dev/zero of=<image file name> bs=<block size> count=<number>
//insert the file into the loopback device
2. losetup /dev/loop<N> <image file name>
//format the block device
3. mkfs.<file system format> /dev/loop<N>
//detach the image file from the loopback device
4. losetup -d /dev/loop<N>
-------------- build the file system bin tools (busybox) ------------
//choice the link type: static link or dymanic link
1. Build Options ---> Build BusyBox as a satic library.......
// configure the compiler prefix
2. Build Options ---> Do you want to build .......
// configure Installation floder
3. Installoation Options --> busybox installation prefix
// choice init process
4. Init Uitilies ---> init
// choice the shell
5. Shells ---> Choose ...... ---> ash
// build
6. make
// install
7. make install
-------------- copy the busybox into the image file -------
1. mount -o loop <image file name> <mount floder>
2. cp -rf <busybox install floder> <mount floder>
3. cd <mount floder>
4. mkdir dev proc sys
5. mknod dev/console c 5 1
6. mknod dev/null c 1 3
## if the busybox linked as dynamic linker
cp -rf <complier installation floder>/arm-linux/lib/* lib/
7. umount <mount floder>
. 解压根文件系统到/nfs_rootfs
. 将文件系统放在硬盘(flash)上
========================================================================
--------------------- A. boot from nand flash -----------------
1. nand erase <part start addr> <part size>
2. tftp 30000000 <image file name>
3. nand write 30000000 <part start addr> <part size>
## configure command line tag for kernel booting
4. setenv bootargs noinitrd mem=64M console=ttySAC0 root=/dev/mtdblock/2
saveenv
## download the kernel image and boot it
5. tftp 30008000 uImage
bootm 30008000
----------- done--------
-------------------- B. boot from init ram disk----------------------
1. tftp <ram disk start addr> <image file name>
2. setenv bootargs initrd=<ram disk start addr>,<size> mem=64M console=ttySAC0
root=/dev/ram0
saveenv
## download the kernel image and boot it
3. tftp 30008000 uImage
bootm 30008000
------------ done -------
------------------- C. boot from network file system (nfs) -------
## configure the nfs service of your host
1. ##edit the /etc/exports and append the following:
<shared root file system> *(rw)
##restart the nfs service
/etc/rc.d/init.d/nfs restart
## copy the busybox into the nfs service root dir
2. cp -rf <busybox install floder> <nfs service root floder>
cd <nfs service root floder>
mkdir dev proc sys
mknod dev/console c 5 1
mknod dev/null c 1 3
## if the busybox linked as dynamic linker
cp -rf <complier installation floder>/arm-linux/lib/* lib/
## setup the command line tags on the development board
3. setenv bootargs noinitrd console=ttySAC0,115200 mem=64M root=/dev/nfs
nfsroot=192.168.0.3:/<nfs service root floder>
ip=192.168.0.2:192.168.0.3:192.168.0.3:255.255.255.0::eth0:off
## download the kernel image and boot it
3. tftp 30008000 uImage
bootm 30008000
------------ done -------
. 2种开发模式
一、烧写到nandflash上
kernel:
1.tftp 30000000 uImage
2.nand erase 100000 220000
3.nand write 30000000 100000 220000
4.setenv bootcmd nand read 0x30008000 0x100000 0x220000;bootm 30008000
fs:
1. nand erase 400000 fc00000
2. nfs
3. mount -t yaffs /dev/mtdblock2 /mnt
4. tar xjvf nfsroot-29.tar.bz2
5. mv nfsroot-29/* /mnt
reboot
setenv bootargs noinitrd mem=64M console=ttySAC0 root=/dev/mtdblock2
saveenv
二、网络开发模式
setenv bootcmd tftp 30008000 uImage\; bootm\;
setenv bootargs noinitrd console=ttySAC0,115200 mem=64M root=/dev/nfs nfsroot=192.168.0.3:/nfs_rootfs/nfsroot-29 ip=192.168.0.7:192.168.0.3:192.168.0.1:255.255.255.0::eth0:off
saveenv
一、编译usb库
tar jxf libftd2xx0.4.16.tar.bz2
cd libftd2xx0.4.16/
cp libftd2xx.so.0.4.16 /lib
ln -s /lib/libftd2xx.so.0.4.16 /lib/libftd2xx.so //编译openocd时需要
ln -s /lib/libftd2xx.so.0.4.16 /lib/libftd2xx.so.0 //执行openocd时需要
cd libusb-0.1.12
./configure
make
make install
二、编译openocd
tar jxf openocd-0.3.1.tar.bz2
cd openocd-0.3.1
./configure --enable-parport --enable-parport_ppdev --enable-ft2232_ftd2xx --enable-usbprog --enable-jlink --with-ftd2xx-linux-tardir=`pwd`/../libftd2xx0.4.16
make //编译会出错,链接时没有加 -lftd2xx,可以到src目录下手动链接
cd src
//note: change "/xxx/openjtag-0.3.1/" to your work path
gcc -std=gnu99 -g -O2 -I/openjtag/libftd2xx0.4.16 -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -o openocd main.o /openjtag/libftd2xx0.4.16/static_lib/libftd2xx.a.0.4.16 ./.libs/libopenocd.a -lusb -ldl -lpthread -lftd2xx
cd ..
make install
二、配置USB
cd ..
cp 50-ftdi.rules /etc/udev/rules.d/
插入openjtag后会有/dev/ttyUSB0和/dev/ttyUSB1两个设备文件
三、使用openocd
openocd (当前目录下要有openocd.cfg文件)
cp openocd.cfg /tftpboot
cd /tftpboot
openocd -f <openocd.cfg目录>/openocd.cfg
openocd不能直接使用,需要telnet连接使用
telnet 127.0.0.1 4444
127.0.0.1是启用openocd的主机ip,4444是openocd的端口号(在openocd.cfg里配置),可以远程调试
reset
重启cpu
halt
停止cpu,操作时必须先停止cpu
nand probe 0
探测flash,操作flash时必须先探测,0 表示第一个flash
nand dump 0 /tftpboot/dump.bin 0 2048
读第一个flash的 第0 -2048个字节保存在/tftpboot/dump.bin,起始地址和结束地址必须是页大小的倍数
nand erase 0 0 0x20000
擦除第一个flash的第0 -0x20000个字节,起始地址和结束地址必须是块大小的倍数
nand write 0 /tftpboot/write.bin 0
把/tftpboot/write.bin写到第一个flash的第0个字节,大小为文件的大小,起始地址必须是页大小的倍数
必须先擦除flash再写,这是flash的特性
擦除完后第一次写没有写进去,第二次就可以了,dump一下再写也可以写进去,这是openocd的BUG
注: 现在开发板上flash的型号是K9F2G08UOA,页大小是 2048字节,64个页为一个块,块大小是 0x20000字节(128K)
openjtag配置
. 交叉编译器
. 安装
mkdir -p /usr/local/arm
tar xjvf gcc-4.3.2.tar.bz2 -C /usr/local/arm/
. 修改环境变量
修改~/.bashrc
添加
export PATH=$PATH:/usr/local/arm/4.3.2/bin
也可以修改/etc/profile
并执行 . ~/.bashrc
. bootloader
. 编译:
修改配置, vim include/configs/qt2440.h
#make clean
#make distclean
#make qt2440_config
#make
du -sh u-boot.bin (> 237K)
. 烧写bootloader到nandflash
<shell 1>
#cd /tftpboot (下面有对应的openjtag.cfg)
#openocd
<shell 2>
#telnet localhost 4444
openocd>reset;halt
openocd>arm920t cp15 2 0
openocd>step
openocd>nand probe 0
openocd>nand erase 0 0 0x100000
openocd>nand dump 0 /tftpboot/2048.nand 0 2048
root>vim /tftpboot/2048.nand
:%!xxd (看hex)
如果为全"1",或全"0"则正确
如果不成功,
reset;halt
nand erase 0 0 0x100000
nand dump 0 /tmp/2048.nand 0 2048
如果为全"1",或全"0"则正确
openocd>nand write 0 /tftpboot/u-boot.bin 0
openocd>nand dump 0 /tftpboot/2048.nand 0 2048
root>vim /tftpboot/2048.nand
:%!xxd (看hex)
如果为其他不一样的数字,则证明u-boot已经烧进nand flash
openocd>reset
. minicom
切换到minicom窗口,如果minicom窗口无输出,
ls -l /dev/tty*
看一下你的minicom端口对了么?
openocd>minicom -s配置
u-boot#进入bootloader
. 安装tftp服务器:
apt-get --force-yes -y install tftpd-hpa tftp-hpa xinetd
mkdir /tftpboot
chmod 777 /tftpboot
把下面的代码复制到vim /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
wait = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
log_on_success = PID HOST DURATION
log_on_failure = HOST
}
sudo /etc/init.d/xinetd restart
sudo /etc/init.d/tftpd-hpa restart
测试:
touch /tftpboot/aaa
tftp 10.1.0.248(自己的IP)
get aaa 如果没有任何错误,然后按q退出看当前目录下有没有aaa文件,如果有证明tftp服务配置成功
------------------------------------------------
vim /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"
-------------------------------------------------
. kernel
将u-boot/tools/mkimage 拷贝到/usr/local/bin(你PATH中有的目录)
cd 到内核源码目录(kernel/qt2440-2.6.13)
cp qt2440_config .config
vim Makefile
看CROSS_COMPILE=/usr/local/arm/3.4.1/bin/arm-linux-
make menuconfig
make bzImage
...
生成内核镜像在arch/arm/boot
cd arch/arm/boot
//使用mkimage来将linux的zImage转换成uboot能识别的image文件
#./mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008040 -n "linux kernel" -d ./zImage uImage
#cp uImage /tftpboot
//此时执行bootm 30008000启动将失败,是因为没有文件系统导致无法加载启动文件的缘故。
. nfs
#apt-get --force-yes -y install nfs-kernel-server nfs-client nfs-common portmap
配置:
$ mkdir -p /nfs_rootfs
$ sudo chmod 755 /nfs_rootfs -R
$ sudo vi /etc/exports
------------------------------------
/nfs_rootfs *(rw,sync,no_root_squash)
------------------------------------
/etc/init.d/portmap start
/etc/init.d/nfs-kernel-server restart
Note:在开发板ping一下,如果没有通,关闭防火墙
. 搭建根文件系统
------------- make the file system image ----------
//total = bs * count
1. dd if=/dev/zero of=<image file name> bs=<block size> count=<number>
//insert the file into the loopback device
2. losetup /dev/loop<N> <image file name>
//format the block device
3. mkfs.<file system format> /dev/loop<N>
//detach the image file from the loopback device
4. losetup -d /dev/loop<N>
-------------- build the file system bin tools (busybox) ------------
//choice the link type: static link or dymanic link
1. Build Options ---> Build BusyBox as a satic library.......
// configure the compiler prefix
2. Build Options ---> Do you want to build .......
// configure Installation floder
3. Installoation Options --> busybox installation prefix
// choice init process
4. Init Uitilies ---> init
// choice the shell
5. Shells ---> Choose ...... ---> ash
// build
6. make
// install
7. make install
-------------- copy the busybox into the image file -------
1. mount -o loop <image file name> <mount floder>
2. cp -rf <busybox install floder> <mount floder>
3. cd <mount floder>
4. mkdir dev proc sys
5. mknod dev/console c 5 1
6. mknod dev/null c 1 3
## if the busybox linked as dynamic linker
cp -rf <complier installation floder>/arm-linux/lib/* lib/
7. umount <mount floder>
. 解压根文件系统到/nfs_rootfs
. 将文件系统放在硬盘(flash)上
========================================================================
--------------------- A. boot from nand flash -----------------
1. nand erase <part start addr> <part size>
2. tftp 30000000 <image file name>
3. nand write 30000000 <part start addr> <part size>
## configure command line tag for kernel booting
4. setenv bootargs noinitrd mem=64M console=ttySAC0 root=/dev/mtdblock/2
saveenv
## download the kernel image and boot it
5. tftp 30008000 uImage
bootm 30008000
----------- done--------
-------------------- B. boot from init ram disk----------------------
1. tftp <ram disk start addr> <image file name>
2. setenv bootargs initrd=<ram disk start addr>,<size> mem=64M console=ttySAC0
root=/dev/ram0
saveenv
## download the kernel image and boot it
3. tftp 30008000 uImage
bootm 30008000
------------ done -------
------------------- C. boot from network file system (nfs) -------
## configure the nfs service of your host
1. ##edit the /etc/exports and append the following:
<shared root file system> *(rw)
##restart the nfs service
/etc/rc.d/init.d/nfs restart
## copy the busybox into the nfs service root dir
2. cp -rf <busybox install floder> <nfs service root floder>
cd <nfs service root floder>
mkdir dev proc sys
mknod dev/console c 5 1
mknod dev/null c 1 3
## if the busybox linked as dynamic linker
cp -rf <complier installation floder>/arm-linux/lib/* lib/
## setup the command line tags on the development board
3. setenv bootargs noinitrd console=ttySAC0,115200 mem=64M root=/dev/nfs
nfsroot=192.168.0.3:/<nfs service root floder>
ip=192.168.0.2:192.168.0.3:192.168.0.3:255.255.255.0::eth0:off
## download the kernel image and boot it
3. tftp 30008000 uImage
bootm 30008000
------------ done -------
. 2种开发模式
一、烧写到nandflash上
kernel:
1.tftp 30000000 uImage
2.nand erase 100000 220000
3.nand write 30000000 100000 220000
4.setenv bootcmd nand read 0x30008000 0x100000 0x220000;bootm 30008000
fs:
1. nand erase 400000 fc00000
2. nfs
3. mount -t yaffs /dev/mtdblock2 /mnt
4. tar xjvf nfsroot-29.tar.bz2
5. mv nfsroot-29/* /mnt
reboot
setenv bootargs noinitrd mem=64M console=ttySAC0 root=/dev/mtdblock2
saveenv
二、网络开发模式
setenv bootcmd tftp 30008000 uImage\; bootm\;
setenv bootargs noinitrd console=ttySAC0,115200 mem=64M root=/dev/nfs nfsroot=192.168.0.3:/nfs_rootfs/nfsroot-29 ip=192.168.0.7:192.168.0.3:192.168.0.1:255.255.255.0::eth0:off
saveenv
作者: kmalloc 发布时间: 2010-09-03
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28