Geeklog Site http://www.geektalks.cn Another Nifty Geeklog Site admin@geektalks.cn admin@geektalks.cn Copyright 2009 Geek Talks GeekLog Tue, 10 Nov 2009 08:58:54 +0000 en-gb 用texlive2008制作幻灯片(latex + beamer包) http://www.geektalks.cn/article.php?story=20091007164550721 http://www.geektalks.cn/article.php?story=20091007164550721 Wed, 07 Oct 2009 16:45:50 +0000 http://www.geektalks.cn/article.php?story=20091007164550721#comments Linux for SOHO <p>本文简述在texlive2008上,用latex + beamer包制作幻灯片的方法。不仅可以使用CJKutf8输入多国语言,还可以正常使用TOC(目录)。</p> <ol> <li>如果没有安装Texlive 2008,请安装。如果您选择自定义安装,请务必安装CJK和beamer。如果不能确定,请选择完全安装方式。</li> <li>下载<b> <a href="../../filemgmt/visit.php?lid=26" target="_blank" title="请点击下载: beamer.cls">beamer.cls</a></b>,覆盖texlive 2008中的同名文件。(随texlive2008发布的beamer是3.07版本,存在缺陷,在CJKutf8环境中,如果section 或者subsection名称是CJK字符,则生成的TOC是乱码。将这个beamer.cls覆盖原文件可以生成正确的含CJK字符的TOC。)</li> <li>下载<b> <a href="../../filemgmt/visit.php?lid=27" target="_blank" title="请点击下载: beamer-example.tex">使用beamer生成的幻灯片的例子</a></b>。</li> <li>使用下列命令生成PDF格式的幻灯片:</li></ol><ul> <li>pdflatex beamer-example.tex</li> <li>pdflatex beamer-example.tex (重复上一命令,才能生成正确的TOC)</li></ul><p>然后,用PDF阅读器打开beamer-example.pdf文件,可选择全屏,预览演示效果。同时请对照beamer-example.tex学习beamer最基本使用方法。</p><p>随texlive 2008发布的beamer的手册内容丰富,不仅有beamer的使用方法,还有总结性质的幻灯片的制作注意事项等内容,如果想做优秀的幻灯片,请务必阅读。</p> http://www.geektalks.cn/trackback.php?id=20091007164550721 在Ubuntu上安装和使用HP Deskjet F735 All-in-One打印机 http://www.geektalks.cn/article.php?story=2009100716375325 http://www.geektalks.cn/article.php?story=2009100716375325 Wed, 07 Oct 2009 16:37:53 +0000 http://www.geektalks.cn/article.php?story=2009100716375325#comments Linux for SOHO <p>HP Deskjet F735 All-in-One是800人民币元(120美元左右)的打印、扫描、复印一体机,适合SOHO族使用。</p><p>本文详细讲述在Ubuntu 7.10(以及之前的版本)上安装和使用HP Deskjet F735 All-in-One打印机的过程。</p> <p>撰写中!</p> http://www.geektalks.cn/trackback.php?id=2009100716375325 在家庭内部网络中建立PXE服务器 http://www.geektalks.cn/article.php?story=20091007162408917 http://www.geektalks.cn/article.php?story=20091007162408917 Wed, 07 Oct 2009 16:24:08 +0000 http://www.geektalks.cn/article.php?story=20091007162408917#comments Linux for SOHO <p>本文将详细讲述在家庭内部网络中的一台Linux PC(Fedora Core或者ubuntu)上安装tftpd、dhcpd和 httpd,并配置这些服务,让这台PC成为家庭网络中的PXE服务器。有了PXE服务器后,家庭中任何一台电脑都可以通过网络启动,对于电脑的维护、升级非常方便,安装操作系统也不再需要光驱、U盘等媒体。</p> <p><span style="font-size: medium;">&nbsp;一、动机</span></p><p>设置家庭PXE服务器的初衷是为了替我购买的两台二手笔记本电脑(可视为裸机)及一台全新的三星笔记本电脑(10寸迷你型上网本)安装操作系统。笔记本A无光驱无软驱,不支持从除了专用USB光驱之外的任何USB设备启动,但具备从网络启动的功能(PXE启动)。笔记本B有CD-ROM光驱有软驱,不支持从任何USB设备启动,但支持从网络启动(PXE启动)。笔记本C是2009年9月出厂的新品,无光驱但支持所有USB启动项目,同时支持PXE启动,</p><p>如果购买专用USB CD-ROM(为A机)和操作系统安装光盘(为A机及B机),则会消耗较多的时间和金钱。我还有另外一台可以工作的电脑,所以可以从网上下载操作系统的安装光盘镜像,然后刻录成CD-ROM。可是这种方法对无光驱的A并不适用,对B也不是最佳选择,况且,我的CD-Recoder已经坏掉了。笔记本C上已经安装了Windows XP系统,硬盘上留下大约80G的未使用空间,首先,在Windows XP下下载Ubuntu的Alternative ISO,保存到FAT32分区的根目录下,接着用PXE启动Gparted,对未使用空间分区,然后用PXE启动安装程序,安装Ubuntu。</p><p><span style="font-size: medium;">二、方法简述</span></p><p>所以,我决定把我的这一台可以工作的笔记本电脑设置为PXE服务器。</p><ol> <li>用PXE服务器安装<span style="color: rgb(255, 0, 0);">Fedora Core 8/9/10</span>,可以用PXE启动,用家庭内部的HTTP服务器进行HTTP安装(HTTP服务器可以和PXE服务器是相同一台电脑)。</li> <li>用PXE服务器安装<span style="color: rgb(255, 0, 0);">Ubuntu</span>,我采用的方法是用PXE启动Gparted(一种迷你Linux)为硬盘分区,然后把Ubuntu的安装光盘镜像用U盘复制到目标电脑的某个FAT32分区中(或以其他方式,如从网络下载,或用U盘复制等,将光盘ISO映像文件复制该分区),然后用硬盘安装。</li> <li>用PXE服务器安装<span style="color: rgb(255, 0, 0);">Ghost XP</span>,我采用的方法是用PXE启动Gparted为硬盘分区,把Ghost XP的GHO镜像用U盘复制到第二个FAT32分区,然后用PXE启动MAXDOS,用MAXDOS附带的Ghost还原工具将Ghost XP的GHO镜像还原到第一个FAT32分区。</li></ol><p><span style="font-size: medium;">&nbsp;三、PXE服务器的安装与设置</span></p><p>&nbsp;</p><p><span style="font-size: medium;">待续</span></p> http://www.geektalks.cn/trackback.php?id=20091007162408917 CQ出版の雑誌を手に入れる方法? http://www.geektalks.cn/article.php?story=20091004160233849 http://www.geektalks.cn/article.php?story=20091004160233849 Sun, 04 Oct 2009 16:02:00 +0000 http://www.geektalks.cn/article.php?story=20091004160233849#comments 嵌入式系统 <p>雑誌を手に入れる方法が簡単になったんですが、中国の読者にとって付属する基板がないCD-ROM版は値段が不思議な高くて、一年間4万5千円(3000人民圓)ぐらいかかりますね。そんな大金、生活の荷物になるかもしれません。<br /><br />それで、私はいい提案を考えています。<br /><br />CQ出版社はCD-ROM版について、「本著作物の商用での利用およびネットワークを介し共有して利用することはできません」と書いてありますが、ネットワーク以外、開発者たち共有して利用することは、勿論出来ると思います。(例えば図書館、読書会など)<br /><br />そして、私は10人以上の中国の読者を集めて、皆さんから代金を取って、一緒にCD-ROM版を買います。CD-ROM版の雑誌は届きましたら、お金を出した方へPDF記事をメールで送って、あるいはUSBドライブやCD-Rにコピーして、郵送します。<br /><br />そうしたら、読書会のままですね。払うお金も少なくなった、交流も推進できます。<br /><br />インターフェース誌やトラン技に関心を持ち皆さん、この提案、どう思いますか?</p><p>&nbsp;</p> <p>CQ出版の雑誌 <br />1、トランジスタ技術<br />2、インターフェース(Interface)<br />3、Design Wave Magazine<br />は、私たちの組込みシステムの開発者にとって、本当に宝物の山ですね。 <br />もし中国では、1及び2は年間予約購読を行けたら、本当によかったと思っています。<br /><br />でも残念ですが、今中国でCQ出版の雑誌を入手することが難しいです。出来たら、お金も2倍ぐらいかかると思っています。なぜですか。対策があるんですか。<br /><br />日本で色々なオンライン書店があります。たとえば、<br />1、shop.cqpub.co.jp(CQ出版の専門店)<br />2、amazon.co.jp<br />でも、皆「海外への発送は行っておりません」と書いてあります。<br /><br />今、二つの対策があります。<br /><br />1、日販アイ・ピー・エス運営のホームページ「クラブジャパン」(<a target="_blank" href="http://www.clubjapan.jp/">http://www.clubjapan.jp</a>)から申し込みます。<br />いいどころ:A)定期購読を出来ます。ネットで注文、郵便管理出来ます、安心、便利です。<br />B)「商品代・送料以外に弊社から別途費用をご請求する事はありません」と書いてあります。いいですね。<br />悪いどころ:「お支払いはクレジットカードのみとさせて頂いております。ご利用できるクレジットカードは(Visa、American Express、MasterCard、JCB、Diners)です。」と書いてあります。<br />しかし中国の方はほとんどMasterカードやJCBカードが持っていません。(私も持っていません)<br /><br />2、Taobao.comから「日本商品代購」(日本商品代购)のサービスを利用します。例えばこのネットショップ(<a target="_blank" href="http://shop35856173.taobao.com/">http://shop35856173.taobao.com/</a>)から申し込みます。<br />いいどころ:支払方法は簡単です。支付宝でもいい、中国の銀行のネットサーブすでもいい。<br />悪いどころ:A)年間予約購読を行けません。単発注文のみです。<br />B)日本国内の運送料金も、8%サービス料金(「最低500円」と書いてあります)もかかります。<br />C)時間がたくさんかかります。<br />D)長い信頼関係を出来ないと思っています。<br /><br />しかしこの二つの方法以外、ある方法があります。<br /><br />CQ出版の雑誌はCD-ROM版もあります。ウェブショップでも発売しています。例えば、<br /><br />1、インターフェース(Interface)CD-ROM版 2008 13,650円<br /><a target="_blank" href="http://shop.cqpub.co.jp/hanbai/books/38/38481.html">http://shop.cqpub.co.jp/hanbai/books/38/38481.html</a><br />2、トランジスタ技術 CD-ROM版 2008 13,650円<br /><a target="_blank" href="http://shop.cqpub.co.jp/hanbai/books/38/38471.html">http://shop.cqpub.co.jp/hanbai/books/38/38471.html</a><br />3、Design Wave Magazine CD-ROM版 2008 13,650円<br /><a target="_blank" href="http://shop.cqpub.co.jp/hanbai/books/38/38491.html">http://shop.cqpub.co.jp/hanbai/books/38/38491.html</a><br /><br />雑誌の記事はすべてPDFになっています。しかし、とっても残念ですが、雑誌に付属する基板がひとつもなくなっています。雑誌に付属するCD-ROMもない。<br /><br />雑誌を手に入れる方法が簡単になったんですが、中国の読者にとって付属する基板がないCD-ROM版は値段が不思議な高くて、一年間4万5千円(3000人民圓)ぐらいかかりますね。そんな大金、生活の荷物になるかもしれません。<br /><br />それで、私はいい提案を考えています。<br /><br />CQ出版社はCD-ROM版について、「本著作物の商用での利用およびネットワークを介し共有して利用することはできません」と書いてありますが、ネットワーク以外、開発者たち共有して利用することは、勿論出来ると思います。(例えば図書館、読書会など)<br /><br />そして、私は10人以上の中国の読者を集めて、皆さんから代金を取って、一緒にCD-ROM版を買います。CD-ROM版の雑誌は届きましたら、お金を出した方へPDF記事をメールで送って、あるいはUSBドライブやCD-Rにコピーして、郵送します。<br /><br />そうしたら、読書会のままですね。払うお金も少なくなった、交流も推進できます。<br /><br />インターフェース誌やトラン技に関心を持ち皆さん、この提案、どう思いますか?</p><p>&nbsp;</p> http://www.geektalks.cn/trackback.php?id=20091004160233849 Read Me First before Buying a Netbook http://www.geektalks.cn/article.php?story=2009040616011221 http://www.geektalks.cn/article.php?story=2009040616011221 Mon, 06 Apr 2009 16:01:12 +0000 http://www.geektalks.cn/article.php?story=2009040616011221#comments 测试与评论 <p>This article helps one who want to buy a Netbook identify and classify his/her daily computing tasks, giving the advice whether he/she should buy a Netbook, or find an alternative solution.</p> <p>&ldquo;I want to buy a Netbook, would you please give me some advices about the brand and the price?&rdquo; An old friend of mine, a graduate student major in biochemistry, asked for my help, when he visited my house last Saturday.</p><p>&ldquo;Wait a moment. What&rsquo;s wrong with your laptop?&rdquo; I replied.</p><p>&ldquo;Oh, it&rsquo;s too clumsy to carry out.&rdquo; He said.</p><p>&ldquo;I see. But don&rsquo;t count on obtaining my advices concerning the parameters of the memory, how large the hard drive should be or the display resolution from here, at least right now. I strongly recommend you to list what jobs your future Netbook suppose to do, I&rsquo;ll give you a piece of paper. Now please write down those daily tasks.&rdquo;</p><p>My friend&rsquo;s note is as follows:</p><p>* Play the video courses downloaded from MIT Open Course Ware, in the bus and train.<br />* Play the music videos and mp3 in free time.<br />* Read the PDF documents.<br />* Write papers and take notes in the library.<br />* Access the Internet, fetch and send the email outside the home and office.<br />* Read the news from the Web site from the Economist and the New York Times, whenever I want.</p><p>&ldquo;Don&rsquo;t you have a MP4 Player or something like that to play the videos and audios in AVI, WMV, MP3 and MP4 format?&rdquo; I read his note, thought a while, and then said, &ldquo;You may take advantage of it to play the video courses. Is your little digital toy clumsy too?&rdquo;</p><p>&ldquo;Oh, I do have a MP4 Player, however, the batteries cannot last as long as I need, I guess.&rdquo;</p><p>&ldquo;Buddy, you are wrong. First, the power of your Netbook will run out soon, when it plays videos and audios. By contrast, your MP4 Player is just designed for its job, it will last longer definitely. Second, the price of the batteries of your MP4 Player is much cheaper than the Netbook&rsquo;s, so you can buy two or more backup batteries, and replace the original one if necessary.&rdquo;</p><p>&ldquo;OK, I accept this. But what can I do with the rest of the tasks?&rdquo;</p><p>&ldquo;Do you have a PDA?&rdquo; I asked.</p><p>&ldquo;Yes, I have a very old one, a Palm PDA, I think it&rsquo;s obsolete and useless, absolutely.&rdquo;</p><p>&ldquo;Umm&hellip; I don&rsquo;t think it&rsquo;s useless.&rdquo; I smiled, &ldquo;It&rsquo;s very USEFUL. You can use your Palm to read the Web contents, no problem with the Economist and the New York Times, and also, it&rsquo;s very convenient.</p><p>Step 1, you should install Plucker (http://www.plkr.org/) into your Palm PDA, and Sunrise XP (http://sunrise.mobileread.com/) into your desktop or laptop computer. Step 2, click the showcase.sxl file, a Sunrise XP list containing many predefined URLs. Step 3, choose the New York Times or whatever you want to read, or input any URL you prefer to browse, click UPDATE, a content file will be generated. Step 4, put the content into your Palm via inferred or sync cable. All right, it&rsquo;s done, you can enjoy the latest New York Times.&rdquo;</p><p>&ldquo;Furthermore, there&rsquo;s an unbelievable fact regarding your old Palm.&rdquo; I added, &ldquo; It uses AAA batteries and the power last for several weeks. How about the Netbook? Five hours is the extreme limit. Also, your Palm PDA is much lighter more mobile than a Netbook.&rdquo;</p><p>&ldquo;Yes, you are right. But besides reading, I also want to write notes and papers when I&rsquo;m in the library.&rdquo;</p><p>&ldquo;Your Palm should have a foldable keyboard as a part of its accessories. You can buy it in the eBay. It cost just ten dollars, and the typing experience is wonderful.</p><p>I have used an ASUS EEEPC, a HITACHI Netbook, and a SHARP Netbook, I&rsquo;m convinced that the typing performance of the most Netbook is just terrible. I believe the performance of Palm&rsquo;s keyboard is much better.</p><p>However, neither the Palm nor the Netbook is perfect for writing. Your palm is good enough for taking notes, but not suitable for writing long structured papers. If you spend most of your writing time in the library, I suggest you to take your laptop with you, not to buy a Netbook.&rdquo;</p><p>&ldquo;OK, I agree with you. But there&rsquo;re still two problems exist, how do I read the email outside my office and my apartment, and how do I read PDF documents?&rdquo;</p><p>&ldquo;How many emails you must send or reply within a day? Are those emails very long or have many attachments?&rdquo; I asked.</p><p>&ldquo;About two to five letters per day, most of them are academic, written in plain text. Although I check my email at both home and office, I really want to fetch the valuable ones and reply as soon as possible.&rdquo;</p><p>&ldquo;I see. Please check your email on your cell phone, done! What? Your cell phone has no QWERTY keypad? What&rsquo;s the hell&hellip; Never mind, forgive me, not everybody is a geek like me. So, please upgrade your cell phone to a new model with QWERTY keypad. It&rsquo;s the most efficient way. I&rsquo;ve told you!&rdquo;</p><p>&ldquo;But how can I read the PDF? Almost all digital papers and books related with my research work are in PDF format.&rdquo;</p><p>&ldquo;You know, although PDF means Portable Document Format, it&rsquo;s not portable at all. I admit, at present, all of your mobile tools are unable to handle the PDF. However, it&rsquo;s unwise to buy a Netbook for reading the PDF. For instance, if you want to read a paper, you have to boot the Netbook, wait 1 to 2 minutes, then open the document, turn to the right page. Of course, you can let your Netbook hibernate, but it still takes time to wake up. If you want to save the time, whatever you read or not, you should keep your Netbook running. But the battery will run out quickly and you&rsquo;ll get a pure black screen.&rdquo;</p><p>&ldquo;Therefore, I prefer an E-book dedicated device, such as a Sony PRS-505 or an Amazon Kindle. They are designed to handle the PDF documents, and they are always awake. Furthermore, owing to the Electronic Ink technology, their consumed power is extremely low. You can read tens of thousands pages within one charge circle. It&rsquo;s fascinating.&rdquo;</p><p>&ldquo;Oh, I believe you are right. However, you&rsquo;ve suggested me to buy a portable keyboard for my Palm, a new cell phone and an e-book reader, while I only want a Netbook. Isn&rsquo;t your plan cost more?&rdquo;</p><p>&ldquo;No, I think the cost of those tools is just equal to a decent but useless Netbook.</p><p>Every device is created professional. MP4 Player is for playing videos and audios, Plucker is for putting the Web contents into your pocket, Portable Keyboard is for taking notes in the library, Cell Phone is for communicating, and E-book Reader is for reading the PDF instantly.&rdquo;</p><p>&ldquo;And, Netbook is for &hellip;&rdquo;</p><p>&ldquo;A Netbook is for nothing but browsing the Web.&rdquo; I feel like a philosopher.</p><p>&ldquo;OK. I take your advice.&rdquo;</p> http://www.geektalks.cn/trackback.php?id=2009040616011221 Way to Find Out the Harassing Callers http://www.geektalks.cn/article.php?story=20090404100015870 http://www.geektalks.cn/article.php?story=20090404100015870 Sat, 04 Apr 2009 10:00:15 +0000 http://www.geektalks.cn/article.php?story=20090404100015870#comments 测试与评论 <p><a href="http://www.callhunter.com/"><img src="http://www.callhunter.com/images/ch_logo.jpg?1231581299" alt="" /></a></p><p>Have you ever been harassed by the annoying phone calls, interrupting your work, your sport, and even your sleep, by the telemarketers, surveyors and debt collectors? Now you have a chance to find them out and protect yourself.</p><p>CallHunter serves as a public directory of reported harassing or unknown callers including telemarketers, surveyors, debt collectors, politicians, scammers, etc. CallHunter also has published guides that are informative about the practices of debt collectors and telemarketers.</p><p>Please visit <a href="http://www.callhunter.com/">http://www.callhunter.com/</a> for details.</p><p>&nbsp;</p> http://www.geektalks.cn/trackback.php?id=20090404100015870 Email英文高手-立即套用、不用求人(更新中) http://www.geektalks.cn/article.php?story=20090311081000723 http://www.geektalks.cn/article.php?story=20090311081000723 Wed, 11 Mar 2009 08:10:00 +0000 http://www.geektalks.cn/article.php?story=20090311081000723#comments 古鲁大师 <p><span style="font-size: medium">在</span>得到《Email英文高手》一书作者染谷泰正教授的许可后,我将把该书中的100个Email范例制作为电子文档,上载到这里。</p><p>随着电子邮件、新闻组、论坛的普及,中国的geek和外国人的交流越来越多。而英语始终是一个障碍。如何能在技术、学术、商务、私人电子邮件中表达清晰又不失礼仪?本文转载的100个此类电子邮件范例,是青山学院大学英美文学系的老师编纂的,对英语的初、中级使用者来说很有帮助。读者可以把它们背下来活用,也可以在写英文信时套用其格式或表达方法。</p><p>这100个范例将提供以下格式:</p><ul> <li><a href="http://www.geektalks.cn/filemgmt/visit.php?lid=23">MS Word</a> (No.1 ~ No. 77)</li> <li>HTML</li> <li>TXT</li> <li>For REX 5000</li> <li>For PalmOS</li></ul><p>值得注意的是,在这些范例中,有少许内容已经过时,但并不影响我们套用其中的表达方法。</p> http://www.geektalks.cn/trackback.php?id=20090311081000723 Administrator's Blog Updated http://www.geektalks.cn/article.php?story=20090221163915822 http://www.geektalks.cn/article.php?story=20090221163915822 Sat, 21 Feb 2009 16:39:15 +0000 http://www.geektalks.cn/article.php?story=20090221163915822#comments 古鲁大师 <p>Hi, I am Sun Ge, the administrator of Geek Talks. My Blog (I call it my log file) has been updated. If you have interest about me or my projects, please take a look at:&nbsp;<a href="http://blog.20thboys.cn">http://blog.20thboys.cn</a>, or directly visit: <a href="http://www.geektalks.cn/wp">http://www.geektalks.cn/wp</a>.</p><p>Thank you.</p> http://www.geektalks.cn/trackback.php?id=20090221163915822 变AlphaSmart Dana为最好的中文打字机 http://www.geektalks.cn/article.php?story=20090202063732757 http://www.geektalks.cn/article.php?story=20090202063732757 Mon, 02 Feb 2009 06:37:32 +0000 http://www.geektalks.cn/article.php?story=20090202063732757#comments 古鲁大师 <p><span style="font-size: medium;">在</span> <i><a href="http://www.geektalks.cn/article.php?story=2008082104232233">Best Writing Tool: AlphaSmart Dana Wireless</a></i>&nbsp;这篇文章中,作者谈到了AlphaSmart Dana是一台极好的英文打字机,尤其是与AlphaWord软件配合使用的场合。此外,作者也提供了一个包括GBK版本的CJKOS、全屏幕版本的CardTXT等软件在内的<a href="http://www.geektalks.cn/filemgmt/visit.php?lid=18">压缩包</a>的下载。</p><p>但是用CJKOS在Dana上输入汉字却很不方便,主要表现在文本输入框和词汇选择框都局限于屏幕中央160x160像素的区域内,使得大段文字的输入变得很不方便。如何让Dana适合用来书写母语--汉字呢?</p><p><img width="560" height="160" alt="" src="http://www.geektalks.cn/images/library/cjkos-new.gif" /></p> <p>我想最便捷的方法,就是用Rsrcedit修改CJKOS.prc。兆杰输入法效果如题图。</p><p>&nbsp;使用方法:</p><ol> <li>如果还没有安装CJKOS的话,下载并安装<a href="http://www.geektalks.cn/filemgmt/visit.php?lid=18">GBK版本的CJKOS</a> (v 4.27)。</li> <li>用修改过的<a href="http://www.geektalks.cn/filemgmt/visit.php?lid=22">CJKOS.prc</a>覆盖原始的版本。</li></ol><p>&nbsp;</p> http://www.geektalks.cn/trackback.php?id=20090202063732757 U盘上的AVR/ARM开发环境(Cygwin篇) http://www.geektalks.cn/article.php?story=20090120145510146 http://www.geektalks.cn/article.php?story=20090120145510146 Tue, 20 Jan 2009 14:55:10 +0000 http://www.geektalks.cn/article.php?story=20090120145510146#comments 嵌入式系统 <p><span style="font-size: large;">如</span><span style="font-size: x-small;"><span>果</span></span>你想把AVR或者ARM的开发链连同自己的项目代码和文档随身携带,省去在若干台PC上安装和同步的麻烦,你就一定要读读这篇文章,再花上大约1个小时,制作一个适合自己的随身U盘。</p><p><span style="font-size: large;">0 先决条件</span></p><p><span style="font-size: x-small;">-</span><span> 一个至少2G容量的U盘。如果容量更小的话,不能保证安装比较完整的Cygwin环境,或者没有空间存放自己的开发文件。</span></p><p>- U盘支持USB 2.0高速。(所以最好选择2G以上的U盘来保证这一点)</p><p>- Windows PC具备USB 2.0端口。如果仅支持USB 1.1,软件运行或者编译程序的速度会非常缓慢。</p><p>&nbsp;</p> <p><span style="font-size: large;">1 安装你需要的软件到一台Windows PC</span></p><p>你或许已经安装了这些软件,如果没有的话,请先安装到你的一台PC上。</p><p>- <a href="http://www.cygwin.com/">Cygwin</a> (Cygwin的安装是可以定制软件包的,如果觉得空间不够,可以安装一个最小的系统,比如必须的文件和Make工具等等。同时,请至少安装上<span style="color: rgb(255, 153, 0);">不需要X11支持的rxvt软件包</span>。)</p><p>- <a href="http://winavr.sourceforge.net/">WinAVR</a> (如果你想开发AVR单片机)</p><p>- <a href="http://www.yagarto.de/">YAGARTO</a> 和 <a href="http://www.yagarto.de/">OpenOCD</a> (如果你想开发ARM嵌入式系统)</p><p>- <a href="http://www.gnu.org/software/emacs/">emacs</a></p><p><span style="font-size: large;">2. 复制你需要的软件到U盘的根目录下。</span></p><p>请把软件的文件夹完整地复制到U盘的根目录下,暂且不必考虑PATH和注册表的问题。比如,如果你的cygwin安装在C盘,而USB Stick是F盘,请把&quot;c:cygwin&quot;复制到&quot;f:cygwin&quot;。同样地,请把&quot;c:WinAVR-20081205&quot;复制为&quot;f:WinAVR-20081205&quot;。</p><p><span style="font-size: large;">3. 在U盘上建立自己的工作目录</span></p><p>以U盘为F驱动器做例子,比如我叫做&quot;sunge&quot;,就建立一个&quot;f:cygwinhomesunge&quot;文件夹,来作为自己的&ldquo;家&rdquo;目录。你可以把你的开发程序和文档复制到你的&ldquo;家&rdquo;里,不用在PC的硬盘上存储任何的个人数据。</p><p>你还需要修改&quot;f:cygwinetcprofile&quot;文件。请找到这一行:</p><p><span style="color: rgb(255, 0, 0);">USER=&quot;`id -un`&quot;</span></p><p>你需要把它注释掉,然后更改如下:</p><p><span style="color: rgb(255, 0, 0);"># Set the user id<br />#USER=&quot;`id -un`&quot;<br />USER=&quot;sunge&quot;<br />export USER</span></p><p><span style="color: rgb(255, 0, 0);">HOME=&quot;/home/&#36;USER&quot;<br />export HOME</span></p><p><span style="font-size: large;">4.&nbsp; 制作启动脚本</span></p><p>请下载以下脚本,并保存为&quot;f:<a href="http://www.geektalks.cn/filemgmt/visit.php?lid=21">rungnu.bat</a>&quot;文件(如果你的U盘是F驱动器):</p><p>:: rungnu.bat: run portable cygwin clean and safely.</p><p>@echo off<br /><span style="color: rgb(255, 0, 0);">:: CAUTION: run this script (rungnu.bat) ONCE at a time!!<br />:: if you want to open another terminal, i.e. another RXVT session,<br />:: please open the new terminal through the current shell, other<br />:: than this script.</span></p><p>echo ---CAUTION:---<br />echo run this script (rungnu.bat) ONCE at a time!!<br />echo if you want to open another terminal, i.e. another RXVT session,<br />echo please open the new terminal through the current shell, other <br />echo than this script.<br />echo --------------</p><p><span style="color: rgb(255, 0, 255);">:: set software version<br />set WINAVR_VER=20081205<br />set EMACS_VER=22.3</span></p><p>:: determine the current drive, and set parameter &quot;WD&quot; to it. i.e. if usb stick is &quot;f: drive&quot;, &quot;%WD%&quot; is &quot;f:&quot;.<br />for /F %%A in ('cd') do set WD=%%A</p><p>:: record the existed Cygwin mount point.<br />rem cygwinbinmount -m | cygwinbinsed s/mount/&quot;%WD%/cygwin/bin/mount&quot;/ &gt; cygwintmpmount.log</p><p>cygwinbinmount -m | cygwinbinsed s/mount/&quot;%WD%/cygwin/bin/mount&quot;/ &gt; cygwintmpmount.log</p><p>:: umount the existed Cygwin.<br />rem cygwinbinumount -c<br />cygwinbinumount -A</p><p>:: mount Cygwin which is on the current drive.<br />cygwinbinmount -bfu %WD%cygwin/ /<br />cygwinbinmount -bfu %WD%cygwinbin /usr/bin<br />cygwinbinmount -bfu %WD%cygwinlib /usr/lib</p><p><span style="color: rgb(255, 0, 255);">:: set environment variables for WinAVR toolset<br />set PORTABLEWINAVR=%WD%WinAVR-%WINAVR_VER%<br />set PATH=%PORTABLEWINAVR%bin;%PORTABLEWINAVR%utilsbin;%PATH%</span></p><p><span style="color: rgb(255, 0, 255);">:: set environment variables for Emacs<br />set PORTABLEEMACS=%WD%emacs-%EMACS_VER%-bin-i386emacs-%EMACS_VER%<br />set PATH=%PORTABLEEMACS%bin;%PATH%</span></p><p><span style="color: rgb(255, 0, 255);">:: set environment variables for OpenOCD<br />set PORTABLEOPENOCD=%WD%openocd-r717<br />set PATH=%PORTABLEOPENOCD%bin;%PATH%</span></p><p><span style="color: rgb(255, 0, 255);">:: set environment variables for yet-another-gnu-arm-toolschain<br />set PORTABLEARM=%WD%yagarto<br />set PATH=%PORTABLEARM%bin;%PATH%</span></p><p>echo ---CAUTION:---<br />echo DO NOT CLOSE THIS DOS BOX UNTIL IT NORMALLY EXIT!!<br />echo --------------</p><p>:: if X11 exist, start X.<br />rem set DISPLAY=localhost:0.0<br />rem run cygwinusrX11R6binXWin -multiwindow -emulate3buttons 200</p><p>:: run rxvt without closing the dos box.<br />cygwinbinrxvt.exe -title &quot;&quot; -bg &quot;#fafad2&quot; -fg &quot;#000040&quot; -color10 green4 -color14 brown -fn &quot;Lucida Console-14&quot; -geometry 80x50+0+0 -sl 4000 -sr -tn rxvt -e /bin/bash --login -i</p><p>:: the following commands ensure the safe and clean exit of the portable Cygwin.</p><p>:: umount current Cygwin<br />rem cygwinbinumount -c<br />cygwinbinumount -A</p><p>:: restore the old Cygwin mount points, if it have.<br />cygwinbinbash&nbsp; cygwintmpmount.log<br />cygwinbinrm&nbsp;&nbsp;&nbsp; cygwintmpmount.log</p><p>:: end of rungnu.bat</p><p>如果你安装了不同的软件或软件版本到U盘,你也许需要修改那些用<span style="color: rgb(255, 0, 255);">粉红色</span>标记的地方(你可能需要读读文件中的注解)。方法是注释掉你没有安装的软件,为增加的软件添加新的项目,或者修改软件的版本。</p><p><span style="font-size: large;">5. 运行U盘上的cygwin</span></p><p>例如,你的U盘被识别为F驱动器,请点击F驱动器下的&quot;rungnu.bat&quot;脚本。不必担心,这个脚本的运行会修改注册表,但是在退出时会还原,也不会破坏你的原有的任何设置。即使你的PC上已经装有Cygwin系统,这个脚本也不会对原有的Cygwin有任何损害。</p><p><span style="color: rgb(255, 0, 0);">注意:请不要在关掉DOS窗口!</span></p><p>在bash退出时,DOS窗口会自动关闭。</p><p><span style="color: rgb(255, 0, 0);">注意:请不要重复点击rungnu.bat!</span></p><p>如果需要再开一个终端,请在原来的rxvt终端中输入&quot;&#36; rxvt&amp;&quot;来启动,而不是再点击一次rungnu.bat。</p><p><span style="font-size: large;">6. 交叉编译的速度问题</span></p><p>如果你的U盘的年代并不久远,读写速度很快,而PC具备USB 2.0端口,则和在硬盘上运行的速度相当。</p><p><span style="font-size: large;">&nbsp;7. 驱动程序和编程调试设备问题</span></p><p>驱动程序是不可以安装在U盘上的,要驱动PL2303,FT232,JTAGKey或者J-Link,你需要在电脑硬盘上安装这些驱动。</p> http://www.geektalks.cn/trackback.php?id=20090120145510146