?? uclinux下sqlite嵌入式數據庫移植全攻略1.htm
字號:
<div id="outer" style="position:relative;width:750px;">
<table width=750 border=0 cellspacing=0 cellpadding=0>
<tr><td width=620 valign=top align=center rowspan=2 bgcolor=#EDF0F5>
<br>
<div id=article>
<table width=560 border=0 cellspacing=0 cellpadding=0>
<tr><th class=f24><font color=#05006C><h1>ucLinux下sqlite嵌入式數據庫移植全攻略</h1></font></th></tr>
<tr><td height=><hr size=1 bgcolor=#d9d9d9></td></tr>
<tr><td height=20 align=center>http://www.sina.com.cn 2004年12月17日 08:40 <font color=#A20010>天極yesky</font></td></tr>
<tr><td height=15></td></tr>
<tr><td class=l17><font id="zoom" class=f14>
<!-- 正文內部文字導航 : begin -->
<!-- 正文內部文字導航 : end -->
<p> 文/余濤</p>
<span class=f14> 本文討論的是比較流行的嵌入式開發組合ARM+uclinux,即目標開發板為三星S3C4510,完成sqlite在其uclinux上的移植。 <br> <br> 本文假設你已經具備正確編譯uclinux的kernel的能力,即有能力完成make menuconfig;make dep;make lib_only;make user_only;make romfs;make image;make。而且還能將自己寫的類似helloworld程序加到“用戶自定義應用程序”中,即你能完成“uClinux-dist/Documentation/Adding-User-Apps-HOWTO”中所描述的“用戶程序的訂制”。<br><br> 大多數需要移植sqlite到uclinux的開發者,應該已經具備上面的能力,而只是不清楚如何修改sqlite來完成其在uclinux下的編譯。如果你還不能完成上面的要求,那么請先做一定的準備工作,因為本范例所涉及到的內容主要是跟sqlite在uclinux下的移植有關,其他的在這個過程中出現的問題,開發者需要自行處理。<br><br> 本范例使用的uclinux是uClinux-dist-20030522.tar.gz,你可以從http://www.uclinux.org得到適合你的軟件包。<br><br> 交叉編譯工具是arm-elf-tools-20030314.sh,你也可以在http://www.uclinux.org找到它。<br><br> 本范例使用的sqlite是sqlite-2.8.15.tar.gz,本文的方法也適合于2.8.x系列的sqlite;可能有部分內容不適用于3.0.x系列的sqlite,因為3.0.x中源代碼有較大的變化。<br><br> 1、 下載sqlite:你可以到http://www.sqlite.org/download.html,下載sqlite-2.8.15.tar.gz軟件包;<br><br> 2、 將下載的軟件包解壓縮到uClinux-dist/user目錄下;<br><br> 命令:<br><br>
<table borderColor=#ffcc66 width="90%" align=center bgColor=#d8d8d1 border=1>
<tbody>
<tr>
<td>$tar zxvf sqlite-2.8.15.tar.gz -C uClinux-dist/user/</td></tr></tbody></table><br> 現在在uclinux的user目錄下,你應該可以看到sqlite目錄了。解壓縮到這個user目錄主要是要將sqlite編譯成一個普通的用戶應用程序。<br><br> 3、 用戶應用程序的有關設置:<br><br> 按uClinux-dist/Documentation/Adding-User-Apps-HOWTO文檔中說提到的,來添加sqlite作為一個用戶應用程序,將其做成一個shell,這樣就類似于uclinux自己的ps命令。<br><br> 編輯文件<br><br>
<table borderColor=#ffcc66 width="90%" align=center bgColor=#d8d8d1 border=1>
<tbody>
<tr>
<td>uClinux-dist/user/Makefile<br>uClinux-dist/config/Configure.help<br>uClinux-dist/config/config.in</td></tr></tbody></table><br> 我是在這些文件里查找“cpu”有關的項,然后在它的下面,加上自己的sqlite項,這個過程并不復雜。<br><br> 通過上面的修改后,你現在就可以運行uclinux的make menuconfig,選中“CustomizeVendor/User Settings”,再選中“Miscellaneous Applications”,可以看到它現在出現了一個新的“sqlite (NEW)”,這個就是我們剛添加進去的sqlite項。<br><br> 在稍后的make romfs中,uclinux會將你的sqlite編譯進來,做成romfs的一部分,因為你在uClinux-dist/user/Makefile中已經加上要編譯sqlite項了。這樣在移植后的uclinux的/bin中將會有sqlite命令可以讓你來執行。<br><br> 好,現在我們就要對sqlite進行修改,來做移植工作。<br><br> 在下面的描述中,我們將對以下幾個文件進行一定的添加、修改,從而來完成sqlite在uclinux下的編譯:<br><br>
<table borderColor=#ffcc66 width="90%" align=center bgColor=#d8d8d1 border=1>
<tbody>
<tr>
<td>sqlite/main.mk 修改<br>sqlite/Makefile 添加<br>sqlite/src/os.c 修改<br>sqlite/src/shell.c 修改</td></tr></tbody></table>
<p><br> 對這幾個文件進行修改時,請自己做好這些文件的備份,比如你可以將它們拷貝一份,改名成文件名后面帶.bak。這個很重要,可以避免你在修改的過程出現問題而無法還原。<br><br>
<p align=right>  [1]  <a href=http://tech.sina.com.cn/other/2004-12-17/0840478375.shtml>[2]</a>  <a href=http://tech.sina.com.cn/other/2004-12-17/0840478376.shtml>[3]</a>  <a href=http://tech.sina.com.cn/other/2004-12-17/0840478377.shtml>[4]</a>  <a href=http://tech.sina.com.cn/other/2004-12-17/0840478378.shtml>[5]</a>  <a href=http://tech.sina.com.cn/other/2004-12-17/0840478379.shtml>[6]</a>  <a href=http://tech.sina.com.cn/other/2004-12-17/0840478375.shtml style=font-size:14px>[下一頁]</a><p>
<!--NEWSZW_HZH_BEGIN-->
<table border=0 cellspacing=0 cellpadding=0 align=left >
<!--
<table id="innerad" border=0 cellspacing=0 cellpadding=0 align=left style="display:none">
-->
<tr><td>
<!--畫中畫廣告開始-->
<table border=0 cellspacing=0 cellpadding=0 align=left>
<tr><td>
<!--科技新聞內頁畫中畫開始-->
<!--D61C4C53F9BB-->
<IFRAME MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 WIDTH=360 HEIGHT=300 SCROLLING=NO SRC="http://122.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|techpip&db=sina&border=0&local=yes">
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://122.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|techpip&db=sina&local=yes&js=on"></SCRIPT>
<NOSCRIPT><A HREF="http://122.adsina.allyes.com/main/adfclick?user=AFP6_for_SINA|Tech|techpip&db=sina"><IMG SRC="http://122.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|techpip&db=sina" WIDTH=360 HEIGHT=300 BORDER=0></a></NOSCRIPT></IFRAME>
<!--nwy/ms/1216/B-->
<!--科技新聞內頁畫中畫結束-->
</td></tr></table>
<!--畫中畫廣告結束-->
</td></tr>
<tr><td>
<!-- 畫中畫下文字鏈廣告(從上至下順序為01,02,03,04文字,需加class=a01)-->
<table width=360 border=0 cellpadding=0 cellspacing=0>
<tr><td height=9></td></tr>
<tr><td>
<table width=360 border=0 cellpadding=0 cellspacing=0 background=http://image2.sina.com.cn/dy/images/xfrd_02.gif>
<tr><td height=45 rowspan=2><img src=http://ad4.sina.com.cn/shc/xfrd_01.GIF width=70 height=45 border=0></td><td width=286 style='padding-top:4px;padding-left:5px'>
<!--F70BB90BB6BA--><!--nwy/uc/A-->
<script LANGUAGE="JavaScript">
ad1= "想送免費的歌曲祝福嗎";
link1= "http://bobo.sina.com.cn/";
//左上
ad2= "汽車生活方式大比拼";
link2= "http://adclient.dentsu.com.cn/html.ng/adspec=words&adtype=wen_zi_lian&affiliate=sina&campaignid=59&channel=ke_ji_page&log=0¶ms.styles=clickcmd?";
//右上
ad3= "天堂II 混沌的年代";
link3= "http://sinapay.sina.com.cn/tiantang/choose_style.html";
//左下
ad4= "天堂II 混沌的年代";
link4= "http://sinapay.sina.com.cn/tiantang/choose_style.html";
//右下
//瀏覽器類型變量
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
//ie內容
function IEad(){
adCode = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="280" HEIGHT="40" id="ad_note" ALIGN=""><PARAM NAME=movie VALUE="http://image2.sina.com.cn/dy/zwyhzh/ad_note.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=bgcolor VALUE=#FFFFFF> <param name="swLiveConnect" value="true"> '
+' <EMBED src="http://image2.sina.com.cn/dy/zwyhzh/ad_note.swf" quality=high wmode=transparent bgcolor=#FFFFFF WIDTH="280" HEIGHT="40" NAME="ad_note" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true"></EMBED></OBJECT>'
document.write(adCode);
document.getElementById('ad_note').SetVariable("ad1", ad1);
document.getElementById('ad_note').SetVariable("ad2", ad2);
document.getElementById('ad_note').SetVariable("ad3", ad3);
document.getElementById('ad_note').SetVariable("ad4", ad4);
document.getElementById('ad_note').SetVariable("link1", link1);
document.getElementById('ad_note').SetVariable("link2", link2);
document.getElementById('ad_note').SetVariable("link3", link3);
document.getElementById('ad_note').SetVariable("link4", link4);
}
//ns內容
function NSad(){
adCode = '<table width=286 border=0 cellpadding=0 cellspacing=0>'
+'<tr height=20><td width=143 style="padding-top:5px;padding-left:5px"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
+'<a href='+ link1 +' class=a01 target=_blank>'+ ad1 +'</a>'
+'</td><td width=143 style="padding-top:5px;"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
+'<a href='+ link2 +' class=a01 target=_blank>'+ ad2 +'</a>'
+'</td></tr>'
+'<tr height=20><td style="padding-left:5px"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
+'<a href='+ link3 +' class=a01 target=_blank>'+ ad3 +'</a>'
+'</td><td> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
+'<a href='+ link4 +' class=a01 target=_blank><SPAN ID="oSpan" UNSELECTABLE="on" >'+ ad4 +'</span></a></td></tr></table>'
document.write(adCode);
}
//主過程
if(InternetExplorer == true){
IEad();
}else{
NSad();
}
</script>
</td><td width=4 rowspan=2><img src=http://image2.sina.com.cn/dy/images/xfrd_03.gif width=4 height=45></td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
<!--NEWSZW_HZH_END-->
<table width=90% border=0 align=center>
<tr></tr>
</table>
<br clear=all>
<table width=565 border=0 cellspacing=0 cellpadding=0>
<tr><td class=f14 height=30 valign=top> 點擊此處查詢<a href=http://sinanews.chinasearch.com.cn/sinanews.exe?word=ucLinux target=_blank>全部<font color=red>ucLinux</font>新聞</a> <a href=http://sinanews.chinasearch.com.cn/sinanews.exe?word=操作系統 target=_blank>全部<font color=red>操作系統</font>新聞</a> </td></tr></table>
</td></tr>
</table>
</div>
<br>
<table width=560 border=0 cellspacing=0 cellpadding=0>
<tr><td class=f14>
<a href=http://tech.sina.com.cn/topnews/index.html>新浪科技24小時熱門新聞排行</a>
<a href=http://tech.sina.com.cn/down/drivers/>硬件驅動程序高速下載</a>
<br><br>
</td></tr>
<tr><td>
<table width=565 border=0 cellspacing=0 cellpadding=0>
<tr><td><form target="_blank" action="http://mms.sina.com.cn/xmlmms/xmlmmsQue.php" method="post" name="from_">
<input type="hidden" name="xmlCfg" value="http://rss.sina.com.cn/mms/tech/52/58/5/2-1-478374.xml">
<input type="hidden" name="sourceFrom" value="100001">
<input type="hidden" name="from" value="442">
<input type="submit" name="submit_" style="width:120" value="多種方式看新聞">
</form></td><td align=right>【<a href=http://comment.news.sina.com.cn/cgi-bin/comment/comment.cgi?channel=kj&newsid=478374>評論</a>】【<a href=http://forum.tech.sina.com.cn/cgi-bin/tree.cgi?gid=23&fid=288>應用軟件論壇</a>】【<a href=http://stat.sina.com.cn/cgi-bin/sms/edit_sms.cgi?title=ucLinux%CF%C2sqlite%C7%B6%C8%EB%CA%BD%CA%FD%BE%DD%BF%E2%D2%C6%D6%B2%C8%AB%B9%A5%C2%D4&url=tech.sina.com.cn/other/2004-12-17/0840478374.shtml>推薦</a>】【<a href="javascript:doZoom(16)">大</a> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a>】【<a href="javascript:doPrint()">打印</a>】【<a href=http://www.sina.com.cn/ddt/ target=_blank>下載點點通</a>】【<a href="javascript:window.close()">關閉</a>】</td></tr>
</table></td></tr>
</table>
<BR>
<table width=560 border=0 cellspacing=0 cellpadding=0>
<tr><td>
<!-- 正文底部小通欄 -->
<table width=585 border=0 cellpadding=0 cellspacing=0 align=center>
<tr><td>
<!--科技頻道內頁底部小通欄開始-->
<!--DCD3066795C5-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="585" HEIGHT="50">
<PARAM NAME=movie VALUE="http://ad4.sina.com.cn/200412/10/6765_picasso_tech_sfc_200412.swf"> <PARAM NAME=quality VALUE=high><param name=wmode value=opaque>
<EMBED src="http://ad4.sina.com.cn/200412/10/6765_picasso_tech_sfc_200412.swf" quality=high WIDTH="585" HEIGHT="50" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT><!--xinzhi/2004-12-17/B-->
<!--科技頻道內頁底部小通欄結束-->
</td></tr>
<tr><td height=5></td></tr>
</table>
</td></tr>
</table>
<br>
<table width=560 border=0 cellspacing=0 cellpadding=0>
<tr><td>
<div id=PublicRelation1 name="PublicRelation" style="DISPLAY:none">
<table><tr><td> </td>
<td class=f14>
<p><!--要求文字在17字以內!-->
<!--科技新聞內頁文字鏈01開始-->
<!--4EF9FD7107A8-->
<a href=http://ad.cn.doubleclick.net/clk;12480651;10609175;z?http://www-900.ibm.com/cn/servers/eserver/openpower/ target=_blank><font color=red>Linux,改變世界的力量</font></a><!--weixing/2004-12-16/B-->
<!--科技新聞內頁文字鏈01結束--> <!--994C252CDDD6-->
<a href=http://adclient.dentsu.com.cn/html.ng/adspec=image&adtype=wen_zi_lian&affiliate=sina&campaignid=59&channel=ke_ji_page&log=0¶ms.styles=clickcmd? target=_blank><font color=red>中法文化年,東風雪鐵龍典藏版限量而出</font></a><!--xinzhi/2004-12-31/B--></p>
</td></tr></table>
</div>
<SCRIPT>
//<!--廣告發布-->
<!--
if (checkPubTime(getPubTime()))
{
PublicRelation1.style.display="";
}
-->
</SCRIPT>
</td></tr>
</table>
</td><td width=1 bgcolor=#747474 rowspan=2></td><td width=129 valign=top></td></tr>
</table>
<!-- 右側功能條 begin -->
<div id="toolBar" style="position:absolute;display:'none'">
<table width=129 border=0 cellpadding=0 cellspacing=0>
<tr><td align=right>
<!-- 搜索 begin-->
<script language="javascript">
function select_cgi(fn)
{
search_form1 = fn;
if(search_form1._ss.value == "newstitle") //新聞標題
{
search_form1.searchcontent.name="word";
search_form1.action = "http://sinanews.zhongsou.com/sinanews.exe";
return;
}
else if(search_form1._ss.value == "newsft") //新聞全文
{
//alert("newsft");
search_form1.searchcontent.name="word";
search_form1.action = "http://sinanews.zhongsou.com/sinanews.exe";
return;
}
else if(search_form1._ss.value == "pic") //圖片
{
search_form1.searchcontent.name="query";
search_form1.action = "http://pic.sina.com.cn/cgi-bin/retr/search";
//search_form.action = "test.php";
return;
}
else if(search_form1._ss.value == "mp3") //MP3
{
//alert("mp3");
search_form1.searchcontent.name="_searchkey";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -