1.1 debhelper
1.2 ncurses-dev
1.3
2. telnet
2.1 sudo apt-get install xinetd telnetd
2.2 sudo vim /etc/inetd.conf (新建)
telnet streamtcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
2.3 sudo vim /etc/xinetd.conf
# Simple configuration file for xinetd
#
# Some defaults, and include/etc/xinetd.d/
defaults
{
# Please note that you need alog_type line to be able to use log_on_success
# and log_on_failure. The defaultis the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /etc/xinetd.d
2.4 sudo vim /etc/xinetd.d/telnet
# default: on
# description: The telnet serverserves telnet sessions; it uses \
# unencrypted username/passwordpairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
2.5 sudo /etc/init.d/xinetd restart
http://jingyan.baidu.com/article/48b558e35e51f97f38c09ae7.html
3. NFS
3.1 nfs-kernel-server
sudo apt-get install nfs-kernel-server
3.2 新建目录
linux@linux-Lenovo:~$ mkdir nfs
3.3 配置文件
linux@linux-Lenovo:~$ sudo vim /etc/exports
/home/linux/nfs *(rw,no_root_squash,sync)
3.4 命令
挂载:sudo mount192.168.1.70:/home/tft/nfs-server /mnt
ARM挂载:mount 192.168.1.70:/home/tft/nfs-server /mnt –o nolock
卸载:umount /mnt
查看:showmount 192.168.1.70 –e,显示nfs服务的导出共享目录列表
强行卸载:umount –f
重启:sudo /etc/init.d/nfs-kernel-server restart
4. ftp
sudo apt-get install vsftpd
sudo vim /etc/vsftpd.conf
write_enable=yes
http://blog.csdn.net/njchenyi/article/details/8499555
5. tftp
5.1 sudo apt-get install tftpd tftp openbsd-inetd
5.2 sudo vim /etc/inetd.conf
#:BOOT: TFTP service is provided primarily forbooting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp (/srv/tftp 为默认tftp目录)
#修改如下文件
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /home/linux/tftp
5.3sudomkdir /home/linux/tftp
5.4 sudo chmod 777 /home/linux/tftp
5.5 sudo /etc/init.d/openbsd-inetd restart
5.6 查看69端口是否有打开:netstat -an | more | grep udp
udp 0 0 0.0.0.0:69 0.0.0.0:*
5.7本机测试
a. 在/tftproot 下新建文件1.txt
b. 在其他目录下测试:
tftp 127.0.0.1
tftp> get 1.txt
Received 12 bytes in 0.0 seconds
tftp>quit
http://blog.csdn.net/rudyn/article/details/38638759
错误:
1:如果出现permissiondenied 错误 则是操作者权限不够需要提升权限su root输入密码后就可以正常进行tftp传输操作了
2:如果出现Accessviolation错误 则是文件权限没有解开,将要操作的文件操作权限全解开就可以了chmod 777 文件名
3:错误1:Error code 2: Access violation
客户端:#tfpt 192.168.1.182
tfpt>get testfile
#cat /var/log/syslog //查看系统日志
tftppd:trying to get file: testfile
tftpd:serving file from /srv/tftp
原因:tftp的目录没有更改成功。
解决:在/srv/tftp 下放testfile文件,操作成功。
重新启动后,tftp目录在根据修改的地址/tftpboot
4:Errorcode 1: File not found
错误:get /tftpboot/aaa
正确:get aaa
原因:文件不存在
5:transfer timed out
tftpd服务没有启动
sudo /etc/init.d/xinetd restart
sudo /etc/init.d/tftpd-hpa restart
6:Error code 2: only absolute filenames allowed
vim /etc/default/tftpd-hpa
RUN_DAEMON="no"
OPTIONS="-s/tftpboot -c -p -U tftpd"
7:Error code 2: 'Forbidden directory'
6. 交叉编译
sudo tar xvzf arm-linux-gcc-4.3.2.tgz -C /
增加PATH
sudo vim /etc/profile
增加如下内容:
# comm cross-toolchain path --2016/06/29
export PATH=/usr/local/arm/4.3.2/bin:$PATH
export TOOLCHAIN_CM=arm-linux-
PATH生效:
source /etc/profile
7. GTK+-2.0
7.1、安装
1、安装gcc/g++/gdb/make 等基本编程工具
$sudo apt-get install build-essential
2、安装 libgtk2.0-dev libglib2.0-dev 等开发相关的库文件
$sudo apt-ge tinstall gnome-core-devel
3、用于在编译GTK程序时自动找出头文件及库文件位置
$sudo apt-get install pkg-config
4、安装 devhelp GTK文档查看程序
$sudo apt-get install devhelp
5、安装 gtk/glib 的API参考手册及其它帮助文档
$sudo apt-get install libglib2.0-doc libgtk2.0-doc
6、安装基于GTK的界面GTK是开发Gnome窗口的c/c++语言图形库
$sudo apt-get install glade libglade2-dev
或者
$sudo apt-get install glade-gnome glade-commonglade-doc
7、安装gtk2.0 或者 将gtk+2.0所需的所有文件统通下载安装完毕
$sudo apt-get install libgtk2.0-dev
或者
$sudo apt-get install libgtk2.0*
7.2、查看GTK库版本
1、查看1.2.x版本
$pkg-config --modversion gtk+
2、查看 2.x 版本
$pkg-config --modversion gtk+-2.0
3、查看pkg-config的版本
$pkg-config --version
4、查看是否安装了gtk
$pkg-config --list-all grep gtk
7.3、测试程序
//Helloworld.c
#include <gtk/gtk.h>
int main(int argc,char*argv[])
{
GtkWidget *window;
GtkWidget *label;
gtk_init(&argc,&argv);
/* create the main, top level, window */
window =gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* give it the title */
gtk_window_set_title(GTK_WINDOW(window),"Hello World");
/* connect the destroy signal of the window togtk_main_quit
* when the window is about to bedestroyed we get a notification and
* stop the main GTK+ loop
*/
g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit),NULL);
/* create the "Hello, World" label */
label = gtk_label_new("Hello, World");
/* and insert it into the main window */
gtk_container_add(GTK_CONTAINER(window),label);
/* make sure that everything, window and label, arevisible */
gtk_widget_show_all(window);
/* start the main loop, and let it rest until theapplication is closed */
gtk_main();
return0;
}
7.4、编译运行
1、编译
$gcc -o Helloworld Helloworld.c `pkg-config--cflags --libs gtk+-2.0`
2、运行
$./Helloworld
http://www.cnblogs.com/niocai/archive/2011/07/15/2107472.html
8. Qt
8.1 源码
qt-everywhere-opensource-src-4.8.6.tar.gz
http://download.qt.io/archive/qt/4.8/4.8.6/
8.2 参数
http://www.openedv.com/posts/list/0/44022.htm
8.3 安装
8.3.1 X11版
X11版本的QT可以在使用X windows系统的linux 桌面操作系统上运行(我用的是Ubuntu),如果不需要开发桌面应用程序,可以不编译。
8.3.1a、需要libx11-dev libxext-dev libxtst-dev这3个库。
sudo apt-get install libx11-dev libxext-dev libxtst-dev
opengl需要
$ sudo apt-get install xlibmesa-gl-dev libglu1-mesa-dev
phonon需要
sudo apt-get install libglib2.0-dev
sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install libphonon-dev libphonon4 phonon-backend-gstreamer
sudo apt-get install xorg-dev
8.3.1b、配置configure参数
建立一个qt-4.8.6-x11目录,最好在用户空间内,这样可以避免出现权限问题。
下载并解压qt4.8.6源码,更改源码目录名为:
qt-src-4.8.6-x11
进入源码目录执行:
./configure -opensource -prefix /home/linux/usr/qt/qt-4.8.6-x11 -glib -phonon -no-webkit -no-javascript-jit -no-openssl -no-cups
这里我不需要webkit和JavaScript、openssl、cups,所以除能这些库。
8.3.1c、执行make && make install
8.3.2 Embeded x86版
这个版本为什么是嵌入版(Embeded)的,因为x86台式机本身也可以当做一个嵌入式系统,但是Embeded x86版的QT不能直接通过X11窗口系统输出画面,这时我们可以借助X11的qvfb工具仿真一个LCD输出设备(QWS环境),这样Embeded x86应用程序就能在Ubuntu里仿真运行了。要理解这点其实很简单,以Ubuntu为例,Ubuntu的应用程序是以X11协议(X窗口系统)输送到屏幕显示界面的,X server负责图形显示,应用程序负责计算、修改数据,两者基于某种协议通信。对于嵌入式linux,qt应用程序也需要一个窗口系统才能显示,但是嵌 入式linux系统不能使用X11(太耗资源了),奇趣公司就专门开发了一个qws(QT windows system),应用程序按照协议向qws发送数据,服务端负责显示数据。现在,qvfb就是QWS的显示设备。
另外请注意,Embeded x86版的QT应用程序是不能在arm开发板上运行的。
embeded x86版并不是我们的开发板最终使用的QT库,编译这个版本只是为了方便我们调试, 先在ubuntu中仿真运行,看看界面,不必下载到开发板的文件系统中运行,两者的运行效果除了界面基本相同,其他方面还是有差异的。
8.3.2a、配置configure参数
建立一个qt-4.8.6-qvfb目录,最好在用户空间内,可以避免出现权限问题。
再解压一个qt4.8.6源码(解压比复制快),更改源码目录名为:
qt-src-4.8.6-qvfb
进入源码目录,执行:
./configure -opensource -confirm-license -prefix/home/linux/usr/qt/qt-4.8.6-qvfb -embedded x86 -qvfb -glib -no-webkit -no-javascript-jit -no-openssl
注意这里加了x86
8.3.2b 执行make && make install
(耗时2小时左右)
8.3.2c、编译qvfb
在x11版本tools\qvfb中编译,并将编译好的qvfb复制到qt-4.8.6-qvfb\bin下。
8.3.2d、测试qvfb
进入qt-4.8.6-qvfb/example/widget/calcular目录,测试计算器程序。
首先要打开qvfb,在终端输入qvfb -width 800 -height 400 &
执行./calcular -qws,程序正常运行。效果如下:
8.3.3 Embedded arm版
这个版本才是我们在arm开发板上运行的版本。
我们做嵌入式开发,其实只需编译第3版本的QT(Embeded arm版),编译X11 版本的目的只是方便我个人学习QT,编译Embeded x86只是为了体验仿真效果。
8.3.3a 配置configure参数
建立一个qt-4.8.6-arm目录,最好在用户空间内,可以避免出现权限问题。
再解压一个qt4.8.6源码,更改源码目录名为:
qt-src-4.8.6-arm
在qt-src-4.8.6-arm/mkspec/qws/linux-arm-g++/qmake.conf文件中定义了交叉编译器,默认使用arm-linux-gcc,armlinux-g++,我用的是arm-linux-gnueabi,所以分别改成arm-linux-gnueabi-gcc和arm-linux-gnueabi-g++。
进入源码目录,执行:
./configure -opensource -confirm-license -prefix /home/linux/usr/qt/qt-4.8.6-arm -embedded arm -xplatform qws/linux-arm-g++ -platform /qws/linux-x86-g++ -little-endian -host-little-endian -shared -no-qt3support -no-phonon -no-phonon-backend -qt-zlib -no-gif -no-libtiff -no-qvfb -qt-libjpeg -no-nis -no-opengl -no-cups -no-webkit -no-glib -no-dbus -no-rpath -no-mmx -no-3dnow -no-sse -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-neon -no-audio-backend -no-svg -no-javascript-jit -no-script -no-scripttools -no-multimedia -no-openssl -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -lrt
arm版的QT库很多组件都不需要,所以编译时间也相对短一些。另外,这里我们添加了
-xplatform qws/linux-arm-g++ -platform /qws/linux-x86-g++
这2个选项,-xplatform表示配置交叉编译器,-platform表示配置当前平台的编译器(对于我的ubuntu就是linux-x86-g++),编译器名称可以在源码目录内mkspec内查询,文件夹名称就是对应的编译器。qws/linux-arm-g++ 代表我们的arm开发板是使用qws运行qt程序的,但是注意,qws/linux- arm-g++/qmake.conf里配置了对应的编译器名称,如果和你之前安装好的交叉编译器路径名称不一样,那就需要修改。我的交叉编译器是使用 sudo apt-get install gcc-arm-linux-gnueabi安装的,将qmake.conf里的编译器改成arm-linux-gnueabi就可以编译了。
最后的 -lrt 是加入librt链接库(在arm-linux-gnueabi/lib目录下)。没有这个库,编译的时候会提示undefined reference to `clock_gettime错误。
2、执行make && make install
8.3.3b embedded arm-hisi
修改mkspecs/qws/linux-arm-g++/qmake.conf
#
# qmakeconfiguration for building with arm-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modificationsto g++.conf
QMAKE_CC =arm-hisiv100nptl-linux-gcc
QMAKE_CXX = arm-hisiv100nptl-linux-g++
QMAKE_LINK =arm-hisiv100nptl-linux-g++
QMAKE_LINK_SHLIB = arm-hisiv100nptl-linux-g++
# modificationsto linux.conf
QMAKE_AR = arm-hisiv100nptl-linux-arcqs
QMAKE_OBJCOPY = arm-hisiv100nptl-linux-objcopy
QMAKE_STRIP = arm-hisiv100nptl-linux-strip
load(qt_config)
vimmkspecs/qws/linux-arm-g++/qplatformdefs.h
打开文件qplatformdefs.h增加
#undef O_CLOEXEC
此处主要为解决:编译过程中找不到accept4函数问题(undefined reference to ‘accept4’)
./configure-opensource -confirm-license -prefix /home/linux/usr/qt/qt-4.8.6-hisi -embeddedarm -xplatform qws/linux-arm-g++ -platform /qws/linux-x86-g++ -little-endian-host-little-endian -shared -no-qt3support -no-phonon -no-phonon-backend-qt-zlib -no-gif -no-libtiff -no-qvfb -qt-libjpeg -no-nis -no-opengl -no-cups-no-webkit -no-glib -no-dbus -no-rpath -no-mmx -no-3dnow -no-sse -no-sse2-no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-neon -no-audio-backend-no-svg -no-javascript-jit -no-script -no-scripttools -no-multimedia-no-openssl -nomake tools -nomake examples -nomake demos -nomake docs-nomake translations -lrt
make
make install
安装
将lib和plugins复制到arm中即可,plugins根据实际需要添加,lib/fonts不必全部添加。
qt环境变量设置
exportQTDIR=/nfsroot/Qt4.8.6-hisi
export QT_QWS_FONTDIR=$QTDIR/lib/fonts
export setQWS_DISPLAY="LinuxFB:/dev/fb0"
exportTSLIB_CONSOLEDEVICE=none
exportPATH=$QTDIR/bin:$PATH
exportLD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
8.4错误
8.4.1 QT4.8.6 undefinedreference to accept4
vimmkspecs/qws/linux-arm-g++/qplatformdefs.h
打开文件qplatformdefs.h增加
#undef O_CLOEXEC
此处主要为解决:编译过程中找不到accept4函数问题(undefined reference to ‘accept4’)
8.4.2 InitializingQFontEngineQPF failed
InitializingQFontEngineQPF failed for /nfsroot/Qt4.8.6-hisi /lib/fonts/DejaVuSans.ttf
Initializing QFontEngineQPF failed for /nfsroot/Qt4.8.6-hisi/lib/fonts/DejaVuSans-Bold.ttf
/nfsroot/Qt4.8.6-hisi/lib/fonts/增加wenquanyi_180_50.qpf, wenquanyi_220_50.qpf,删除其他字体。