分类: 系统运维
2011-09-13 21:26:17
最近两周都在弄这三个的移植,其中Php的移植更是花了快两周的时间,着实让我头疼,不过好在功夫不负有心人,在各种论坛上积极发帖询问,最终得到了好人的帮助,成功把php也移植到板子上,所以现在把步骤详细写出来,方便跟我一样的菜鸟们~
开发板:友善之臂micro2440
交叉编译工具版本:arm-linux-gcc 4.3.2
本地系统:ubuntu 11.04
一、交叉编译sqlite
sqlite是一个小型数据库,适合在嵌入式系统中使用,本次移植的Sqlite3.3.8版本,可以从上下载,移植方法如下:
1/解压,进入目录
2/手动修改Makefile,cp Makefile.linux-gcc Makefile
3/vim makefile
首先找到Makefile文件中的下面这样一行:cd
TOP = ../sqlite
将其修改为:
TOP = .
找到下面这样一行:
TCC = gcc -O6
将其修改为:
TCC = /usr/local/arm/4.3.2/bin/arm-linux-gcc -O6
找到下面这样一行:
AR = ar cr
将其修改为:
AR = /usr/local/arm/4.3.2/bin/arm-linux-ar cr
找到下面这样一行:
RANLIB = ranlib
将其修改为:
RANLIB = /usr/local/arm/4.3.2/bin/arm-linux-ranlib
找到下面这样一行:
MKSHLIB = gcc -shared
将其修改为:
MKSHLIB = /usr/local/arm/4.3.2/bin/arm-linux-gcc -shared
注释掉下面这一行:
TCL_FLAGS = -I/home/drh/tcltk/8.4linux
注释掉下面这一行:
LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm –ldl
注意:在Makefile的上面有一个BCC,这里就不要修改成交叉编译链,这里生成的文件需要是gcc编译的。
原则上,对Makefile的修改主要包括两个方面:首先是将编译器、归档工具等换成交叉工具链中的对应工具,比如,gcc换成/usr/local/arm/4.3.2/bin/arm-linux-gcc,ar换成/usr/local/arm/4.3.2/bin/arm-linux- ar,ranlib换成/usr/local/arm/4.3.2/bin/arm-linux-ranlib等等;其次是去掉与TCL相关的编译选项,因为默认情况下,将会编译SQLite3的Tcl语言绑定,但是在移植到ARM-Linux的时候并不需要,因此将两个与TCL有关的行注释掉。
4/修改main.mk,因为makefile包含这个文件。找到这个文件中的下面一行:63行: select.o table.o tclsqlite.o tokenize.o trigger.o /,去掉tclsqlite.o这样编译的时候将不会编译SQLite3的Tcl语言绑定。
5/make,若报错
./lemon -DSQLITE_OMIT_CURSOR parse.y
./lemon: ./lemon: cannot execute binary file
make: *** [parse.c] Error 126
这是因为gcc没有生成lemon文件,所以在这里执行一下gcc –O2 –o lemon ./tool/lemon.c指令;再次执行make,就生成库函数文件libsqlite3.a和头文件sqlite3.h,这就是所需要的两个文件了。
将这两个文件拷贝到开发板上。
ServerType
standalone
ServerRoot "/usr/local/apache"
PidFile
/usr/local/apache/logs/httpd.pid
ScoreBoardFile
/usr/local/apache/logs/httpd.scoreboard
Timeout 300
KeepAlive
On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers
5
MaxSpareServers 10
StartServers 5
MaxClients
150
MaxRequestsPerChild 0
Port 80
User nobody
Group
nobody
ServerAdmin
DocumentRoot
"/home/webroot"
Options FollowSymLinks
AllowOverride
None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
UserDir public_html
DirectoryIndex index.html
DirectoryIndex
index.php3
DirectoryIndex
index.phtml
AccessFileName
.htaccess
Order
allow,deny
Deny from all
Satisfy
All
UseCanonicalName On
TypesConfig
/usr/local/apache/conf/mime.types
DefaultType
text/plain
MIMEMagicFile
/usr/local/apache/conf/magic
HostnameLookups
Off
ErrorLog /usr/local/apache/logs/error_log
LogLevel
warn
LogFormat "%h %l %u %t /"%r/" %>s %b
/"%{Referer}i/" /"%{User-Agent}i/""
combined
LogFormat "%h %l %u %t /"%r/" %>s %b"
common
LogFormat "%{Referer}i -> %U"
referer
LogFormat "%{User-agent}i" agent
CustomLog
/usr/local/apache/logs/access_log common
ServerSignature
On
Alias /icons/
"/usr/local/apache/icons/"
Options Indexes MultiViews
AllowOverride None
Order
allow,deny
Allow from all
Alias /manual/
"/usr/local/apache/htdocs/manual/"
Options Indexes FollowSymlinks
MultiViews
AllowOverride
None
Order allow,deny
Allow from all
ScriptAlias /cgi-bin/
"/usr/local/apache/cgi-bin/"
# 注意
"/usr/local/php/bin/"
中最后一个"/"不可少
AllowOverride None
Options None
Order
allow,deny
Allow from all
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress
x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon
/icons/binary.gif .bin .exe
AddIcon
/icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon
/icons/layout.gif .html .shtml .htm .pdf
AddIcon
/icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon
/icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon
/icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif
core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon
/icons/folder.gif ^^DIRECTORY^^
AddIcon
/icons/blank.gif ^^BLANKICON^^
DefaultIcon
/icons/unknown.gif
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *#
HEADER* README* RCS CVS *,v *,t
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8
.iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR
.iso-kr
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz
.lu
AddLanguage ca .ca
AddLanguage
es .es
AddLanguage sv .sv
AddLanguage cs .cz .cs
AddLanguage ru .ru
AddLanguage zh-TW .zh-tw
AddCharset Big5
.Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866
.cp866
AddCharset
ISO-8859-5 .iso-ru
AddCharset KOI8-R
.koi8-r
AddCharset UCS-2
.ucs2
AddCharset
UCS-4 .ucs4
AddCharset UTF-8 .utf8
LanguagePriority en da nl et fr de el it ja kr no
pl pt pt-br ru ltz ca es sv tw
AddType application/x-tar .tgz
AddType
application/x-httpd-php .php
AddType
application/x-httpd-php .phtml
AddEncoding x-compress .Z
AddEncoding x-gzip
.gz .tgz
Action
application/x-httpd-php "/php4/php"
BrowserMatch "Mozilla/2"
nokeepalive
BrowserMatch "MSIE 4/.0b2;"
nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4/.0" force-response-1.0
BrowserMatch "Java/1/.0" force-response-1.0
BrowserMatch "JDK/1/.0"
force-response-1.0