﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-乐在其中-随笔分类-嵌入式Linux</title><link>http://www.cnitblog.com/gouzhuang/category/8618.html</link><description>分享学习Linux的乐趣</description><language>zh-cn</language><lastBuildDate>Tue, 18 Oct 2011 23:25:56 GMT</lastBuildDate><pubDate>Tue, 18 Oct 2011 23:25:56 GMT</pubDate><ttl>60</ttl><item><title>再多挤压一点：移植squashfs-lzma(Squash More: Porting squashfs-lzma)</title><link>http://www.cnitblog.com/gouzhuang/archive/2011/10/17/squashfs-lzma.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Sun, 16 Oct 2011 16:10:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2011/10/17/squashfs-lzma.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/76073.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2011/10/17/squashfs-lzma.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/76073.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/76073.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 把支持LAMZ压缩算法的squashfs驱动程序移植到播放机内核&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2011/10/17/squashfs-lzma.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/76073.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2011-10-17 00:10 <a href="http://www.cnitblog.com/gouzhuang/archive/2011/10/17/squashfs-lzma.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>搭建NFS服务器(Setup NFS Server)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/11/04/nfs_server.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Thu, 04 Nov 2010 07:30:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/11/04/nfs_server.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/70788.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/11/04/nfs_server.html#Feedback</comments><slash:comments>24</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/70788.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/70788.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本文介绍如何在播放机上搭建NFS服务器&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/11/04/nfs_server.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/70788.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-11-04 15:30 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/11/04/nfs_server.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>不同编译环境性能比较</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/10/09/benchmark.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Sat, 09 Oct 2010 15:03:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/10/09/benchmark.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/69871.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/10/09/benchmark.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/69871.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/69871.html</trackback:ping><description><![CDATA[做了一个简单的对比测试：测量了在三种不同编译环境下完成相同的编译任务所用时间。<br><br>
<table width="720" border="1">
    <tbody>
        <tr>
            <td>编译环境<br></td>
            <td>CPU<br></td>
            <td valign="middle" align="left">&nbsp;内存</td>
            <td valign="middle" align="left">&nbsp;编译时间</td>
        </tr>
        <tr>
            <td>Linux PC 交叉编译<br></td>
            <td>Intel Core2 Duo T7500 @ 2.20GHz<br></td>
            <td valign="middle" align="left">&nbsp;2G</td>
            <td valign="middle" align="left">&nbsp;0m19.071s</td>
        </tr>
        <tr>
            <td valign="middle" align="left"><a title="海信高清播放机" href="http://www.kboox.com/cp/mp800h.html">MP800H</a> 本机编译<br></td>
            <td valign="middle" align="left">MIPS 24K V7.8<br></td>
            <td valign="middle" align="left">128M<br></td>
            <td valign="middle" align="left">&nbsp;9m 52.09s</td>
        </tr>
        <tr>
            <td valign="middle" align="left">QEMU仿真器本机编译</td>
            <td valign="middle" align="left">Intel Core2 Duo T7500 @ 2.20GHz 仿真 MIPS 24K</td>
            <td valign="middle" align="left">&nbsp;256M</td>
            <td valign="middle" align="left">&nbsp;37m 37.02s</td>
        </tr>
    </tbody>
</table>
<br>可见MP800H的性能大约是PC的1/30，而QEMU的性能则不到PC的1/100。<br><img src ="http://www.cnitblog.com/gouzhuang/aggbug/69871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-10-09 23:03 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/10/09/benchmark.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在QEMU MIPS仿真器上实现本机编译(Native Compiling on a QEMU Emulator)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/10/07/native_compiling_in_qemu.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Thu, 07 Oct 2010 10:07:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/10/07/native_compiling_in_qemu.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/69495.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/10/07/native_compiling_in_qemu.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/69495.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/69495.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 详细介绍如何在QEMU MIPS仿真器中安装Debian Linux操作系统，以及在其中部署编译环境。&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/10/07/native_compiling_in_qemu.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/69495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-10-07 18:07 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/10/07/native_compiling_in_qemu.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>搭建本机编译环境(Building the Native Compiling Environment)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/10/03/native_compile.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Sun, 03 Oct 2010 07:25:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/10/03/native_compile.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/69312.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/10/03/native_compile.html#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/69312.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/69312.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本文讲述了如何在播放机上搭建编译环境&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/10/03/native_compile.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/69312.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-10-03 15:25 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/10/03/native_compile.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Buildroot - 让交叉编译更轻松</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/09/29/buildroot.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Wed, 29 Sep 2010 03:08:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/09/29/buildroot.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/65447.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/09/29/buildroot.html#Feedback</comments><slash:comments>32</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/65447.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/65447.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 用Buildroot制作交叉编译工具链以及编译软件包&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/09/29/buildroot.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/65447.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-09-29 11:08 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/09/29/buildroot.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>更新：Buildroot - 让交叉编译更轻松</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/09/29/69307.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Wed, 29 Sep 2010 02:45:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/09/29/69307.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/69307.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/09/29/69307.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/69307.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/69307.html</trackback:ping><description><![CDATA[<a  href="http://www.cnitblog.com/gouzhuang/archive/2010/04/28/buildroot.html" id="_300cb6355946_HomePageDays_DaysList_ctl02_DayItem_DayList_ctl00_TitleUrl">Buildroot - 让交叉编译更轻松</a> 中加入了一些屏幕截图<br><img src ="http://www.cnitblog.com/gouzhuang/aggbug/69307.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-09-29 10:45 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/09/29/69307.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>完全接管遥控器(Total Remote Control)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/05/14/remote_control.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Thu, 13 May 2010 16:00:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/05/14/remote_control.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/65956.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/05/14/remote_control.html#Feedback</comments><slash:comments>35</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/65956.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/65956.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 通过修改遥控器驱动程序实现与播放程序共享遥控器，或者彻底接管遥控器。&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/05/14/remote_control.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/65956.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-05-14 00:00 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/05/14/remote_control.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mount --bind 的妙用</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/04/21/mount_bind.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Wed, 21 Apr 2010 05:42:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/04/21/mount_bind.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/65503.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/04/21/mount_bind.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/65503.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/65503.html</trackback:ping><description><![CDATA[在固件开发过程中常常遇到这样的情况：为测试某个新功能，必需修改某个系统文件。而这个文件在只读文件系统上（总不能为一个小小的测试就重刷固件吧），或者是虽然文件可写，但是自己对这个改动没有把握，不愿意直接修改。这时候mount --bind就是你的好帮手。<br><br>假设我们要改的文件是/etc/hosts，可按下面的步骤操作：<br><br>1. 把新的hosts文件放在/tmp下。当然也可放在硬盘或U盘上。<br>2. mount --bind /tmp/hosts /etc/hosts<br><br>测试完成了执行 umount /etc/hosts 断开绑定。<br><br>如果我需要在/etc下面增加一个exports文件怎么办？原来没有这个文件，不能直接bind。我们有两个方法：<br><br>方法1：绑定整个/etc目录，绑定前先复制/etc<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#&nbsp;cp&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">a&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">tmp<br>#&nbsp;mount&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">bind&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">tmp</span><span style="color: #000000;">/</span><span style="color: #000000;">etc&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span></div>
此时的/etc目录是可写的，所做修改不会应用到原来的/etc目录，可以放心测试。<br><br>方法2：挂载ramfs到/etc，同样要先复制/etc<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">挂载ramfs<br>#&nbsp;mkdir&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">tmp</span><span style="color: #000000;">/</span><span style="color: #000000;">etc<br>#&nbsp;mount&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">t&nbsp;ramfs&nbsp;none&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">tmp</span><span style="color: #000000;">/</span><span style="color: #000000;">etc<br><br>复制</span><span style="color: #000000;">/</span><span style="color: #000000;">etc，这里我们不能用cp&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">a，改用tar<br>#&nbsp;cd&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc<br>#&nbsp;tar&nbsp;cf&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;.&nbsp;</span><span style="color: #000000;">|</span><span style="color: #000000;">(cd&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">tmp</span><span style="color: #000000;">/</span><span style="color: #000000;">etc;&nbsp;tar&nbsp;xf&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">)<br>#&nbsp;cd&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;"><br><br>覆盖</span><span style="color: #000000;">/</span><span style="color: #000000;">etc<br>#&nbsp;mount&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">move&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">tmp</span><span style="color: #000000;">/</span><span style="color: #000000;">etc&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span></div>
测试完了记着 umount /etc<br><br><img src ="http://www.cnitblog.com/gouzhuang/aggbug/65503.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-04-21 13:42 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/04/21/mount_bind.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于固件制作</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/04/10/build_firmware.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Sat, 10 Apr 2010 14:24:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/04/10/build_firmware.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/65121.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/04/10/build_firmware.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/65121.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/65121.html</trackback:ping><description><![CDATA[这段时间忙于研究工具链的升级、搭建QEMU编译和测试环境以及给<a href="http://samba.org/">Samba</a>瘦身等等，没有及时更新博客，会在后续博文中给大家一一分享。<br><br>有朋友可能会问：为什么要自己费劲编译各种软件包，<a href="http://www.nslu2-linux.org/wiki/Optware/HomePage">Optware</a>不是提供大量交叉编译好的<a href="http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/">软件包</a>吗？这得从海信MP800H播放机的局限性说起。<br><br>这款播放机是较早的产品，采用的是NOR闪存来存储固件，成本高因此配备的容量较低，只有16M。而较新的播放机多采用NAND闪存，比NOR成本低，容量可以做得更大（比如MP801H配备了256M的NAND闪存）。16M的空间里系统引导程序(Bootloader)和急救程序占了1280K，/usr/local/etc文件系统占了384K，在剩下的14.4M空间里要挤进Linux内核（约4M）、音频驱动（约1.8M）、视频驱动（约2.1M）以及根文件系统（约44M），看起来似乎是不可完成的任务。其实上面四大件经过压缩以后总共只有12M，所以我们还有2.4M的闪存空间可用，按照4:1的压缩比估算还可以挤进9.6M的内容。<br><br>因此在对MP800H进行扩展时，软件包的大小成为一个极其重要的考虑因素。Optware的软件包都是连接的/opt/lib下的动态库，其中包括uclibc。如果在固件中使用optware，则需要安装两套uclibc，这不仅浪费了宝贵的flash存储，也浪费了内存，因为内存中要加载两套uclibc。自己编译软件包可以确保只使用一套动态连接库，并且可以对软件包的大小进行优化。<br><br>前面在<a  href="http://www.cnitblog.com/gouzhuang/archive/2010/03/16/fw_dissected.html" id="viewpost1_TitleUrl">《固件解析》</a>中已经提到，我们可以通过修改固件安装包里package1目录下有三个文件来制作自己的固件。这三个文件就是<br>
<ol>
    <li>Linux内核：vmlinux.develop.avhdd.mars.bin.lzma</li>
    <li>根文件系统：squashfs1.img</li>
    <li>/usr/local/etc文件系统：usr.local.etc.tar.bz2</li>
