2.1.3设置SSH服务为开机启动..................................................................................5
将4.4.6_TQ3358_release_20120720.tar.bz2拷贝到主机 /opt 目录.................................16
4.1.4设置交叉工具链环境变量................................................................................16
4.1.5查看工具链是否安装完成..................................................................................16
第1章 简介
本文档记录嵌入式软件开发环境搭建的流程和做法。一切开发环境搭建在服务器上,服务器上安装虚拟工作站,虚拟工作站中安装虚拟机,虚拟机是Linux Centos 6.4版本。
具体流程如下:
|
第2章 开启系统ftp、ssh等网络服务
2.1 ssh搭建
2.1.1 查看SSH是否安装
输入命令:rpm -qa | grep ssh
注:若没安装SSH则可输入:yum install openssh-server安装。
2.1.2 启动SSH服务
输入命令:service sshd restart 重启SSH服务。
命令:service sshd start 启动服务
命令:service sshd stop 停止服务
2.1.3 设置SSH服务为开机启动
输入命令:chkconfig sshd on 即可。
注:若是chkconfig sshd off则禁止SSH开机启动。
2.2 ftp搭建
2.2.1 安装vsftp
使用yum命令直接安装:yum-y install vsftpd
2.2.2 启动与配置自启动
chkconfig vsftpdon 配置vsftp自动启动
查看与管理ftp服务
启动ftp服务:servicevsftpd start
查看ftp服务状态:servicevsftpd status
重启ftp服务:servicevsftpd restart
关闭ftp服务:servicevsftpd stop
查看vsftp 是否有设置自启动: chkconfig --list|grep vsftpd
自启动设置:chkconfig vsftpd on
2.2.3 配置vsftp服务
编辑/etc/vsftpd/vsftpd.conf文件配置vsftp服务
#vi/etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
#write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=027
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to DiMai FTP service.
#guest_enable=YES
#guest_username=user
virtual_use_local_privs=YES
#anon_other_write_enable=YES
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
user_config_dir=/etc/vsftpd/vsftpd_user_conf
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
listen_port=21
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=NO
tcp_wrappers=YES
2.2.4 限制系统帐号
vi /etc/vsftpd/ftpusers 删除root帐号这样为了root账号可以登陆
2.2.5 添加用户
1. 在/etc/vsftpd/chroot_list中添加用户
2. 在/etc/vsftpd/vuser_passwd.txt中添加用户名和密码
3. 在/etc/vsftpd/vsftpd_user_conf/下建立各个用户对应的配置文件,如下内容:
local_root= /home/test/
write_enable=YES
anon_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
4. 在/etc/vsftpd/user_list文件中添加对应的用户名
5. 执行:db_load -T -t hash -f/etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db
6. useradd test 添加用户
7. passwd test 给用户添加密码
8. 重启vsftpd服务:servicevsftpd restart
2.2.6 遇到的问题:
1、ftp配置没问题,在系统中也处于开启状态
先检查防火墙有没有关闭
service iptables stop
2、设置用户共享目录权限
chmod 777 /home/*** *** 代表你的个人用户目录
3、设置sebool
先用命令 getsebool-a|grepftp查看信息
通过 setsebool ftp_home_dir 1开启
永久设置命令:
setsebool -P ftp_home_dir 1
4、连接上,但无法传输文件
setsebool allow_ftpd_full_access 1
setsebool allow_ftpd_use_nfs 1
setsebool allow_ftpd_use_cifs 1
第3章 安装SVN
3.1 安装SVN
命令: sudo yum install -ysubversion
3.2 查看svn版本信息
第4章 安装交叉编译工具链
4.1 安装交叉编译工具链
4.1.1 拷贝
将4.4.6_TQ3358_release_20120720.tar.bz2拷贝到主机 /opt 目录
4.1.2 解压
命令:tar –xvf 4.4.6_TQ3358_release_20120720.tar.bz2
4.1.3 复制到指定的目录
1、 在opt目录下创建arm目录 命令:mkdir arm
2、 在/opt/opt/EmbedSky目录下将4.4.6拷贝到/opt/arm目录下
4.1.4 设置交叉工具链 环境变量
1、vi /etc/profile
2、将 export PATH=/opt/arm/4.4.6/bin:$PATH 添加到到profile文件中,并保存退出
3、source /etc/profile
4.1.5 查看工具链是否安装完成
执行命令: arm-linux-gcc –v
第5章 安装hudson
5.1 Linux平台准备工作
软件安装在服务器的路径:/usr/local/tomcat/hudson
软件构建时的工作目录路径:/home/hudson/
A、下载hudson:http://hudson-ci.org/
下载tomcat套件: http://tomcat.apache.org/
B、安装:
先安装tomcat套件(apche, mysql)
解压 tar xzf apache-tomcat-7.0.42.tar.gz,然后复制到:/usr/local/tomcat
C、使用
执行命令:
#bin/startup.sh #启动tomcat
#bin/shutdown.sh #停止tomcat
#tail -f logs/catalina.out #看tomcat的控制台输出
为了方便管理维护,hudson的工作目录和运行目录可以分开 。
A.把hudson.tar 改为hudson.zip, 然后解压到windows的文件夹中,
上传到linux系统,再复制到/usr/local/tomcat/目录下,放置好hudson后,
在Tomcat上映射一个目录,这样做是为了以后维护方便。
方法如下:
#cd tomcat
#vim conf/server.xml
找到最下面在<Host></Host>标签中添加如下内容:
<Context path="/hudson" reloadable="true" debug="0"
docBase="/usr/local/tomcat/hudson" workDir="/usr/local/tomcat/work"
crossContext="true" ></Context>
可以把原来的工程文件全面移到/home/hudson下面,然后修改
tomcat/bin/startup.sh和shutdown.sh, 在开始处添加HUDSON_HOME的路径:
export HUDSON_HOME=/home/hudson, 保存,重启tomcat即可。
开机自启动设置:
打开 /etc/rc.d/rc.local 文件后 添加 /usr/local/tomcat/bin/startup.sh
5.2 Windows平台准备工作
1、在浏览器中输入http://192.168.1.26:8080/hudson/登陆
2、将网页拉到最底部,选择install进行安装套件(可能会失败,多尝试几次),等待安装完成,然后点击finish,如下图:
3、finish完成后,这样就可以新建自己的工程了,如下图:
5.3 Hudson使用
1. 新建工程
点击左侧的“新建工程”
如图
输入工程名,勾选“复制现有任务”,然后输入需要复制的工程名
根据需要进行配置:
2. 构建项目
选择一个项目,点击左侧的“立即构建”即可。
3. 项目显示列表管理
如图所示:
4. 用户管理
如图操作:
在上图中可以添加,删除用户,配置用户信息
5. 权限管理
如图所示:
在上图中,根据需要修改对应的用户权限,也可以添加用户,最后记住保存。
第6章 UltraSec加密软件安装(linux)
6.1 UltraSec客户端软件安装
由于要安装在系统跟目录,所以要用root权限来安装
1、将加密软件(ultrasec-3.3.7_-generic.i386.rpm)拷贝到linux系统中
2、执行安装命令:rpm -ivh ultrasec-3.3.7_-generic.i386.rpm
3、重启系统;命令:reboot
6.2 UltraSec客户端软件使用
这里介绍的是使用命令行来使用客户端,同样是使用root权限来执行所有命令操作;
首先是启动客户端,命令:usec
6.2.1 Set workspace
选择菜单列表中【3】,会弹出如下操作提示,输入【a】可以添加工作目录,输入【b】可以删除工作目录,退出为【Esc】再【Enter】。如下图所示:
1、添加工作目录。输入【a】,根据操作提示,输入新增目录名称,添加成功后,目录列表中将增加该目录。如下图所示:
2、删除工作目录。输入【d】,根据操作提示,选择要删除的工作目录的序号并【enter】确定,即可删除选中的工作目录。如下图所示:
6.2.2 Set server address
在用户登录前应首先确保已配置好服务器地址和端口。如果是首次登录的话,正确配置服务器地址和端口即可。选择【2】,(IP:192.168.1.18 端口号:80)将显示如下图:
6.2.3 Login
如果想要登录客户端,可以选择【1】执行登录操作,如图所示:
登录成功后, 会变成了Update policy
第7章 Boost安装
由于要将boost安装到根目录下,当前用户没有权限,所以切换到root用户;
命令:su
1、解压文件:
tar zxvfboost_1_52_0.tar.gz
2、配置boost
cd/dimec/boost_1_52_0/
./bootstrap.sh
3、修改project-config.jam,以支持arm编译
sudo vi project-config.jam
打开project-config.jam,仅修改using gcc这行。因为我使用的是arm-linux-gcc,所以将其改以下即可:
using gcc : : arm-linux-gcc ;
4、安装
./bjaminstall
第8章 配置Graphics SDK
8.1 配置Graphics_SDK_4_05_00_03
1、配置内核
<1> 在.config文件中配置:CONFIG_OMAP2_DSS=y
<2> make modules
<3> 编译内核 make uImage
2、拷贝、解压Graphics_SDK_4_05_00_03
cp./Graphics_SDK_4_05_00_03.tar /opt
tar -xvfGraphics_SDK_4_05_00_03.tar
3、创建安装目录
cd /opt
mkdirGraphics_Install
cdGraphics_Install
mkdir etc
mkdir opt
cd etc
mkdirinit.d
3、进入Graphics_SDK_4_05_00_03修改配置
cd~/dev/Graphics_SDK_4_05_00_03/
viRules.make
修改该文件的配置项:
#Rules.make
# 主目录
HOME=/opt
# 编译环境的路径
CSTOOL_DIR=/opt/arm/4.4.6
CSTOOL_PREFIX=arm-linux-
# 内核路径
KERNEL_INSTALL_DIR=/home/dimec/svn/linux_kernel_8bit_K9K8G08
#编译完成后,安装在目标机的路径
TARGETFS_INSTALL_DIR=/opt/Graphics_Install
# 当前Graphics_SDK的路径
GRAPHICS_INSTALL_DIR=$(HOME)/Graphics_SDK_4_05_00_03
4、打开GFX_Linux_KM目录下Makefile文件,更改一下路径
viGFX_Linux_KM/Makefile
修改配置中的以下项:
#内核路径(最好用当前目标机运行的内核的源文件路径)安装目标机驱动
#exportKERNELDIR =/home/dimec/svn/linux_kernel_8bit_K9K8G08
5、开始编译
查看帮助
Make help
编译
makeBUILD=release OMAPES=8.x all
6、安装
makeBUILD=release OMAPES=8.x install
8.2 测试运行
1、将Graphics_SDK安装目录下的opt目录gfxlibraries、gfxsdkdemos这两个目录的文件复制到目标机下/opt目录
2、安装目标机驱动
insmodpvrsrvkm.ko
insmodomaplfb.ko
insmodbufferclass_ti.ko
3、运行/etc/init.d/335x-demo文件
4、运行自带demo程序
运行gfxsdkdemos目录下的示例:
~ #cd /opt/gfxsdkdemos/ogles2/
/opt/gfxsdkdemos/ogles2# ./OGLES2ChameleonMan
/opt/gfxsdkdemos/ogles2# ./OGLES2Magic*
/opt/gfxsdkdemos/ogles2# cd /opt/gfxsdkdemos/ogles/
/opt/gfxsdkdemos/ogles# ./OGLESEvilSkull
/opt/gfxsdkdemos/ogles# ./OGLESFilmTV
第9章 移植Qt+OpenGL
准备工作:
下载 qt-everywhere-opensource-src-5.6.1.tar.gz
Linux-TIarmv7-sgx-g++.tar.gz
Tslib-1.0.tar.bz2
9.1 编译tslib
安装支持模块
sudo yum install autoconf automake libtool
1、解压tslib-1.0.tar.bz2
tar xjf tslib-1.0.tar.bz2
2、安装
./autogen.sh
./configure --host=arm-linux --prefix=/opt/tslib
make
make install
/opt/tslib 为安装目录,可根据需求更换路径
9.2 QT编译环境部署
1、Qt文件解压
cd ~
tar zxvf qt-everywhere-opensource-src-5.6.1.tar.gz
2、部署Ti官方提供的QT编译工具
A、tar -zxvfLinux-TIarmv7-sgx-g++.tar.gz
B、将linux-TIarmv7-sgx-g++拷贝到 qt-everywhere-opensource-src-5.6.1/qtbase/mkspecs/device/目录中
C、修改linux-TIarmv7-sgx-g++目录下的qmake.conf文件
vi qmake.conf
MAKEFILE_GENERATOR = UNIX
include(../../common/g++-unix.conf)
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
QT_QPA_DEFAULT_PLATFORM = eglfs
#User specific Path - To Be edited by User
QT_INSTALL_DIR =/home/dimec/qt-everywhere-opensource-src-5.3.1
SGX_SDK_ROOT =/home/dimec/Graphics_SDK_4_05_00_03
TSLIB_INCDIR =/home/dimec/lib/tslib/include
TSLIB_LIBDIR =/home/dimec/lib/tslib/lib
# modifications to g++.conf
QMAKE_CFLAGS_RELEASE = -O3-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
QMAKE_CXXFLAGS_RELEASE = -O3-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
QMAKE_CC =arm-linux-gcc
QMAKE_CXX =arm-linux-g++
QMAKE_LINK =arm-linux-g++
QMAKE_LINK_SHLIB =arm-linux-g++
# modifications to linux.conf
QMAKE_AR =arm-linux-ar cqs
QMAKE_OBJCOPY =arm-linux-objcopy
QMAKE_STRIP =arm-linux-strip
................
................
QMAKE_LIBS = $$QMAKE_LIBS_OPENGL_ES2 -lts -ldl -lpthread
把所有带$$SGX_SDK_ROOT/gfx_dbg_es5.x改为$$SGX_SDK_ROOT/gfx_dbg_es8.x
NOTE:修改qmake.conf文件,要特别注意它的inluce目录、交叉编译器的设置,以及INCDIR和LIBDIR是否正确;
NOTE:对比Qt的mainline里面的qmake.conf,观察它新增的内容;
3、配置Qt编译选项
配置之前可以执行./configure -h 查看全部的编译选项,根据需求编译需要的部件。
./configure \
-release -opensource -confirm-license-shared \
-prefix /opt/arm/qt-arm-5.6.1 \
-platform linux-g++-32 \
-device linux-TIarmv7-sgx-g++ \
-force-debug-info \
-separate-debug-info \
-D QT_NO_QWS_CURSOR -D QT_QWS_CLIENTBLIT \
-qt-zlib -qt-libpng -qt-libjpeg \
-eglfs -tslib -opengl es2 -qreal float -v \
-no-openssl -nomake examples -nomake tests
4、编译与安装
gmake
gmake install
5、设置环境变量
exportQTINC=/opt/arm/qt-arm-5.6.1/include
exportQTLIB=/opt/arm/qt-arm-5.6.1/lib
exportQTDIR=/opt/arm/qt-arm-5.6.1
exportPATH=/opt/arm/4.4.6/bin:$PATH
exportPATH=/opt/arm/qt-arm-5.6.1/bin:$PATH
exportLD_LIBRARY_PATH=/opt/arm/qt-arm-5.6.1/lib:$LD_LIBRARY_PATH
exportQT_INCLUDE=/opt/arm/qt-arm-5.6.1/include
export PKG_CONFIG_PATH=/opt/arm/4.4.6/arm-embedsky-linux-gnueabi/embedsky/usr/lib/pkgconfig:$PKG_CONFIG_PATH
9.3 测试程序
Linux环境:
1、进入qt-everywhere-opensource-src-5.6.1/qtbase/examples执行qmake命令生成Makefile文件后执行make命令
2、将要运行的程序拷贝到目标板卡
目标板卡:
1、装载Graphics SDK驱动
insmod pvrsrvkm.ko
insmod omaplfb.ko
insmod bufferclass_ti.ko
2、运行/etc/init.d/335x-demo文件
3、运行拷贝过来的qt例子(前面两步骤要执行)
错误!未找到目录项。
错误!未找到目录项。