</ol>
关于内核的定制请参考<a  href="http://www.cnitblog.com/gouzhuang/archive/2010/03/21/compile_kernel.html" id="viewpost1_TitleUrl">《编译内核》</a>。根文件系统的制作要用到<a  href="http://squashfs.sourceforge.net/">squashfs</a>工具中的mksquashfs命令。需要注意的是播放机内核中的squashfs的版本是3.1，因此一定要使用3.x版的工具（3.0和3.4都可以）来制作squashfs1.img，如果用4.0版的mksquashfs，内核将无法挂载根文件系统。至于/usr/local/etc文件系统，它是播放机上唯一可写的闪存分区，用于存放一些允许修改的配置文件。我们可以根据需要对/usr/local/etc进行定制，不过它的容量只有384K。<br><br>自己刷固件极有可能把播放机变砖，刷机前请一定准备好串口线。<span style="font-family: Courier;">关于如何通过串口线救活砖机，请看蓝媒论坛dragon版主的大作<a  href="http://www.kboox.com/viewthread.php?tid=3700">《MP800H串口刷机指南》</a>。</span><img src ="http://www.cnitblog.com/gouzhuang/aggbug/65121.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-04-10 22:24 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/04/10/build_firmware.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hotplug应用实例：自动连接无线网</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/26/hotplug.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Fri, 26 Mar 2010 10:04:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/26/hotplug.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64804.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/26/hotplug.html#Feedback</comments><slash:comments>49</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64804.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64804.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 通过hotplug程序实现USB无线网卡自动配置&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/03/26/hotplug.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64804.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-26 18:04 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/26/hotplug.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>编译portmap和nfs-utils</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/23/nfs_utils.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Tue, 23 Mar 2010 08:24:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/23/nfs_utils.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64767.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/23/nfs_utils.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64767.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64767.html</trackback:ping><description><![CDATA[为了在播放机上实现NFS服务器的功能，我们已经在uClibc中打开了完整RPC支持，并且在新编译的内核中打开了NFS服务器支持。此外还有两个软件包也是提供NFS服务所必需的：<a href="http://en.wikipedia.org/wiki/Portmap">portmap</a>和<a href="http://nfs.sourceforge.net/">nfs-utils</a>。portmap为RPC程序提供端口映射服务，nfs-utils则是使用内核NFS服务器的支持程序。<br><br>编译portmap<br>1. 下载portmap_5beta: <a href="ftp://ftp.porcupine.org/pub/security/portmap_5beta.tar.gz">ftp://ftp.porcupine.org/pub/security/portmap_5beta.tar.gz</a><br>2. 打这个补丁: <a href="http://www.cnitblog.com/Files/gouzhuang/portmap_5beta.patch.zip" title="portmap_5beta.patch.zip">portmap_5beta.patch.zip</a> （补丁来自buildroot-2009.11，我只是把多个补丁合并成一个）<br>3. $ <span style="font-family: Courier;">make CC=mipsel-linux-gcc</span><br>4. <span style="font-family: Courier;">$ mipsel-linux-strip portmap</span><br><br>编译nfs-utils<br>1. 下载nfs-utils-1.1.1: http://nchc.dl.sourceforge.net/project/nfs/nfs-utils/1.1.1/nfs-utils-1.1.1.tar.gz<br>2. 打这个补丁: <a href="http://www.cnitblog.com/Files/gouzhuang/nfs-utils-1.1.1-uclibc.patch.zip" title="nfs-utils-1.1.1-uclibc.patch.zip">nfs-utils-1.1.1-uclibc.patch.zip</a> （在网上找到的，来源记不清了，我稍加了修改）<br>3. 运行配置脚本：<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">.</span><span style="color: #000000;">/</span><span style="color: #000000;">configure&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">build</span><span style="color: #000000;">=</span><span style="color: #000000;">i686</span><span style="color: #000000;">-</span><span style="color: #000000;">linux&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">host</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">disable</span><span style="color: #000000;">-</span><span style="color: #000000;">nfsv4&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">disable</span><span style="color: #000000;">-</span><span style="color: #000000;">gss&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">disable</span><span style="color: #000000;">-</span><span style="color: #000000;">uuid&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">disable</span><span style="color: #000000;">-</span><span style="color: #000000;">mount&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">without</span><span style="color: #000000;">-</span><span style="color: #000000;">tcp</span><span style="color: #000000;">-</span><span style="color: #000000;">wrappers&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">with</span><span style="color: #000000;">-</span><span style="color: #000000;">gnu</span><span style="color: #000000;">-</span><span style="color: #000000;">ld&nbsp;CC</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">gcc&nbsp;CPP</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">cpp&nbsp;AR</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">ar&nbsp;STRIP</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">strip&nbsp;RANLIB</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">ranlib&nbsp;LD</span><span style="color: #000000;">=</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">ld</span></div>
4. <span style="font-family: Courier;">$ make</span><br>5. 安装到/home/user/dist/nfs-utils目录<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;make&nbsp;DESTDIR</span><span style="color: #000000;">=/</span><span style="color: #000000;">home</span><span style="color: #000000;">/</span><span style="color: #000000;">user</span><span style="color: #000000;">/</span><span style="color: #000000;">dist</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">-</span><span style="color: #000000;">utils&nbsp;install</span><span style="color: #000000;">-</span><span style="color: #000000;">strip</span></div>
<br>在制作固件时，我们只需要几个编译好的程序：<span style="font-family: Courier;">portmap, rpc.statd, rpc.nfsd, rpc.mountd, exportfs</span>。其中<span style="font-family: Courier;">portmap</span> 放到<span style="font-family: Courier;">/sbin</span>下，其余的放到<span style="font-family: Courier;">/usr/sbin</span>下。<br>此外还需要一个NFS服务启动脚本S60nfs，放在/etc/init.d目录下。下载脚本<a href="http://www.cnitblog.com/Files/gouzhuang/S60nfs.zip" title="S60nfs.zip">S60nfs.zip</a> (来自buildroot，我把portmap的启动加进去了）<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #000000;">#</span><span style="color: #000000;">!/</span><span style="color: #000000;">bin</span><span style="color: #000000;">/</span><span style="color: #000000;">sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #000000;">#&nbsp;nfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;shell&nbsp;script&nbsp;takes&nbsp;care&nbsp;of&nbsp;starting&nbsp;and&nbsp;stopping<br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #000000;">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;NFS&nbsp;services.&nbsp;Stolen&nbsp;from&nbsp;RedHat&nbsp;FC5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;">[&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">portmap&nbsp;]&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;exit&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;">[&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">rpc.statd&nbsp;]&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;exit&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">[&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">rpc.nfsd&nbsp;]&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;exit&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">&nbsp;<br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">[&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">rpc.mountd&nbsp;]&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;exit&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;"><br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">[&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">exportfs&nbsp;]&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;exit&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">&nbsp;&nbsp;<br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">12</span>&nbsp;<span style="color: #000000;">#&nbsp;Don</span><span style="color: #000000;">'</span><span style="color: #000000;">t&nbsp;fail&nbsp;if&nbsp;/etc/exports&nbsp;doesn</span><span style="color: #000000;">'</span><span style="color: #000000;">t&nbsp;exist;&nbsp;create&nbsp;a&nbsp;bare</span><span style="color: #000000;">-</span><span style="color: #000000;">bones&nbsp;version&nbsp;and&nbsp;</span><span style="color: #0000ff;">continue</span><span style="color: #000000;">.<br></span><span style="color: #008080;">13</span>&nbsp;<span style="color: #000000;">[&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">r&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span><span style="color: #000000;">/</span><span style="color: #000000;">exports&nbsp;]&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">14</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span><span style="color: #000000;">/</span><span style="color: #000000;">exports&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;chmod&nbsp;u</span><span style="color: #000000;">+</span><span style="color: #000000;">rw,g</span><span style="color: #000000;">+</span><span style="color: #000000;">r,o</span><span style="color: #000000;">+</span><span style="color: #000000;">r&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">etc</span><span style="color: #000000;">/</span><span style="color: #000000;">exports&nbsp;;&nbsp;}&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">15</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">/etc/exports&nbsp;does&nbsp;not&nbsp;exist</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;;&nbsp;exit&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">&nbsp;;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">16</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">17</span>&nbsp;<span style="color: #000000;">#&nbsp;The&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs&nbsp;directory&nbsp;</span><span style="color: #0000ff;">is</span><span style="color: #000000;">&nbsp;actually&nbsp;on&nbsp;a&nbsp;tmpfs&nbsp;filesystem.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">18</span>&nbsp;<span style="color: #000000;">mkdir&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">p&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">/</span><span style="color: #000000;">sm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">19</span>&nbsp;<span style="color: #000000;">mkdir&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">p&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">/</span><span style="color: #000000;">sm.bak&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">20</span>&nbsp;<span style="color: #000000;">touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">/</span><span style="color: #000000;">etab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">21</span>&nbsp;<span style="color: #000000;">touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">/</span><span style="color: #000000;">rmtab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">22</span>&nbsp;<span style="color: #000000;">touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">/</span><span style="color: #000000;">state&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">23</span>&nbsp;<span style="color: #000000;">touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #000000;">lib</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs</span><span style="color: #000000;">/</span><span style="color: #000000;">xtab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">24</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">25</span>&nbsp;<span style="color: #000000;">start()&nbsp;{<br></span><span style="color: #008080;">26</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Start&nbsp;daemons.<br></span><span style="color: #008080;">27</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Starting&nbsp;port&nbsp;mapper:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">28</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;portmap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">29</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">30</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">31</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Starting&nbsp;NFS&nbsp;statd:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">32</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rpc.statd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">33</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #0000ff;">lock</span><span style="color: #000000;">/</span><span style="color: #000000;">subsys</span><span style="color: #000000;">/</span><span style="color: #000000;">nfslock<br></span><span style="color: #008080;">34</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">35</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">36</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Starting&nbsp;NFS&nbsp;services:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">37</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">exportfs&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">r&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">38</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rpc.statd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">39</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">40</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">41</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Starting&nbsp;NFS&nbsp;daemon:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">42</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rpc.nfsd&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">43</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">44</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">45</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Starting&nbsp;NFS&nbsp;mountd:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">46</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rpc.mountd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">47</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">48</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #0000ff;">lock</span><span style="color: #000000;">/</span><span style="color: #000000;">subsys</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">49</span>&nbsp;<span style="color: #000000;">}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">50</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">51</span>&nbsp;<span style="color: #000000;">stop()&nbsp;{<br></span><span style="color: #008080;">52</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Stop&nbsp;daemons.<br></span><span style="color: #008080;">53</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Shutting&nbsp;down&nbsp;NFS&nbsp;mountd:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">54</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;killall&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">q&nbsp;rpc.mountd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">55</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">56</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">57</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Shutting&nbsp;down&nbsp;NFS&nbsp;daemon:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">58</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kill&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">9</span><span style="color: #000000;">&nbsp;`pidof&nbsp;nfsd`&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">&gt;/</span><span style="color: #000000;">dev</span><span style="color: #000000;">/</span><span style="color: #0000ff;">null</span><span style="color: #000000;">&nbsp;<br></span><span style="color: #008080;">59</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">60</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">61</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Shutting&nbsp;down&nbsp;NFS&nbsp;services:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">62</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">exportfs&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">au&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">63</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">f&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #0000ff;">lock</span><span style="color: #000000;">/</span><span style="color: #000000;">subsys</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">64</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;killall&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">q&nbsp;rpc.statd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="color: #008080;">65</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">66</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">67</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Stopping&nbsp;NFS&nbsp;statd:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">68</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;killall&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">q&nbsp;rpc.statd<br></span><span style="color: #008080;">69</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">70</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">f&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #0000ff;">lock</span><span style="color: #000000;">/</span><span style="color: #000000;">subsys</span><span style="color: #000000;">/</span><span style="color: #000000;">nfslock<br></span><span style="color: #008080;">71</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">72</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">n&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Stopping&nbsp;port&nbsp;mapper:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">73</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;killall&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">q&nbsp;portmap<br></span><span style="color: #008080;">74</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">done</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">75</span>&nbsp;<span style="color: #000000;">}<br></span><span style="color: #008080;">76</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">77</span>&nbsp;<span style="color: #000000;">#&nbsp;See&nbsp;how&nbsp;we&nbsp;were&nbsp;called.<br></span><span style="color: #008080;">78</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">case</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">$1</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">in</span><span style="color: #000000;"><br></span><span style="color: #008080;">79</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;start)<br></span><span style="color: #008080;">80</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start<br></span><span style="color: #008080;">81</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;;<br></span><span style="color: #008080;">82</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;stop)<br></span><span style="color: #008080;">83</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stop<br></span><span style="color: #008080;">84</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;;<br></span><span style="color: #008080;">85</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;restart)<br></span><span style="color: #008080;">86</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stop<br></span><span style="color: #008080;">87</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start<br></span><span style="color: #008080;">88</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;;<br></span><span style="color: #008080;">89</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;reload)<br></span><span style="color: #008080;">90</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">sbin</span><span style="color: #000000;">/</span><span style="color: #000000;">exportfs&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">r<br></span><span style="color: #008080;">91</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;touch&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">var</span><span style="color: #000000;">/</span><span style="color: #0000ff;">lock</span><span style="color: #000000;">/</span><span style="color: #000000;">subsys</span><span style="color: #000000;">/</span><span style="color: #000000;">nfs<br></span><span style="color: #008080;">92</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;;<br></span><span style="color: #008080;">93</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">)<br></span><span style="color: #008080;">94</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">Usage:&nbsp;nfs&nbsp;{start|stop|reload}</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">95</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;"><br></span><span style="color: #008080;">96</span>&nbsp;<span style="color: #000000;">esac<br></span><span style="color: #008080;">97</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">98</span>&nbsp;<span style="color: #000000;">exit&nbsp;</span><span style="color: #000000;">0</span></div>
<br><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64767.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-23 16:24 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/23/nfs_utils.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>编译内核(Compile the Kernel)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/21/compile_kernel.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Sun, 21 Mar 2010 13:49:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/21/compile_kernel.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64736.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/21/compile_kernel.html#Feedback</comments><slash:comments>132</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64736.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64736.html</trackback:ping><description><![CDATA[<a href="http://zh.wikipedia.org/zh-cn/Linux%E5%86%85%E6%A0%B8">Linux内核</a>负责管理/调度所有的系统资源和设备，并为应用程序提供服务。要想让播放机支持更多的设备，比如USB无线网卡，必需从内核入手。Linux支持动态加载模块，这些模块其实也是内核的一部分，只不过是被模块化罢了。模块化的好处之一是可以在需要时才加载模块，不需要时可以卸载，释放其占用的内存。这对内存紧张的嵌入式系统无疑是有帮助的。<br><br>我重新编译内核有以下几个目的：<br>1) 打开官方内核中某些没有打开的功能，如NFS服务器。<br>2) 尝试支持更多外部设备，如编译第三方驱动程序。<br>3) 内核瘦身，比如关闭某些不需要的功能，或者将其编译成模块。<br><br>内核源码仍使用<a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html">华硕公布的源码</a>，其中名为<span style="font-family: Courier;">linux-2.6.12.274877.tgz</span>的文件即是内核源码。用<span style="font-family: Courier;">tar zxf linux-2.6.12.274877.tgz解开此文件，得到linux-2.6.12目录。看一下版本号<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;grep&nbsp;UTS_RELEASE&nbsp;linux</span><span style="color: #000000;">-</span><span style="color: #000000;">2.6</span><span style="color: #000000;">.</span><span style="color: #000000;">12</span><span style="color: #000000;">/</span><span style="color: #000000;">include</span><span style="color: #000000;">/</span><span style="color: #000000;">linux</span><span style="color: #000000;">/</span><span style="color: #000000;">version.h<br></span><span style="color: #008080;">2</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;UTS_RELEASE&nbsp;"2.6.12.6-VENUS"</span></div>
与在播放机上用'uname -r'看到的一样，因此我们能确信这就是播放机所用内核的源码，虽然来源不是海信，但是我认为海信不会在内核上做什么改动，最多不过调整一些配置参数。<br><br>粗略研究了一下内核源码，发现Realtek在原始的2.6.12.6内核基础上做了不少修改，下面列出其中一部分：<br></span>
<ol>
    <li>文件系统方面增加了</li>
    <ul>
        <li>fuse - Filesystem in Userspace</li>
        <li>ptp - Picture Transfer Protocol，用于数码相机</li>
        <li>vcd - CDROM文件系统</li>
        <li>squashfs - 压缩的只读文件系统</li>
        <li>yaffs - 针对NAND闪存优化的文件系统</li>
    </ul>
    <li>大量的MIPS平台更新，其中包括对Realtek Venus系统（就是播放机所用系统）的支持</li>
    <li>增加了Realtek无线网卡支持，包括RTL8185，RTL8187，RTL8190，RTL8192，RTL8191SU等芯片组的支持。</li>
    <li>增加了一些专门针对Realtek Venus的优化</li>
</ol>
<span style="font-family: Courier;">linux-2.6.12目录下有两个配置文件样本：config.develop.avhdd.mars.old 和 config.rescue.usb.flash.mars.old。根据字面意思推测第一个文件是常规模式的内核配置，第二个是急救模式的内核配置。急救模式只保留了急救固件升级所需功能，因此编译出的内核比常规模式的小很多。在<span style="font-family: Times New Roman;"><a title="海信高清播放机" href="http://www.kboox.com/cp/mp800h.html">MP800H</a></span>上，急救内核与Bootloader放在同一个flash分区内，正常的固件升级不会更新这一部分。关于通过串口激活急救模式进行固件升级的方法，请看蓝媒论坛dragon版主的大作<a href="http://www.kboox.com/viewthread.php?tid=3700">《MP800H串口刷机指南》</a>。<br>我以config.develop.avhdd.mars.old为基准对内核进行配置(执行make menuconfig)，打开了NFS Server Support（编译成模块，并且只打开NFSv3支持），其余部分保持不变，最后得到的.config文件增加了如下几项：<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">CONFIG_NFSD</span><span style="color: #000000;">=</span><span style="color: #000000;">m<br></span><span style="color: #008080;">2</span>&nbsp;<span style="color: #000000;">CONFIG_NFSD_V3</span><span style="color: #000000;">=</span><span style="color: #000000;">y<br></span><span style="color: #008080;">3</span>&nbsp;<span style="color: #000000;">CONFIG_NFSD_TCP</span><span style="color: #000000;">=</span><span style="color: #000000;">y<br></span><span style="color: #008080;">4</span>&nbsp;<span style="color: #000000;">CONFIG_EXPORTFS</span><span style="color: #000000;">=</span><span style="color: #000000;">m</span></div>
然后执行make进行编译（注意：编译内核要用/usr/bin下的工具链，即mipsel-sdelinux-v6.03.01-1，在PATH中/usr/bin应该在/usr/local/bin的前面）。编译完成后会生成名为vmlinux.bin的文件，用lzma把它压缩后改名为vmlinux.develop.avhdd.mars.bin.lzma，这个文件即可用于制作固件。另外还需要把编译好的模块安装到某个目录以便于打包，比如要安装到/home/user/dist/modules则执行如下命令：<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">make&nbsp;INSTALL_MOD_PATH</span><span style="color: #000000;">=/</span><span style="color: #000000;">home</span><span style="color: #000000;">/</span><span style="color: #000000;">user</span><span style="color: #000000;">/</span><span style="color: #000000;">dist</span><span style="color: #000000;">/</span><span style="color: #000000;">modules&nbsp;modules_install</span></div>
至此，我们已经准备好了新的内核和模块。在用自己编译的模块替换官方固件模块时要注意两点：<br>1. 如果配置内核是打开了DEBUG，编译出的模块会很大，在制作固件前最好把调试信息去掉。下面的命令可以很容易的完成这个任务：<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;cd&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">home</span><span style="color: #000000;">/</span><span style="color: #000000;">user</span><span style="color: #000000;">/</span><span style="color: #000000;">dist</span><span style="color: #000000;">/</span><span style="color: #000000;">modules<br></span><span style="color: #008080;">2</span>&nbsp;<span style="color: #000000;">$&nbsp;find&nbsp;.&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">name&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">*.ko</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">exec&nbsp;mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">strip&nbsp;</span><span style="color: #000000;">--</span><span style="color: #000000;">strip</span><span style="color: #000000;">-</span><span style="color: #000000;">unneeded&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">{}</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;\;</span></div>
2. 有一个模块ufsd.ko是没有源码的，这个模块提供NTFS读写的支持。如果你想使用NTFS，则要从官方固件中拷贝这个文件。<br><br></span><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64736.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-21 21:49 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/21/compile_kernel.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>测试uClibc+BusyBox</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/18/test_uc_bb.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Thu, 18 Mar 2010 15:37:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/18/test_uc_bb.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64721.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/18/test_uc_bb.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64721.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64721.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: uClibc和BusyBox已经编译好了，在把它们加入固件之前最好先测试一下。测试方法是建立一个模拟的根文件系统，通过chroot命令来建立一个新的执行环境，在这个环境下所执行的命令以及动态连接库都来自于这个模拟的根文件系统。模拟根文件系统的制作方法（在PC上执行）：准备一个U盘或移动硬盘，格式化成ext3文件系统。假设编译好的uClibc和BusyBox分别放在/home/user/dist...&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/03/18/test_uc_bb.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64721.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-18 23:37 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/18/test_uc_bb.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重新编译uClibc</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/18/build_uclibc.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Thu, 18 Mar 2010 07:16:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/18/build_uclibc.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64674.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/18/build_uclibc.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64674.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64674.html</trackback:ping><description><![CDATA[MP800H官方固件中使用的<a href="http://www.uclibc.org/">uClibc</a>版本为0.9.28，也是相当老的版本（2005年发布的）。但是由于现有的工具链都是基于这个版本的，到目前为止，升级到新版本的尝试还不成功的。（这不是目前最紧迫的任务，我会晚点再研究）<br><br>既然不升级，为什么还要重新编译呢？因为官方编译的版本没有打开完整RPC支持（配置文件中：UCLIBC_HAS_FULL_RPC=y），没有它NFS服务器不能工作。<br><br>还是用<a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html">华硕公布的源码</a>。华硕在uClibc-0.9.28官方源码基础上做了一些修改（我把它整理成针对官方版的补丁：<a href="http://www.cnitblog.com/Files/gouzhuang/uClibc-0.9.28-asus.patch.zip" title="uClibc-0.9.28-asus.patch.zip">uClibc-0.9.28-asus.patch.zip</a>）<br>工具链就用华硕源码包里提供的sdelinux-5.03.06-1<br><br>配置uClibc：进入uClibc-0.9.28源码目录，执行<span style="font-family: Courier;">make menuconfig</span>进行交互是配置。（我用的配置：<a href="http://www.cnitblog.com/Files/gouzhuang/config-uclibc-0.9.28.zip" title="config-uclibc-0.9.28.zip">config-uclibc-0.9.28.zip</a>，可直接将此配置文件解压后改名为.config放入uClibc源码目录，然后再执行<span style="font-family: Courier;">make menuconfig</span>在此基础上进行修改）。<br>
<p>配置时有一点需要注意：有一项配置叫做"Linux kernel header location"，需要填入Linux内核头文件的路径，这个必需与播放机上运行的内核版本一致。这里我还是用华硕的Linux内核源码。源码包里有个文件叫linux-2.6.12.274877.tgz，将它解开<span style="font-family: Courier;"> tar zxf linux-2.6.12.274877.tgz</span>，得到linux-2.6.12目录，将"Linux kernel header location"指向这个目录。</p>
<br>配置完成后执行<span style="font-family: Courier;">make</span>进行编译，然后<span style="font-family: Courier;">安装到指定目录以便于打包，这里以/home/user/dist/uclibc为例<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">make&nbsp;PREFIX</span><span style="color: #000000;">=/</span><span style="color: #000000;">home</span><span style="color: #000000;">/</span><span style="color: #000000;">user</span><span style="color: #000000;">/</span><span style="color: #000000;">dist</span><span style="color: #000000;">/</span><span style="color: #000000;">uclibc&nbsp;install</span></div>
<br>到这里，我们已经有了自己编译的uClibc和BusyBox，下一步就是要测试一下它们是否能正常工作。我将在下一篇博文中介绍。<br></span><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64674.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-18 15:16 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/18/build_uclibc.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>升级BusyBox</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/busybox.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Tue, 16 Mar 2010 07:58:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/busybox.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64673.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/busybox.html#Feedback</comments><slash:comments>45</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64673.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64673.html</trackback:ping><description><![CDATA[海信MP800H官方固件里的<a href="http://www.busybox.net/">busybox</a>版本是1.1.3，是2006年发布的，确实有点老旧。最新的稳定版是2009年12月发布的1.15.3，与1.1.3版相比修正了很多bug并增加了一些新的应用程序(applet)，特别是增加了ftpd。当然也有一些应用被删除了：e2fsprogs（ext2/ext3文件系统工具: mke2fs, e2fsck, tune2fs等），原因是它相对于busybox来说太大了。其实e2fsprogs并非播放机必需的，而且这些工具可以在台式机上获得。因此我决定要把busybox升级到1.15.3。<br><br><a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html">华硕公布的源码</a>中busybox-1.1.3有一部分被修改过，其中init增加了对SIGABRT(6)信号的处理，当init进程收到此信号时(kill -6 1)，将触发固件升级程序。详细过程请看/etc/reexec_init下的脚本。我希望能保留该功能，将它移植到1.15.3（见补丁:<a href="http://www.cnitblog.com/Files/gouzhuang/busybox-1.15.3-reexec_init.patch.zip" title="busybox-1.15.3-reexec_init.patch.zip">busybox-1.15.3-reexec_init.patch.zip</a>）<br><br>另外，目前busybox测试版1.16.0中新增了ntpd，我把它给backport到1.15.3（见补丁:<a href="http://www.cnitblog.com/Files/gouzhuang/busybox-1.15.3-ntpd.patch.zip" title="busybox-1.15.3-ntpd.patch.zip">busybox-1.15.3-ntpd.patch.zip</a>）。ntpd 对MP800H来说相当重要，因为播放机没有电池为时钟供电，只要重新加电系统时间就会重置，有了ntpd就可实现与ntp服务器自动时间同步。<br><br>编译busybox-1.15.3<br>1) 下载源码 <a href="http://www.busybox.net/downloads/busybox-1.15.3.tar.bz2">http://www.busybox.net/downloads/busybox-1.15.3.tar.bz2</a><br>2) 解压<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;tar&nbsp;jxf&nbsp;busybox</span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;">.tar.bz2</span></div>
3) 打补丁<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #000000;">$&nbsp;ls&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">l<br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;">总用量&nbsp;</span><span style="color: #000000;">113</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #000000;">drwxr</span><span style="color: #000000;">-</span><span style="color: #000000;">xr</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">31</span><span style="color: #000000;">&nbsp;user&nbsp;users&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">1224</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2009</span><span style="color: #000000;">-</span><span style="color: #000000;">12</span><span style="color: #000000;">-</span><span style="color: #000000;">13</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">05</span><span style="color: #000000;">:</span><span style="color: #000000;">18</span><span style="color: #000000;">&nbsp;busybox</span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #000000;"></span><span style="color: #000000;">-</span><span style="color: #000000;">rw</span><span style="color: #000000;">-</span><span style="color: #000000;">r</span><span style="color: #000000;">--</span><span style="color: #000000;">r</span><span style="color: #000000;">--</span><span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">&nbsp;user&nbsp;users&nbsp;</span><span style="color: #000000;">108352</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2010</span><span style="color: #000000;">-</span><span style="color: #000000;">03</span><span style="color: #000000;">-</span><span style="color: #000000;">16</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">14</span><span style="color: #000000;">:</span><span style="color: #000000;">51</span><span style="color: #000000;">&nbsp;busybox</span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;">-</span><span style="color: #000000;">ntpd.patch<br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;"></span><span style="color: #000000;">-</span><span style="color: #000000;">rw</span><span style="color: #000000;">-</span><span style="color: #000000;">r</span><span style="color: #000000;">--</span><span style="color: #000000;">r</span><span style="color: #000000;">--</span><span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">&nbsp;user&nbsp;users&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">3216</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2010</span><span style="color: #000000;">-</span><span style="color: #000000;">03</span><span style="color: #000000;">-</span><span style="color: #000000;">16</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">14</span><span style="color: #000000;">:</span><span style="color: #000000;">51</span><span style="color: #000000;">&nbsp;busybox</span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;">-</span><span style="color: #000000;">reexec_init.patch<br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;">$&nbsp;cd&nbsp;busybox</span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;">/</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;">$&nbsp;patch&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">p1&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;..</span><span style="color: #000000;">/</span><span style="color: #000000;"><a title="BusyBox: the swiss army knife of embedded linux" href="http://www.busybox.net/">BusyBox</a></span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;">-</span><span style="color: #000000;">ntpd.patch<br></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;include</span><span style="color: #000000;">/</span><span style="color: #000000;">applets.h<br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;include</span><span style="color: #000000;">/</span><span style="color: #000000;">libbb.h<br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;include</span><span style="color: #000000;">/</span><span style="color: #000000;">usage.h<br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;libbb</span><span style="color: #000000;">/</span><span style="color: #000000;">messages.c<br></span><span style="color: #008080;">12</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;networking</span><span style="color: #000000;">/</span><span style="color: #000000;">Config.</span><span style="color: #0000ff;">in</span><span style="color: #000000;"><br></span><span style="color: #008080;">13</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;networking</span><span style="color: #000000;">/</span><span style="color: #000000;">Kbuild<br></span><span style="color: #008080;">14</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;networking</span><span style="color: #000000;">/</span><span style="color: #000000;">ntpd.c<br></span><span style="color: #008080;">15</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;networking</span><span style="color: #000000;">/</span><span style="color: #000000;">ntpd_simple.c<br></span><span style="color: #008080;">16</span>&nbsp;<span style="color: #000000;">$&nbsp;patch&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">p1&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;..</span><span style="color: #000000;">/</span><span style="color: #000000;"><a title="BusyBox: the swiss army knife of embedded linux" href="http://www.busybox.net/">BusyBox</a></span><span style="color: #000000;">-</span><span style="color: #000000;">1.15</span><span style="color: #000000;">.</span><span style="color: #000000;">3</span><span style="color: #000000;">-</span><span style="color: #000000;">reexec_init.patch<br></span><span style="color: #008080;">17</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;init</span><span style="color: #000000;">/</span><span style="color: #000000;">Config.</span><span style="color: #0000ff;">in</span><span style="color: #000000;"><br></span><span style="color: #008080;">18</span>&nbsp;<span style="color: #000000;">patching&nbsp;file&nbsp;init</span><span style="color: #000000;">/</span><span style="color: #000000;">init.c</span></div>
4) 配置busybox<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;make&nbsp;menuconfig</span></div>
配置完成后会生成一个.config文件，注意前面有个点。这是我的配置文件：<a href="http://www.cnitblog.com/Files/gouzhuang/config-busybox-1.15.3.zip" title="config-busybox-1.15.3.zip">config-busybox-1.15.3.zip</a><br>5) 编译<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;make</span></div>
6) 安装到指定的目录，比如/home/user/dist/busybox<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">$&nbsp;make&nbsp;CONFIG_PREFIX</span><span style="color: #000000;">=/</span><span style="color: #000000;">home</span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">dist</span><span style="color: #000000;">/</span><span style="color: #000000;"><a title="BusyBox: the swiss army knife of embedded linux" href="http://www.busybox.net/">BusyBox</a>&nbsp;install</span></div>
<br><span style="font-weight: bold;">补充</span>：<br>用华硕提供的工具链sdelinux-5.03.06-1进行编译时会报ULLONG_MAX undeclared的错误。解决办法是对其中一个头文件打下面的补丁：<br>头文件：/usr/local/lib/gcc-lib/mipsel-linux/2.96-sdelinuxmips-040127/include/limits.h<br>补丁如下：<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">---</span><span style="color: #000000;">&nbsp;limits.h.orig&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">2004</span><span style="color: #000000;">-</span><span style="color: #000000;">02</span><span style="color: #000000;">-</span><span style="color: #000000;">12</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">20</span><span style="color: #000000;">:</span><span style="color: #000000;">38</span><span style="color: #000000;">:</span><span style="color: #000000;">47.000000000</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">0800</span><span style="color: #000000;"><br></span><span style="color: #000000;">+++</span><span style="color: #000000;">&nbsp;limits.h&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">2010</span><span style="color: #000000;">-</span><span style="color: #000000;">03</span><span style="color: #000000;">-</span><span style="color: #000000;">02</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">08</span><span style="color: #000000;">:</span><span style="color: #000000;">53</span><span style="color: #000000;">:</span><span style="color: #000000;">11.984943511</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">0800</span><span style="color: #000000;"><br>@@&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">94</span><span style="color: #000000;">,</span><span style="color: #000000;">5</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">94</span><span style="color: #000000;">,</span><span style="color: #000000;">12</span><span style="color: #000000;">&nbsp;@@<br>&nbsp;#define&nbsp;ULONG_LONG_MAX&nbsp;(LONG_LONG_MAX&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">&nbsp;2ULL&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">)<br>&nbsp;#endif<br><br></span><span style="color: #000000;">+/*</span><span style="color: #000000;">&nbsp;Minimum&nbsp;</span><span style="color: #0000ff;">and</span><span style="color: #000000;">&nbsp;maximum&nbsp;values&nbsp;a&nbsp;`signed&nbsp;</span><span style="color: #0000ff;">long</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">long</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">'</span><span style="color: #008000;">&nbsp;can&nbsp;hold.&nbsp;&nbsp;*/</span><span style="color: #008000;"><br></span><span style="color: #000000;">+</span><span style="color: #000000;">#define&nbsp;LLONG_MAX&nbsp;&nbsp;&nbsp;&nbsp;9223372036854775807LL<br></span><span style="color: #000000;">+</span><span style="color: #000000;">#define&nbsp;LLONG_MIN&nbsp;&nbsp;&nbsp;&nbsp;(</span><span style="color: #000000;">-</span><span style="color: #000000;">LLONG_MAX&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;1LL)<br></span><span style="color: #000000;">+</span><span style="color: #000000;"><br></span><span style="color: #000000;">+/*</span><span style="color: #000000;">&nbsp;Maximum&nbsp;value&nbsp;an&nbsp;`unsigned&nbsp;</span><span style="color: #0000ff;">long</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">long</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">'</span><span style="color: #008000;">&nbsp;can&nbsp;hold.&nbsp;&nbsp;(Minimum&nbsp;is&nbsp;0.)&nbsp;&nbsp;*/</span><span style="color: #008000;"><br></span><span style="color: #000000;">+</span><span style="color: #000000;">#define&nbsp;ULLONG_MAX&nbsp;&nbsp;&nbsp;18446744073709551615ULL<br></span><span style="color: #000000;">+</span><span style="color: #000000;"><br>&nbsp;#endif&nbsp;</span><span style="color: #000000;">/*</span><span style="color: #000000;">&nbsp;_MACH_MACHLIMITS_H_&nbsp;</span><span style="color: #000000;">*/</span><span style="color: #000000;"><br>&nbsp;#endif&nbsp;</span><span style="color: #000000;">/*</span><span style="color: #000000;">&nbsp;_LIMITS_H___&nbsp;</span><span style="color: #000000;">*/</span></div>
<br><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64673.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-16 15:58 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/16/busybox.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>交叉编译(Cross Compiling)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/cross_compiling.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Tue, 16 Mar 2010 04:55:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/cross_compiling.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64663.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/cross_compiling.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64663.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64663.html</trackback:ping><description><![CDATA[RTD1073是基于32位MIPS指令集的，与我们常用的x86平台是不兼容的。为了能够生成在RTD1073上运行的程序，必然要用到交叉编译工具。<br>简单说，交叉编译就是在一个平台（编译平台/build platform）上生成另一个平台（目标平台/target platform）的执行代码。通常目标平台是一些运算能力较弱的嵌入式系统。交叉编译工具链（cross compile tool chain）是指用于交叉编译的一系列工具，主要包括C/C++编译器、函数库（libc, libstdc++等）、binutils等。C函数库libc常用的有两种：大而全的<a  href="http://www.gnu.org/software/libc/">glibc</a>(GNU C Library) 和小巧的<a  href="http://www.uclibc.org/">uClibc</a>。嵌入是系统由于受内存和flash存储空间的限制，通常都使用uClibc。<br>早前提到的<a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html">华硕的公开源码包</a>中提供了有两套工具链：一套用于应用程序编译，一套用于Linux内核编译，并附有安装说明。在网上搜搜还能找到其它厂商公布的源码和工具链，只要是基于RTD1073或其姊妹产品的，内核源码和工具链都是一样的，相信它们都源自Realtek。<br>交叉编译工具常常在命令前加一个前缀，比如上述两套工具链都使用'mipsel-linux-'的前缀。如果将两套工具链安装在一个系统里，可以通过PATH环境变量来选择所用的工具链。具体地说，用于AP(应用程序)的工具链安装在/usr/local/bin；用于内核的工具链安装在/usr/bin。要选择AP工具链就在PATH中将/usr/local/bin放在/usr/bin前面，反之亦然。<br>写一个hello.c程序试试看<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">stdio.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">2</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;main(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;argc,&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">*</span><span style="color: #000000;">&nbsp;argv[])&nbsp;{<br></span><span style="color: #008080;">3</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">Hello,&nbsp;world!\n</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">4</span>&nbsp;<span style="color: #000000;">}</span></div>
编译<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%; font-family: Courier;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #000000;">$&nbsp;which&nbsp;mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">gcc<br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;"></span><span style="color: #000000;">/</span><span style="color: #000000;">usr</span><span style="color: #000000;">/</span><span style="color: #000000;">local</span><span style="color: #000000;">/</span><span style="color: #000000;">bin</span><span style="color: #000000;">/</span><span style="color: #000000;">mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">gcc<br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #000000;">$&nbsp;mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">gcc&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">o&nbsp;hello&nbsp;hello.c<br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #000000;">$&nbsp;ls&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">l&nbsp;hello<br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;"></span><span style="color: #000000;">-</span><span style="color: #000000;">rwxr</span><span style="color: #000000;">-</span><span style="color: #000000;">xr</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;"> user users&nbsp;</span><span style="color: #000000;">7749</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2010</span><span style="color: #000000;">-</span><span style="color: #000000;">03</span><span style="color: #000000;">-</span><span style="color: #000000;">16</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">12</span><span style="color: #000000;">:</span><span style="color: #000000;">00</span><span style="color: #000000;">&nbsp;hello<br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;">$&nbsp;file&nbsp;hello<br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;">hello:&nbsp;ELF&nbsp;</span><span style="color: #000000;">32</span><span style="color: #000000;">-</span><span style="color: #000000;">bit&nbsp;LSB&nbsp;executable,&nbsp;MIPS,&nbsp;MIPS32&nbsp;version&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">&nbsp;(SYSV),&nbsp;dynamically&nbsp;linked&nbsp;(uses&nbsp;shared&nbsp;libs),&nbsp;not&nbsp;stripped<br></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">$&nbsp;mipsel</span><span style="color: #000000;">-</span><span style="color: #000000;">linux</span><span style="color: #000000;">-</span><span style="color: #000000;">strip&nbsp;hello<br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">$&nbsp;file&nbsp;hello<br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">hello:&nbsp;ELF&nbsp;</span><span style="color: #000000;">32</span><span style="color: #000000;">-</span><span style="color: #000000;">bit&nbsp;LSB&nbsp;executable,&nbsp;MIPS,&nbsp;MIPS32&nbsp;version&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">&nbsp;(SYSV),&nbsp;dynamically&nbsp;linked&nbsp;(uses&nbsp;shared&nbsp;libs),&nbsp;stripped<br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;">$&nbsp;ls&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">l&nbsp;hello<br></span><span style="color: #008080;">12</span>&nbsp;<span style="color: #000000;"></span><span style="color: #000000;">-</span><span style="color: #000000;">rwxr</span><span style="color: #000000;">-</span><span style="color: #000000;">xr</span><span style="color: #000000;">-</span><span style="color: #000000;">x&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;"> user users&nbsp;</span><span style="color: #000000;">5536</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2010</span><span style="color: #000000;">-</span><span style="color: #000000;">03</span><span style="color: #000000;">-</span><span style="color: #000000;">16</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">12</span><span style="color: #000000;">:</span><span style="color: #000000;">01</span><span style="color: #000000;">&nbsp;hello</span></div>
把编译生成的hello文件拷贝的U盘上，然后插入到MP800H上，telnet上去运行一下，Bingo! 打印出Hello, world!<br>    <img src ="http://www.cnitblog.com/gouzhuang/aggbug/64663.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-16 12:55 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/16/cross_compiling.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>固件解析(Firmware Dissected)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/fw_dissected.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Tue, 16 Mar 2010 01:29:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/fw_dissected.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64651.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/16/fw_dissected.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64651.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64651.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 分析了海信官方发布的MP800H高清播放机固件的结构，为自制固件奠定了基础。&nbsp;&nbsp;<a href='http://www.cnitblog.com/gouzhuang/archive/2010/03/16/fw_dissected.html'>阅读全文</a><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64651.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-16 09:29 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/16/fw_dissected.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>下载源代码(Download The Source Code)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Mon, 15 Mar 2010 07:13:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64648.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html#Feedback</comments><slash:comments>16</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64648.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64648.html</trackback:ping><description><![CDATA[<span style="font-weight: bold;">2010/8/2更新：<br>感想sak2000分享的华硕ftp下载链接，可能是被管理员当做小广告给删除了，在这里重新帖出来：<br></span><br><a  href="ftp://ftp.asus.com.tw/pub/asus/Digital_Media_Player/HDP-R1/SourceCode/OPlay_HDP-R1_GPL_SourceCode.zip" target="_new">ftp://ftp.asus.com.tw/pub/asus/Digital_Media_Player/HDP-R1/SourceCode/OPlay_HDP-R1_GPL_SourceCode.zip</a>
<br>
<br><a  href="ftp://ftp.asus.com.tw/pub/asus/Digital_Media_Player/HDP-R3/SourceCode/OPlay_Air_GPL_SourceCode.zip" target="_new">ftp://ftp.asus.com.tw/pub/asus/Digital_Media_Player/HDP-R3/SourceCode/OPlay_Air_GPL_SourceCode.zip</a><br><br><span style="font-weight: bold;">2010/4/27更新：</span><br style="font-weight: bold;"><span style="font-weight: bold;">有朋友反映下载的文件解压失败（CRC错误）。我发现目前华硕网站的文件是2010年2月9日更新的，试了一下确实不能成功解压。我下载的是较早版本2009年12月的，在这里把它共享出来：</span><br style="font-weight: bold;">
<ul style="font-weight: bold;">
    <li style="margin: 0pt;"><a href="https://docs.google.com/leaf?id=0B9J1BqhJnewaYzI0YTA3NGYtNDMyYS00MWI3LTk0ZmMtYjJiOGJkN2I1MjBl&amp;hl=en&amp;invite=CNaD0IsN">system-273852.tgz</a></li>
    <li style="margin: 0pt;"><a href="https://docs.google.com/leaf?id=0B9J1BqhJnewaOWJkMjRmZDQtYzdjZS00ODViLWI2MjYtNTlhYTE1YjJlZjQ2&amp;hl=en&amp;invite=CPfGy6gE">linux-2.6.12.274877.tgz</a></li>
    <li style="margin: 0pt;"><a href="https://docs.google.com/leaf?id=0B9J1BqhJnewaMDk4YmU5ZjQtMjZmYS00YTdkLThjNjQtYjA5ODBmNGRlNmQ0&amp;hl=en&amp;invite=COX6qZ4L">1073_toolchain.tgz</a></li>
    <li style="margin: 0pt;"><a href="https://docs.google.com/leaf?id=0B9J1BqhJnewaMzcxNjRlYmYtZmIwMy00ODA1LWFhNmItZDAwOTgwNDc0MTlm&amp;hl=en&amp;invite=CPGesOMD">GPL_Release.100203.tgz</a></li>
</ul>
<br>华硕有一款播放机叫O!Play HDP-R1, 也是基于RTD1073。她公开了Linux内核、系统程序源码，并提供了交叉编译工具链(cross compile toolchain)。<br><br>如何下载：<br><br>1. go to <a href="http://support.asus.com/download/download.aspx?SLanguage=en-us">http://support.asus.com/download/download.aspx?SLanguage=en-us</a><br>2. 在左上角"Input Model to Search"处输入"O!Play HDP-R1"然后点击Search Info按钮<br>3. 搜索结果应该显示 O!Play HDP-R1，点击它进入下载页面。源码在Source Code下面。<br><img src ="http://www.cnitblog.com/gouzhuang/aggbug/64648.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-15 15:13 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/15/source_code.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>目标系统(The Target System)</title><link>http://www.cnitblog.com/gouzhuang/archive/2010/03/15/target_system.html</link><dc:creator>gouzhuang</dc:creator><author>gouzhuang</author><pubDate>Mon, 15 Mar 2010 06:50:00 GMT</pubDate><guid>http://www.cnitblog.com/gouzhuang/archive/2010/03/15/target_system.html</guid><wfw:comment>http://www.cnitblog.com/gouzhuang/comments/64647.html</wfw:comment><comments>http://www.cnitblog.com/gouzhuang/archive/2010/03/15/target_system.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/gouzhuang/comments/commentRss/64647.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gouzhuang/services/trackbacks/64647.html</trackback:ping><description><![CDATA[半年前买了一台海信MP800H高清播放机。当时比较了很多款播放机，最后认为这一款有较高的性价比，所以就买了。使用了一段时间，感觉还不错。<br><img alt="" src="http://www.cnitblog.com/images/cnitblog_com/gouzhuang/mp800h.jpg" width="320" height="320"><br>MP800H采用的是Realtek <a href="http://www.realtek.com/products/productsView.aspx?Langid=3&amp;PNid=9&amp;PFid=26&amp;Level=3&amp;Conn=2&amp;ProdID=238">RTD1073</a>
数字多媒体处理器，支持MPEG1/2/4, H.264, VC1,
RM/RMV解码，内置以太网，2xUSB2.0接口，HDMI输出。微处理器是MIPS 24k，SDRAM 128M，Flash Memory
16M。操作系统为Linux，内核版本：2.6.12。<br><br>在网上搜索发现有不少其它品牌的播放机也采用RTD1073，或其姊妹产品如
RTD1261等。这些播放机的软/硬系统都是非常类似的。有些厂家公开了部分源代码，有Linux内核源码，系统及应用程序源码，甚至有播放程序的源
码。网上也有不少论坛在讨论如何为这些播放机扩展/开发新的应用。本博客将记录我对MP800H开发的研究与实践。   <img src ="http://www.cnitblog.com/gouzhuang/aggbug/64647.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gouzhuang/" target="_blank">gouzhuang</a> 2010-03-15 14:50 <a href="http://www.cnitblog.com/gouzhuang/archive/2010/03/15/target_system.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>