<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.b0rder.com/styles/feedsky2.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.b0rder.com" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/border" type="application/rss+xml"></fs:self_link><lastBuildDate>Wed, 19 Nov 2008 12:45:56 GMT</lastBuildDate><title>Border's Log</title><description>技术笔记，随笔心得，Blog,关注Java Linux Python Django Hack Vim Open-Sources</description><image><url>http://www.feedsky.com/feed/border/sc/gif</url><title>Border's Log</title><link>http://b0rder.com/</link></image><link>http://b0rder.com/</link><link xmlns="http://www.w3.org/2005/Atom" href="http://b0rder.com/feeds/atom.xml/" rel="self"></link><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/</id><pubDate>Wed, 19 Nov 2008 12:45:56 GMT</pubDate><item><title>snmp学习笔记之二trap——分析notification.c文件</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725537/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/11/19/net-snmp-notification-analyze-trap/</id><description>&lt;blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;By:     Bian Jiang (&lt;a class=&quot;reference&quot; href=&quot;mailto:borderj&amp;#64;gmail.com&quot;&gt;borderj&amp;#64;gmail.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;From:  &lt;a class=&quot;reference&quot; href=&quot;http://www.b0rder.com&quot;&gt;http://www.b0rder.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Date:   2008.11.11&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;需要文件:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
NET-SNMP-EXAMPLES-MIB.txt
notification.c
&lt;/pre&gt;
&lt;p&gt;这两个文件都在net-snmp源码包里，我的版本是5.4.1&lt;/p&gt;
&lt;p&gt;NET-SNMP-EXAMPLES-MIB.txt  net-snmp-5.4.1.2/mibs目录下
notification.c    net-snmp-5.4.1.2/agent/mibgroup/examples目录下&lt;/p&gt;
&lt;ol class=&quot;arabic&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;安装notification:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
./configure --with-mib-modules=&amp;quot;examples/notification&amp;quot;
make
sudo make install
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;配置snmp.conf文件，在文件中增加NET-SNMP-EXAMPLES-MIB mib库&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo vim /usr/local/share/snmp/snmp.conf&lt;/p&gt;
&lt;p&gt;在文件中增加： mibs +NET-SNMP-EXAMPLES-MIB&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;验证netSnmpExampleNotifications mib库是否正常加载:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
snmptranslate -IR -Tp netSnmpExampleNotifications
+--netSnmpExampleNotifications(3)
   |
   +--netSnmpExampleNotificationPrefix(0)
   |  |
   |  +--netSnmpExampleHeartbeatNotification(1)
   |
   +-- ---N String    netSnmpExampleNotification(1)
   |        Textual Convention: SnmpAdminString
   |        Size: 0..255
   |
   +--netSnmpExampleNotificationObjects(2)
      |
      +-- ---N Integer32 netSnmpExampleHeartbeatRate(1)
      +-- ---N String    netSnmpExampleHeartbeatName(2)
               Textual Convention: SnmpAdminString
               Size: 0..255
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;配置snmptrapd.conf&lt;/p&gt;
&lt;p&gt;建立/usr/share/snmp/snmptrapd.conf（我的机器上是这个，不同机器不同，可能有的放在/etc/snmp,/usr/local/share/snmp/下，视不同情况慢慢实验），加入以下一行:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
authcommunity execute,log,net public
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;设置所有用户的访问权限：可执行，记录，传递，&lt;/p&gt;
&lt;p&gt;如果相对接受到的信息处理可以增加:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
traphandle .1.3.6.1.4.1.2021.251.2  page_me down
# 默认处理函数
traphandle default                  log_it
&lt;/pre&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;5&quot;&gt;
&lt;li&gt;agent自动产生trap&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;配置agent的snmpd.conf，加入以下几行：(参考:
&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&quot;&gt;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&lt;/a&gt; ):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
# From: http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17
# send v1 traps
trapsink   127.0.0.1:162
# also send v2 traps
trap2sink  127.0.0.1:162
informsink 127.0.0.1:162
&lt;/pre&gt;
&lt;ol class=&quot;arabic&quot; start=&quot;6&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;启动snmptrapd&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo snmptrapd –d –f –Lo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;启动snmpd&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo snmpd -f -L&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;snmpd 会每隔30秒给snmptrapd发送一个信息。收到的信息如下:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Received 64 bytes from UDP: [127.0.0.1]:56929
0000: 30 3E 02 01  00 04 06 70  75 62 6C 69  63 A4 31 06    0&amp;gt;.....public.1.
0016: 09 2B 06 01  04 01 BF 08  02 03 40 04  AC 10 81 01    .+........&amp;#64;.....
0032: 02 01 06 02  01 01 43 03  03 CC BC 30  13 30 11 06    ......C....0.0..
0048: 0C 2B 06 01  04 01 BF 08  02 03 02 01  00 02 01 1E    .+..............

2008-11-11 15:43:11 172.16.129.1(via UDP: [127.0.0.1]:56929) TRAP, SNMP v1, community public
        NET-SNMP-EXAMPLES-MIB::netSnmpExampleNotifications Enterprise Specific Trap
        (NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification) Uptime: 0:41:30.20
        NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate.0 = INTEGER: 30
&lt;/pre&gt;
&lt;ol class=&quot;arabic&quot; start=&quot;8&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;notification.c 源码如下:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
/** &amp;#64;example notification.c
 *  This example shows how to send a notification from inside the
 *  agent.  In this case we do something really boring to decide
 *  whether to send a notification or not: we simply sleep for 30
 *  seconds and send it, then we sleep for 30 more and send it again.
 *  We do this through the snmp_alarm mechanisms (which are safe to
 *  use within the agent.  Don't use the system alarm() call, it won't
 *  work properly).  Normally, you would probably want to do something
 *  to test whether or not to send an alarm, based on the type of mib
 *  module you were creating.
 *
 *  When this module is compiled into the agent (run configure with
 *  --with-mib-modules=&amp;quot;examples/notification&amp;quot;) then it should send
 *  out traps, which when received by the snmptrapd demon will look
 *  roughly like:
 *
 *   可以通过 --with-mib-modules=&amp;quot;examples/notification&amp;quot; 把这个模块
 * 编译到agent模块中，snmptrapd可以接收到他发送的traps, 接收到的信息
 * 如下:
 *
 *  2002-05-08 08:57:05 localhost.localdomain [udp:127.0.0.1:32865]:
 *      sysUpTimeInstance = Timeticks: (3803) 0:00:38.03 \
 *      snmpTrapOID.0 = OID: netSnmpExampleNotification
 *
 */

/*
 * start be including the appropriate header files
 */
#include &amp;lt;net-snmp/net-snmp-config.h&amp;gt;
#include &amp;lt;net-snmp/net-snmp-includes.h&amp;gt;
#include &amp;lt;net-snmp/agent/net-snmp-agent-includes.h&amp;gt;

/*
 * contains prototypes
 */
#include &amp;quot;notification.h&amp;quot;

/*
 * our initialization routine 初始化
 * (to get called, the function name must match init_FILENAME()
 * 函数的名字必须是 init_FILENAME() 这种格式
 */
void
init_notification(void)
{
    DEBUGMSGTL((&amp;quot;example_notification&amp;quot;,
                &amp;quot;initializing (setting callback alarm)\n&amp;quot;));
    snmp_alarm_register(30,     /* seconds, 秒 */
                        SA_REPEAT,      /* repeat (every 30 seconds). 每隔30秒发送一个trap*/
                        send_example_notification,      /* our callback 我们的回调函数 */
                        NULL    /* no callback data needed */
        );
}

/** here we send a SNMP v2 trap (which can be sent through snmpv3 and
 *  snmpv1 as well) and send it out.
 *
 *     The various &amp;quot;send_trap()&amp;quot; calls allow you to specify traps in different
 *  formats.  And the various &amp;quot;trapsink&amp;quot; directives allow you to specify
 *  destinations to receive different formats.
 *  But *all* traps are sent to *all* destinations, regardless of how they
 *  were specified.
 *
 *
 *  I.e. it's
 * &amp;#64;verbatim
 *                                           ___  trapsink
 *                                          /
 *      send_easy_trap \___  [  Trap      ] ____  trap2sink
 *                      ___  [ Generator  ]
 *      send_v2trap    /     [            ] ----- informsink
 *                                          \____
 *                                                trapsess
 *
 *  *Not*
 *       send_easy_trap  -------------------&amp;gt;  trapsink
 *       send_v2trap     -------------------&amp;gt;  trap2sink
 *       ????            -------------------&amp;gt;  informsink
 *       ????            -------------------&amp;gt;  trapsess
 * &amp;#64;endverbatim
 */
void
send_example_notification(unsigned int clientreg, void *clientarg)
{
    /*
     * define the OID for the notification we're going to send
     * NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification
     */
    oid             notification_oid[] =
        { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 0, 1 };
    size_t          notification_oid_len = OID_LENGTH(notification_oid);
    static u_long count = 0;

    /*
     * In the notification, we have to assign our notification OID to
     * the snmpTrapOID.0 object. Here is it's definition.
     */
    oid             objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
    size_t          objid_snmptrap_len = OID_LENGTH(objid_snmptrap);

    /*
     * define the OIDs for the varbinds we're going to include
     *  with the notification -
     * NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate  and
     * NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatName
     */
    oid      hbeat_rate_oid[]   = { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 2, 1, 0 };
    size_t   hbeat_rate_oid_len = OID_LENGTH(hbeat_rate_oid);
    oid      hbeat_name_oid[]   = { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 2, 2, 0 };
    size_t   hbeat_name_oid_len = OID_LENGTH(hbeat_name_oid);

    /*
     * here is where we store the variables to be sent in the trap
     */
    netsnmp_variable_list *notification_vars = NULL;
    const char *heartbeat_name = &amp;quot;A girl named Maria&amp;quot;;
    #ifdef  RANDOM_HEARTBEAT
    int  heartbeat_rate = rand() % 60;
    #else
    int  heartbeat_rate = 30;
    #endif

    DEBUGMSGTL((&amp;quot;example_notification&amp;quot;, &amp;quot;defining the trap\n&amp;quot;));

    /*
     * add in the trap definition object
     */
    snmp_varlist_add_variable(&amp;amp;notification_vars,
                              /*
                               * the snmpTrapOID.0 variable
                               */
                              objid_snmptrap, objid_snmptrap_len,
                              /*
                               * value type is an OID
                               */
                              ASN_OBJECT_ID,
                              /*
                               * value contents is our notification OID
                               */
                              (u_char *) notification_oid,
                              /*
                               * size in bytes = oid length * sizeof(oid)
                               */
                              notification_oid_len * sizeof(oid));

    /*
     * add in the additional objects defined as part of the trap
     */

    snmp_varlist_add_variable(&amp;amp;notification_vars,
                               hbeat_rate_oid, hbeat_rate_oid_len,
                               ASN_INTEGER,
                              (u_char *)&amp;amp;heartbeat_rate,
                                  sizeof(heartbeat_rate));

    /*
     * if we want to insert additional objects, we do it here
     */
    if (heartbeat_rate &amp;lt; 30 ) {
        snmp_varlist_add_variable(&amp;amp;notification_vars,
                               hbeat_name_oid, hbeat_name_oid_len,
                               ASN_OCTET_STR,
                               heartbeat_name, strlen(heartbeat_name));
    }

    /*
     * send the trap out.  This will send it to all registered
     * receivers (see the &amp;quot;SETTING UP TRAP AND/OR INFORM DESTINATIONS&amp;quot;
     * section of the snmpd.conf manual page.
     */
    ++count;
    DEBUGMSGTL((&amp;quot;example_notification&amp;quot;, &amp;quot;sending trap %ld\n&amp;quot;,count));
    send_v2trap(notification_vars); // 发送snmpv2的trap

    /*
     * free the created notification variable list
     */
    DEBUGMSGTL((&amp;quot;example_notification&amp;quot;, &amp;quot;cleaning up\n&amp;quot;));
    snmp_free_varbind(notification_vars);
}
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ol class=&quot;first arabic simple&quot;&gt;
&lt;li&gt;How can I get the agent to generate a trap &lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/FAQ:Coding_15&quot;&gt;http://www.net-snmp.org/wiki/index.php/FAQ:Coding_15&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/docs/mibs/NET-SNMP-EXAMPLES-MIB.txt&quot;&gt;http://www.net-snmp.org/docs/mibs/NET-SNMP-EXAMPLES-MIB.txt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/dev/agent/notification_8c-example.html&quot;&gt;http://www.net-snmp.org/dev/agent/notification_8c-example.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&quot;&gt;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;ul class=&quot;last simple&quot;&gt;
&lt;li&gt;By:     Bian Jiang (&lt;a class=&quot;reference&quot; href=&quot;mailto:borderj&amp;#64;gmail.com&quot;&gt;borderj&amp;#64;gmail.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;From:  &lt;a class=&quot;reference&quot; href=&quot;http://www.b0rder.com&quot;&gt;http://www.b0rder.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Date:   2008.11.11&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;--EOF--&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=bec468d7d682419c77aa4e7aeb232d6a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=bec468d7d682419c77aa4e7aeb232d6a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=68c07af959f7bcd9369ccd41c8ddd634&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=68c07af959f7bcd9369ccd41c8ddd634&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=88f473b49251a69112be096a817ce70e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=88f473b49251a69112be096a817ce70e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8f8f715320a38f2db2d6bb6a04954d3a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8f8f715320a38f2db2d6bb6a04954d3a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=aebd411f2dc0d6641243016b3fc3b5e3&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=aebd411f2dc0d6641243016b3fc3b5e3&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=902259cb215d2522db1223f9a3e6556a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=902259cb215d2522db1223f9a3e6556a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=a9e4f947b6a4b65b14b2026685720580&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=a9e4f947b6a4b65b14b2026685720580&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Wed, 19 Nov 2008 20:45:56 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/11/19/net-snmp-notification-analyze-trap/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/11/19/net-snmp-notification-analyze-trap/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725537/1233371</fs:itemid></item><item><title>cross compile net-snmp for mips</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725538/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/11/17/cross-compile-net-snmp-mips/</id><description>&lt;blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;By:     Bian Jiang (&lt;a class=&quot;reference&quot; href=&quot;mailto:borderj&amp;#64;gmail.com&quot;&gt;borderj&amp;#64;gmail.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;From:   &lt;a class=&quot;reference&quot; href=&quot;http://www.b0rder.com&quot;&gt;http://www.b0rder.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Date:   2008.11.17&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;I'm trying to cross-compile NetSNMP 5.4.2 for running on an embedded system (mips).&lt;/p&gt;
&lt;p&gt;由于我使用的CPU是little endian 交叉编译工具是 mipsel-linux&lt;/p&gt;
&lt;p&gt;但是如果你用的是Big endian，交叉编译用具就可能是 mips-linux&lt;/p&gt;
&lt;p&gt;如果你是ARM平台的话，相应的改为 arm-linux&lt;/p&gt;
&lt;ol class=&quot;arabic&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;设置环境变量:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
TOOLCHAIN=mipsel-linux-
CC=${TOOLCHAIN}gcc
CPP=${TOOLCHAIN}cpp
AR=${TOOLCHAIN}ar
STRIP=${TOOLCHAIN}strip
RANLIB=${TOOLCHAIN}ranlib
LD=${TOOLCHAIN}ld
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;编译安装:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
../net-snmp-5.4.2.1/configure --build=i686-linux --host=mipsel-linux --target=mipsel-linux \
--with-transports=&amp;quot;UDP&amp;quot;  --prefix=/opt/rootfs/snmp --with-endianness=little \
--with-persistent-directory=/var/net-snmp/ --with-default-snmp-version=&amp;quot;2&amp;quot; \
--enable-mini-agent --without-kmem-usage --disable-debugging --disable-embedded-perl \
--without-perl-modules

make
make install
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;PS: 如果你采用的是 Big endian， --with-endianness=little 应该改为 --with-endianness=big&lt;/p&gt;
&lt;ol class=&quot;arabic&quot; start=&quot;3&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;测试:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/opt/rootfs/snmp/sbin$ pwd
/opt/rootfs/snmp/sbin
border&amp;#64;ubuntu:/opt/rootfs/snmp/sbin$ file snmpd
snmpd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
border&amp;#64;ubuntu:/opt/rootfs/snmp/sbin$ file snmptrapd
snmptrapd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ol class=&quot;first last arabic simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://fixunix.com/snmp/175765-multiple-warning-cross-compiling-net-snmp-mips-linux.html&quot;&gt;http://fixunix.com/snmp/175765-multiple-warning-cross-compiling-net-snmp-mips-linux.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;--Bian Jiang&lt;/p&gt;
&lt;p&gt;--EOF--&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=b44b3101b583ea8818fcb95f9893180a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=b44b3101b583ea8818fcb95f9893180a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7f8bcae89c6e154adb517acddf57f35f&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7f8bcae89c6e154adb517acddf57f35f&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=545920aab86262ab6f2a1cd222f5bbe5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=545920aab86262ab6f2a1cd222f5bbe5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=df8f7ffe43086ab7abdd12271809ce40&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=df8f7ffe43086ab7abdd12271809ce40&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=9ccbd35aea9f46a88385a425282b25b6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=9ccbd35aea9f46a88385a425282b25b6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=f39cbf2393c2269685b71db1aa9f0479&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=f39cbf2393c2269685b71db1aa9f0479&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5084ab4209e61e7df474c9f9178f6e2a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5084ab4209e61e7df474c9f9178f6e2a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Mon, 17 Nov 2008 18:26:43 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/11/17/cross-compile-net-snmp-mips/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/11/17/cross-compile-net-snmp-mips/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725538/1233371</fs:itemid></item><item><title>snmp学习笔记之一——配置使用trap</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725539/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/11/16/net-snmp-trap-config/</id><description>&lt;p&gt;本文主要参考:  snmp学习笔记——配置使用trap(一) http//blog.chinaunix.net/u1/43391/showart_355332.html&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;By:     Bian Jiang (&lt;a class=&quot;reference&quot; href=&quot;mailto:borderj&amp;#64;gmail.com&quot;&gt;borderj&amp;#64;gmail.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;From:   &lt;a class=&quot;reference&quot; href=&quot;http://www.b0rder.com&quot;&gt;http://www.b0rder.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Date:   2008.11.11&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;trap&quot; name=&quot;trap&quot;&gt;一，trap的用途&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;TRAP是提供从代理进程到管理站的异步报告机制。&lt;/p&gt;
&lt;p&gt;为了使管理站能够及时而又有效地对被管理设备进行监控，同时又不过分增加网络的通信负载，必须使用陷入（TRAP）制导的轮讯过程。代理进程负责在必要时 向管理站报告异常事件，得到异常事件的报告后，管理站可以查询有关的代理，以便得到更具体的信息，对事件的原因做进一步的分析&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id1&quot; name=&quot;id1&quot;&gt;二，trap的工作流程&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;agent&quot; name=&quot;agent&quot;&gt;1，agent端：&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A，  编写mib文件，确定好trap名称等信息。&lt;/p&gt;
&lt;p&gt;B，  命令方式：发送各种trap命令（manager地址后面一定要加端口号162），在manager端看反应结果，在agent端无反应&lt;/p&gt;
&lt;p&gt;以下都未实现&lt;/p&gt;
&lt;p&gt;C，  自动触发：配置snmpd.conf设置触发trap，系统发生某类错误时会自动触发相应类型的trap，发送给manager&lt;/p&gt;
&lt;p&gt;D，  程序方式：一部份trap需要写c语言程序，用相应的api（send_easy_trap 或 send_v2trap）发送&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;manager&quot; name=&quot;manager&quot;&gt;2，manager端：&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A，  配置snmptrapd.conf文件，设置访问权限&lt;/p&gt;
&lt;p&gt;B，  将mib导入到mibs文件夹中&lt;/p&gt;
&lt;p&gt;C，  用perl等脚本语言编写处理trap的程序&lt;/p&gt;
&lt;p&gt;D，  配置snmptrapd.conf文件，添加traphandler项，将不同的trap对应到不同的处理程序上&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id2&quot; name=&quot;id2&quot;&gt;三，trap的环境配置&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;id3&quot; name=&quot;id3&quot;&gt;1，  manager端&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;建立/usr/share/snmp/snmptrapd.conf（我的机器上是这个，不同机器不同，可能有的放在/etc/snmp,/usr/local/share/snmp/下，视不同情况慢慢实验）&lt;/p&gt;
&lt;p&gt;加入以下一行:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
authcommunity execute,log,net public
&lt;/pre&gt;
&lt;p&gt;设置所有用户的访问权限：可执行，记录，传递&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id4&quot; name=&quot;id4&quot;&gt;四，命令方式的过程&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;id5&quot; name=&quot;id5&quot;&gt;1，处理系统默认的trap&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;添加以下几行到snmptrapd.conf中:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
traphandle .1.3.6.1.6.3.1.5.1       page_me up

traphandle .1.3.6.1.4.1.2021.251.1  page_me up

traphandle .1.3.6.1.4.1.2021.251.2  page_me down

traphandle default                  log_it
&lt;/pre&gt;
&lt;p&gt;用sudo snmptrapd -d  -f -Lo启动snmptrapd&lt;/p&gt;
&lt;p&gt;PS: 如果snmptrapd启动不起来是因为在安装net-snmp的时候有些模块没有安装上,
可以通过:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
./configure --with-mib-modules=&amp;quot;examples/notification&amp;quot;
make
sudo make install
&lt;/pre&gt;
&lt;p&gt;来进行安装trap相关的模块。&lt;/p&gt;
&lt;p&gt;然后在agent端输入:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
snmptrap -v 2c -c public 127.0.0.1:162 &amp;quot;&amp;quot; UCD-SNMP-MIB::ucdStart
&lt;/pre&gt;
&lt;p&gt;Manager端反应:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
NET-SNMP version 5.4.1.2

Received 73 bytes from UDP: [127.0.0.1]:41244
0000: 30 47 02 01  01 04 06 70  75 62 6C 69  63 A7 3A 02    0G.....public.:.
0016: 04 42 8A 48  EC 02 01 00  02 01 00 30  2C 30 10 06    .B.H.......0,0..
0032: 08 2B 06 01  02 01 01 03  00 43 04 00  88 86 97 30    .+.......C.....0
0048: 18 06 0A 2B  06 01 06 03  01 01 04 01  00 06 0A 2B    ...+...........+
0064: 06 01 04 01  8F 65 81 7B  01                          .....e.{.

2008-11-11 10:16:12 localhost [UDP: [127.0.0.1]:41244]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (8947351) 1 day, 0:51:13.51
SNMPv2-MIB::snmpTrapOID.0 = OID: UCD-SNMP-MIB::ucdStart
sh: page_me: command not found
&lt;/pre&gt;
&lt;p&gt;说明收到trap ucdstart并且调用对应的脚本程序，这里由于系统没有page_me这个命令，所以返回命令找不到.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;trap-http-www-net-snmp-org-wiki-index-php-tut-snmptrap&quot; name=&quot;trap-http-www-net-snmp-org-wiki-index-php-tut-snmptrap&quot;&gt;2，  处理自定义trap（参考 &lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/TUT:snmptrap&quot;&gt;http://www.net-snmp.org/wiki/index.php/TUT:snmptrap&lt;/a&gt; ）&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;编写两个mib文件，包括snmp1和snmp2两种trap&lt;/p&gt;
&lt;p&gt;Snmp1的mib：TRAP-TEST-MIB.txt:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
TRAP-TEST-MIB DEFINITIONS ::= BEGIN

       IMPORTS ucdExperimental FROM UCD-SNMP-MIB;

 demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }

 demo-trap TRAP-TYPE

       STATUS current

       ENTERPRISE demotraps

       VARIABLES { sysLocation }

       DESCRIPTION &amp;quot;This is just a demo&amp;quot;

       ::= 17

 END
&lt;/pre&gt;
&lt;p&gt;Snmp2的mib：NOTIFICATION-TEST-MIB.txt:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
NOTIFICATION-TEST-MIB DEFINITIONS ::= BEGIN

       IMPORTS ucdavis FROM UCD-SNMP-MIB;

 demonotifs OBJECT IDENTIFIER ::= { ucdavis 991 }

 demo-notif NOTIFICATION-TYPE

         STATUS current

         OBJECTS { sysLocation }

         DESCRIPTION &amp;quot;Just a test notification&amp;quot;

         ::= { demonotifs 17 }

 END
&lt;/pre&gt;
&lt;p&gt;然后放入到mibs文件夹中&lt;/p&gt;
&lt;p&gt;在manager端敲入命令:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
snmptrap -v 2c -c public 127.0.0.1:162 &amp;quot;&amp;quot; NOTIFICATION-TEST-MIB::demo-notif SNMPv2-MIB::sysLocation.0 s &amp;quot;just here&amp;quot;
&lt;/pre&gt;
&lt;p&gt;agent端输出:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Received 96 bytes from UDP: [127.0.0.1]:44858
0000: 30 5E 02 01  01 04 06 70  75 62 6C 69  63 A7 51 02    0^.....public.Q.
0016: 04 7D BA 0E  AA 02 01 00  02 01 00 30  43 30 10 06    .}.........0C0..
0032: 08 2B 06 01  02 01 01 03  00 43 04 00  89 19 29 30    .+.......C....)0
0048: 18 06 0A 2B  06 01 06 03  01 01 04 01  00 06 0A 2B    ...+...........+
0064: 06 01 04 01  8F 65 87 5F  11 30 15 06  08 2B 06 01    .....e._.0...+..
0080: 02 01 01 06  00 04 09 6A  75 73 74 20  68 65 72 65    .......just here

2008-11-11 10:22:27 localhost [UDP: [127.0.0.1]:44858]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (8984873) 1 day, 0:57:28.73
SNMPv2-MIB::snmpTrapOID.0 = OID: NOTIFICATION-TEST-MIB::demo-notif       SNMPv2-MIB::sysLocation.0 = STRING: just here
sh: log_it: command not found
&lt;/pre&gt;
&lt;p&gt;其中just here就是我们想要的结果.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;id6&quot; name=&quot;id6&quot;&gt;3，  自己编写处理trap脚本&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;建立root/bin/traps文件，输入以下内容:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
#!/bin/sh
read host
read ip
vars=
while read oid val
do
    if [ &amp;quot;$vars&amp;quot; = &amp;quot;&amp;quot; ]
    then
        vars=&amp;quot;$oid = $val&amp;quot;
    else
        vars=&amp;quot;$vars, $oid = $val&amp;quot;
    fi
done
echo trap: $1 $host $ip $vars
&lt;/pre&gt;
&lt;p&gt;在manager的snmptrapd.conf加入以下几行:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
traphandle SNMPv2-MIB::coldStart     /root/bin/traps cold

traphandle SNMPv2-MIB::warmStart    /root/bin/traps  warm

traphandle IF-MIB::linkDown          /root/bin/traps down

traphandle IF-MIB::linkUp            /root/bin/traps up

traphandle SNMPv2-MIB::authenticationFailure  /root/bin/traps auth
&lt;/pre&gt;
&lt;p&gt;# this one is deprecated&lt;/p&gt;
&lt;blockquote&gt;
traphandle .1.3.6.1.6.3.1.1.5.6     /root/bin/traps egp-neighbor-loss&lt;/blockquote&gt;
&lt;p&gt;重启snmptrapd：snmptrapd –d –f –Lo&lt;/p&gt;
&lt;p&gt;在agent端输入命令:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
snmptrap -v 1 -c public 127.0.0.1:162 TRAP-TEST-MIB::demotraps 127.0.0.1 2 0 &amp;quot;&amp;quot;  IF-MIB::ifIndex i 1
&lt;/pre&gt;
&lt;p&gt;manager端的反应:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
NET-SNMP version 5.4.1.2

Received 63 bytes from UDP: [127.0.0.1]:44203
0000: 30 3D 02 01  00 04 06 70  75 62 6C 69  63 A4 30 06    0=.....public.0.
0016: 0A 2B 06 01  04 01 8F 65  0D 87 5E 40  04 7F 00 00    .+.....e..^&amp;#64;....
0032: 01 02 01 02  02 01 00 43  04 00 8A 4F  90 30 10 30    .......C...O.0.0
0048: 0E 06 09 2B  06 01 02 01  02 02 01 01  02 01 01       ...+...........

2008-11-11 10:35:42 localhost [127.0.0.1] (via UDP: [127.0.0.1]:44203) TRAP, SNMP v1, community public
        TRAP-TEST-MIB::demotraps Link Down Trap (0) Uptime: 1 day, 1:10:43.36
        IF-MIB::ifIndex = INTEGER: 1
sh: /root/bin/traps: 权限不够
&lt;/pre&gt;
&lt;p&gt;如果出现&amp;quot;sh: /root/bin/traps: 权限不够&amp;quot;, 是因为刚刚创建的/root/bin/traps没有执行的权限，通过 sudo chmod 755 /root/bin/traps 修改权限。&lt;/p&gt;
&lt;p&gt;正常的结果为:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Received 63 bytes from UDP: [127.0.0.1]:44769
0000: 30 3D 02 01  00 04 06 70  75 62 6C 69  63 A4 30 06    0=.....public.0.
0016: 0A 2B 06 01  04 01 8F 65  0D 87 5E 40  04 7F 00 00    .+.....e..^&amp;#64;....
0032: 01 02 01 02  02 01 00 43  04 00 8A A0  B9 30 10 30    .......C.....0.0
0048: 0E 06 09 2B  06 01 02 01  02 02 01 01  02 01 01       ...+...........

2008-11-11 10:39:10 localhost [127.0.0.1] (via UDP: [127.0.0.1]:44769) TRAP, SNMP v1, community public
        TRAP-TEST-MIB::demotraps Link Down Trap (0) Uptime: 1 day, 1:14:11.13
        IF-MIB::ifIndex = INTEGER: 1
trap: down localhost UDP: [127.0.0.1]:44769 DISMAN-EVENT-MIB::sysUpTimeInstance = 1:1:14:11.13,
SNMPv2-MIB::snmpTrapOID.0 = IF-MIB::linkDown, IF-MIB::ifIndex = 1, SNMP-COMMUNITY-MIB::snmpTrapAddress.0 = 127.0.0.1,
SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 = &amp;quot;public&amp;quot;, SNMPv2-MIB::snmpTrapEnterprise.0 = TRAP-TEST-MIB::demotraps
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h2&gt;&lt;a id=&quot;agent-trap&quot; name=&quot;agent-trap&quot;&gt;4，  让agent自动产生trap&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;配置agent的snmpd.conf，加入以下几行：(参考:
&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&quot;&gt;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&lt;/a&gt;):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
# From: http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17
# send v1 traps
trapsink   127.0.0.1:162
# also send v2 traps
trap2sink  127.0.0.1:162
informsink 127.0.0.1:162
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id7&quot; name=&quot;id7&quot;&gt;五，下一步&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;仔细研究snmpd.conf和snmptrapd.conf，调试出系统自动触发trap&lt;/p&gt;
&lt;p&gt;学习mib结构，搞清楚如何写自定义trap的mib&lt;/p&gt;
&lt;p&gt;搞清楚例子的意思&lt;/p&gt;
&lt;p&gt;研究一下在程序中发送trap的c语言api&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id8&quot; name=&quot;id8&quot;&gt;参考:&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://blog.chinaunix.net/u1/43391/showart_355332.html&quot;&gt;http://blog.chinaunix.net/u1/43391/showart_355332.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/dev/agent/notification_8c-example.html&quot;&gt;http://www.net-snmp.org/dev/agent/notification_8c-example.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/TUT:snmptrap#Agent_Traps&quot;&gt;http://www.net-snmp.org/wiki/index.php/TUT:snmptrap#Agent_Traps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Where are these traps sent to &lt;a class=&quot;reference&quot; href=&quot;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&quot;&gt;http://www.net-snmp.org/wiki/index.php/FAQ:Agent_17&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://net-snmp.sourceforge.net/docs/man/snmp_trap_api.html&quot;&gt;http://net-snmp.sourceforge.net/docs/man/snmp_trap_api.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;By:     Bian Jiang (&lt;a class=&quot;reference&quot; href=&quot;mailto:borderj&amp;#64;gmail.com&quot;&gt;borderj&amp;#64;gmail.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;From:   &lt;a class=&quot;reference&quot; href=&quot;http://www.b0rder.com&quot;&gt;http://www.b0rder.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Date:   2008.11.11&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;--EOF--&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=c1042507097238cbd39f68fdfa8a59e7&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=c1042507097238cbd39f68fdfa8a59e7&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=39e3c5f90d0f3c896abcff5d9a7086f7&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=39e3c5f90d0f3c896abcff5d9a7086f7&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=144cd1af94c328b48e922c709150a398&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=144cd1af94c328b48e922c709150a398&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=b0d920a22bd116159ce08474a5f30111&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=b0d920a22bd116159ce08474a5f30111&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=d167f1dbc7ed80f6752630d66dc97b1b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=d167f1dbc7ed80f6752630d66dc97b1b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=01dc4cac209430ebcd16d5bd03d7d864&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=01dc4cac209430ebcd16d5bd03d7d864&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=3c901f0304142d17503355f97364bbef&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=3c901f0304142d17503355f97364bbef&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Sun, 16 Nov 2008 12:59:38 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/11/16/net-snmp-trap-config/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/11/16/net-snmp-trap-config/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725539/1233371</fs:itemid></item><item><title>禁用linux终端中的报警声</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725540/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/09/28/Linux-term-bell/</id><description>&lt;p&gt;方法一 去掉PC喇叭的驱动模块&lt;/p&gt;
&lt;p&gt;#rmmod pcspkr 已测试&lt;/p&gt;
&lt;p&gt;可以将命令写到 /etc/rc.local 这样下次系统启动的时候就会去掉pcspkr模块了。&lt;/p&gt;
&lt;p&gt;整个世界都清静了！&lt;/p&gt;
&lt;p&gt;方法二 修改 /etc/inputrc 文档&lt;/p&gt;
&lt;p&gt;将 set bell-style none 命令行激活，重启系统。&lt;/p&gt;
&lt;p&gt;方法三 setterm -blength 0&lt;/p&gt;
&lt;p&gt;Jiang Bian 2008.9.28&lt;/p&gt;
&lt;p&gt;--EOF--&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=885d075273479585fce08610cf1da3ef&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=885d075273479585fce08610cf1da3ef&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=f16b0c72fc06d553142dd8a0a190586d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=f16b0c72fc06d553142dd8a0a190586d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8b45a644f5035f8af6eadee3f154535c&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8b45a644f5035f8af6eadee3f154535c&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=699b100c32c8c52d49bf65339f7b8ffa&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=699b100c32c8c52d49bf65339f7b8ffa&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5ca7a525c5cb5529d3f289fb1a9d23cb&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5ca7a525c5cb5529d3f289fb1a9d23cb&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=336c5b5da16b2b841b15feca61c250f0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=336c5b5da16b2b841b15feca61c250f0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=52c0436dba224ebea069b6a71dfed2bc&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=52c0436dba224ebea069b6a71dfed2bc&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Sun, 28 Sep 2008 10:31:44 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/09/28/Linux-term-bell/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/09/28/Linux-term-bell/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725540/1233371</fs:itemid></item><item><title>Django-1.0-file-upload</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725541/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/09/15/django-10-file-upload/</id><description>&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id1&quot; name=&quot;id1&quot;&gt;原因&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
想通过 &lt;a class=&quot;reference&quot; href=&quot;http://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt; admin 做个简单的上传文件管理，遇到个问题。files = models.FileField(upload_to=('files')) 默认是把所有的文件都保存在同一个目录 files 下面，我想通过types来判断不同的类型保存到不同目录下，像这样的结构: files/types/filename.&lt;/blockquote&gt;
&lt;p&gt;表结构:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
class Car(models.Model):
    name = models.CharField(max_length=255)
    types = models.CharField(max_length=255)
    files = models.FileField(upload_to=('files'))
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id2&quot; name=&quot;id2&quot;&gt;分析问题&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;如果upload_to可以解决问题最好不过，如果不行就只能在数据库保存是进行干扰，再不行就放弃admin自己做管理页面。&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id3&quot; name=&quot;id3&quot;&gt;解决问题&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
django 1.0 已经支持
upload_to参数使用函数，该函数约定有两个参数，一个是对象实例，一个是文件名，返回一个文件名。&lt;/blockquote&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;def upload_to(instance,filename):&lt;/dt&gt;
&lt;dd&gt;return 'files/%s/%s' % (instance.types,filename)&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;可以参考原文:&lt;/p&gt;
&lt;p&gt;FileField.upload_to&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A local filesystem path that will be appended to your MEDIA_ROOT setting to determine the value of the url attribute.&lt;/p&gt;
&lt;p&gt;This path may contain strftime formatting, which will be replaced by the date/time of the file upload (so that uploaded files don't fill up the given directory).&lt;/p&gt;
&lt;p&gt;Changed in Django 1.0.&lt;/p&gt;
&lt;p&gt;This may also be a callable, such as a function, which will be called to obtain the upload path, including the filename. This callable must be able to accept two arguments, and return a Unix-style path (with forward slashes) to be passed along to the storage system. The two arguments that will be passed are:&lt;/p&gt;
&lt;p&gt;instance&lt;/p&gt;
&lt;p&gt;An instance of the model where the FileField is defined. More specifically, this is the particular instance where the current file is being attached.&lt;/p&gt;
&lt;p&gt;In most cases, this object will not have been saved to the database yet, so if it uses the default AutoField, it might not yet have a value for its primary key field.&lt;/p&gt;
&lt;p&gt;filename&lt;/p&gt;
&lt;p&gt;The filename that was originally given to the file. This may or may not be taken into account when determining the final destination path.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Also has one optional argument.&lt;/p&gt;
&lt;p&gt;原文链接: &lt;a class=&quot;reference&quot; href=&quot;http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to&quot;&gt;http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id4&quot; name=&quot;id4&quot;&gt;最终代码&lt;/a&gt;&lt;/h1&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
from django.db import models
from django.forms import ModelForm
from django.contrib import admin

def files_path(instance, filename):
    return 'files/%s/%s' % (instance.types, filename)

class Car(models.Model):
    name = models.CharField(max_length=255)
    types = models.CharField(max_length=255)
    files = models.FileField(upload_to=files_path)

    def __unicode__(self):
        return u'%s' % self.name


class CarAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'types', 'files', 'file_url', 'file_path')

    def file_url(self, obj):
        return obj.files.url
    file_url.short_description = 'files url'

    def file_path(self, obj):
        return obj.files.path
    file_path.short_description = 'files path'

admin.site.register(Car, CarAdmin)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id5&quot; name=&quot;id5&quot;&gt;感谢&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
非常感谢 &lt;a class=&quot;reference&quot; href=&quot;http://groups.google.com/group/python-cn&quot;&gt;Python-cn&lt;/a&gt; 用户组兄弟们的耐心解答。讨论地址: &lt;a class=&quot;reference&quot; href=&quot;http://groups.google.com/group/python-cn/browse_thread/thread&quot;&gt;http://groups.google.com/group/python-cn/browse_thread/thread&lt;/a&gt;/0e678f1a6ce07d49#&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id6&quot; name=&quot;id6&quot;&gt;参考&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://groups.google.com/group/python-cn/browse_thread/thread&quot;&gt;http://groups.google.com/group/python-cn/browse_thread/thread&lt;/a&gt;/0e678f1a6ce07d49#&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to&quot;&gt;http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;By: Jiang Bian  2008.9&lt;/p&gt;
&lt;p&gt;-- EOF --&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=447815146ecd059a05c9dc9012a5217e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=447815146ecd059a05c9dc9012a5217e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=603ecd7c2d641b7a755b26cf56249c72&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=603ecd7c2d641b7a755b26cf56249c72&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=d243808c7f36a7995f6378b99bff352e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=d243808c7f36a7995f6378b99bff352e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=1fd6a7f346ce085a8d9991a9c109c61e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=1fd6a7f346ce085a8d9991a9c109c61e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=2e31e905bf62171116670a6265c98560&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=2e31e905bf62171116670a6265c98560&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=0f1978707218029f006aa8a5305e688f&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=0f1978707218029f006aa8a5305e688f&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=e1bceaea4c75d463a0a3707aec84c3cc&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=e1bceaea4c75d463a0a3707aec84c3cc&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Mon, 15 Sep 2008 16:40:19 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/09/15/django-10-file-upload/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/09/15/django-10-file-upload/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725541/1233371</fs:itemid></item><item><title>Sub-Process /usr/bin/dpkg returned an error code (1)</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725542/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/08/19/sub-process-usrbindpkg-returned-error-code-1/</id><description>&lt;p&gt;一、 发现deb包依赖关系错误:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~$  sudo apt-get install -f
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
读取状态信息... 完成
已经不需要下列自动安装的软件包：
  liberror-perl libdigest-sha1-perl
使用 'apt-get autoremove' 来删除它们。
共升级了 0 个软件包，新安装了 0 个软件包，要卸载 0 个软件包，有 0 个软件未被升级。
有 6 个软件包没有被完全安装或卸载。
操作完成后，会消耗掉 0B 的额外磁盘空间。
正在设置 flex (2.5.34-2.1) ...
install-info：不能识别的选项“--description=A fast scanner generator”
        试用“install-info --help”以获得选项的完整列表。
dpkg：处理 flex (--configure)时出错：
 子进程 post-installation script 返回了错误号 1
正在设置 cvs (1:1.12.13-9) ...
install-info: 没有指定目录文件；试用 --help 以获得更多信息。
dpkg：处理 cvs (--configure)时出错：
 子进程 post-installation script 返回了错误号 1
正在设置 libidn11-dev (1.1-1) ...
install-info: 没有指定目录文件；试用 --help 以获得更多信息。
dpkg：处理 libidn11-dev (--configure)时出错：
 子进程 post-installation script 返回了错误号 1
正在设置 comerr-dev (2.1-1.40.8-2ubuntu2) ...
install-info: 没有指定目录文件；试用 --help 以获得更多信息。
dpkg：处理 comerr-dev (--configure)时出错：
 子进程 post-installation script 返回了错误号 1
dpkg：依赖关系问题使得 libkrb5-dev 的配置工作不能继续：
 libkrb5-dev 依赖于 comerr-dev；然而：
  软件包 comerr-dev 还没有被配置。
dpkg：处理 libkrb5-dev (--configure)时出错：
 依赖关系问题 - 仍未被配置
dpkg：依赖关系问题使得 libcurl4-gnutls-dev 的配置工作不能继续：
 libcurl4-gnutls-dev 依赖于 libidn11-dev；然而：
  软件包 libidn11-dev 还没有被配置。
 libcurl4-gnutls-dev 依赖于 libkrb5-dev | hurd；然而：
  软件包 libkrb5-dev 还没有被配置。
  未曾安装软件包“hurd”。
dpkg：处理 libcurl4-gnutls-dev (--configure)时出错：
 依赖关系问题 - 仍未被配置
在处理时有错误发生：
 flex
 cvs
 libidn11-dev
 comerr-dev
 libkrb5-dev
 libcurl4-gnutls-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)
&lt;/pre&gt;
&lt;p&gt;二、 删除已经安装错误包的文件:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;通过dpkg -L 来查看已经安装的文件, 已flex为例:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~$ dpkg -L flex
/.
/usr
/usr/bin
/usr/bin/flex
/usr/lib
/usr/lib/libfl.a
/usr/lib/libfl_pic.a
/usr/lib/libfl.so
/usr/share
/usr/share/info
/usr/share/info/flex.info-2.gz
/usr/share/info/flex.info.gz
/usr/share/info/flex.info-1.gz
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/flex.1.gz
/usr/share/doc
/usr/share/doc/flex
/usr/share/doc/flex/NEWS.Debian.gz
/usr/share/doc/flex/NEWS.gz
/usr/share/doc/flex/changelog.Debian.gz
/usr/share/doc/flex/copyright
/usr/share/doc/flex/README.gz
/usr/share/doc/flex/README.Debian.gz
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/flex
/usr/include
/usr/include/FlexLexer.h
/usr/bin/flex++
/usr/bin/lex
/usr/lib/libl.a
/usr/share/man/man1/lex.1.gz
/usr/share/man/man1/flex++.1.gz
/usr/share/doc/flex/changelog.gz
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;把要删除的文件导入文件中，做成删除脚步:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~$ dpkg -L flex &amp;gt; flex
 通过vim 在每一行前加 &amp;quot;rm &amp;quot;
border&amp;#64;b0rder:~$ chmod a+x flex
border&amp;#64;b0rder:~$ sudo ./flex
&lt;/pre&gt;
&lt;p&gt;三、 删除dpkg info 信息:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~$ cd /var/lib/dpkg/info
border&amp;#64;b0rder:/var/lib/dpkg/info$ sudo rm flex.*
&lt;/pre&gt;
&lt;p&gt;四、 卸载flex:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:/var/lib/dpkg/info$ sudo apt-get remove flex
&lt;/pre&gt;
&lt;p&gt;五、再执行 sudo apt-get install -f，flex依赖问题解决。其他的一览关系参考二，三，四 步。&lt;/p&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;六、参考&lt;/dt&gt;
&lt;dd&gt;&lt;ul class=&quot;first last simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.linuxquestions.org/questions/debian-26/sub-process-usrbindpkg-returned-an-error-code-1-171107/&quot;&gt;http://www.linuxquestions.org/questions/debian-26/sub-process-usrbindpkg-returned-an-error-code-1-171107/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;-- EOF --&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=13450260a070296e3b30455151064c7a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=13450260a070296e3b30455151064c7a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=dc9baf651e4c460f0ee75ec4622a4e76&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=dc9baf651e4c460f0ee75ec4622a4e76&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5916c380e88fcf9ce291e8d9760955a8&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5916c380e88fcf9ce291e8d9760955a8&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8d7c9397b9c667ba168b422c91614850&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8d7c9397b9c667ba168b422c91614850&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7a348116801b57a694e05fd9e815ad26&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7a348116801b57a694e05fd9e815ad26&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=91026ff5ddaef9a965ebb998851e2399&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=91026ff5ddaef9a965ebb998851e2399&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=6eefa52f2841a5f6df82b782e2dd1395&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=6eefa52f2841a5f6df82b782e2dd1395&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Tue, 19 Aug 2008 14:11:24 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/08/19/sub-process-usrbindpkg-returned-error-code-1/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/08/19/sub-process-usrbindpkg-returned-error-code-1/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725542/1233371</fs:itemid></item><item><title>Cross Compile SSH Server Dropbear For ARM</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725543/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/08/15/cross-compile-ssh-server-dropbear-arm/</id><description>&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id1&quot; name=&quot;id1&quot;&gt;编译环境&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;ubuntu 8.04&lt;/li&gt;
&lt;li&gt;gcc 4.2.3&lt;/li&gt;
&lt;li&gt;arm_v5t_le-gcc 3.4.3&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id2&quot; name=&quot;id2&quot;&gt;所需软件&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;[&lt;a class=&quot;reference&quot; href=&quot;http://www.zlib.net/&quot;&gt;http://www.zlib.net/&lt;/a&gt; Zlib]&lt;/li&gt;
&lt;li&gt;[&lt;a class=&quot;reference&quot; href=&quot;http://www.ucc.asn.au/~matt/dropbear/dropbear.html&quot;&gt;http://www.ucc.asn.au/~matt/dropbear/dropbear.html&lt;/a&gt; Dropbear]&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id3&quot; name=&quot;id3&quot;&gt;编译过程&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;编译zlib:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar zxvf zlib-1.2.3.tar.gz
mkdir zlib
cd zlib-1.2.3/
CC=arm_v5t_le-gcc ./configure --prefix=/home/border/work/SMG/build-tools/zlib
make
make install
&lt;/pre&gt;
&lt;p&gt;编译dropbear:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
wget http://matt.ucc.asn.au/dropbear/releases/dropbear-0.51.tar.gz
tar zxvf dropbear-0.51.tar.gz
mkdir dropbear-build
cd dropbear-build/
mkdir build
../dropbear-0.51/configure --prefix=/home/border/work/SMG/build-tools/dropbear-build/build/ \
    --with-zlib=/home/border/work/SMG/build-tools/zlib/ CC=arm_v5t_le-gcc --host=arm
make
make scp
sudo make install
sudo cp scp build/bin/
&lt;/pre&gt;
&lt;p&gt;其中的scp需要单独编译，然后用把编译好的scp复制到build/bin目录下。&lt;/p&gt;
&lt;p&gt;在交叉编译好的程序要使用 file 之类的工具检查一下是否为目标机器的程序:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~/work/SMG/build-tools/dropbear-build$ file scp
scp: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.4.17,
dynamically linked (uses shared libs), not stripped
&lt;/pre&gt;
&lt;p&gt;编译好的文件目录结构为:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~/work/SMG/build-tools/dropbear-build/build$ tree
.
|-- bin
|   |-- dbclient
|   |-- dropbearconvert
|   |-- dropbearkey
|   `-- scp
`-- sbin
    `-- dropbear
&lt;/pre&gt;
&lt;p&gt;生成server key:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
cd /etc
mkdir dropbear
cd dropbear
dropbearkey -t rsa -f dropbear_rsa_host_key
dropbearkey -t dss -f dropbear_dss_host_key
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id4&quot; name=&quot;id4&quot;&gt;启动脚本&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;把build目录拷贝到ARM机器上, 在启动脚步/etc/init.d/rcS中增加:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
dropbear
&lt;/pre&gt;
&lt;p&gt;-- EOF --&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=2b9ac18409185f4999d8010cfe3f809b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=2b9ac18409185f4999d8010cfe3f809b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=71f2329623c9f6ddab7c74c6f00602c3&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=71f2329623c9f6ddab7c74c6f00602c3&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=44ed836b9f757ff1ff2d3acf784d05d6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=44ed836b9f757ff1ff2d3acf784d05d6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=ac3d7c266ed5065023218f16ea1e43b0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=ac3d7c266ed5065023218f16ea1e43b0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=fa2aa00b2a6ea452db4716ec5e8406f9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=fa2aa00b2a6ea452db4716ec5e8406f9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=3a92bba2cfa4531d06d05ac96eed1880&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=3a92bba2cfa4531d06d05ac96eed1880&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=b9e7a9855c3b2948452d91b18859338f&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=b9e7a9855c3b2948452d91b18859338f&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Fri, 15 Aug 2008 11:58:32 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/08/15/cross-compile-ssh-server-dropbear-arm/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/08/15/cross-compile-ssh-server-dropbear-arm/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725543/1233371</fs:itemid></item><item><title>Django From 0.96 update to 1.0 logging</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725544/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/08/08/django-096-update-10-logging/</id><description>&lt;p&gt;Django升级到1.0时，发现原来写的东西就运行不起来, 去官方查了一下原来Admin和newform的API改动了， 还好这次不是大面积的改动.&lt;/p&gt;
&lt;p&gt;更新简单记录一下.&lt;/p&gt;
&lt;p&gt;本文主要参考: &lt;a class=&quot;reference&quot; href=&quot;http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges&quot;&gt;http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;admin-url&quot; name=&quot;admin-url&quot;&gt;admin url&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;URLconfs:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
# OLD:
from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^admin/', include('django.contrib.admin.urls')),
)

# NEW:
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),
)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;slugfield-prepopulate-from&quot; name=&quot;slugfield-prepopulate-from&quot;&gt;slugfield prepopulate_from&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;code:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
# OLD
class Catalog(models.Model):
    catalog_name = models.CharField(max_length=100)
    slug = models.SlugField(prepopulate_from=(&amp;quot;catalog_name&amp;quot;,))

    class Admin:
        list_display = ('id', 'catalog_name', 'post_count')

# NEW
class Catalog(models.Model):
    catalog_name = models.CharField(max_length=100)
    slug = models.SlugField(db_index=True)

from django.contrib import admin
class CatalogAdmin(admin.ModelAdmin):
    list_display = ('id', 'catalog_name', 'post_count')
    prepopulated_fields = {&amp;quot;slug&amp;quot;: (&amp;quot;catalog_name&amp;quot;,)}

admin.site.register(Catalog, CatalogAdmin)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;filter-interface&quot; name=&quot;filter-interface&quot;&gt;filter_interface&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;code:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
# OLD
tags = models.ManyToManyField(Tag, filter_interface=models.HORIZONTAL, related_name='entries')
slug = models.SlugField(
        unique_for_date='pub_date',
        prepopulate_from=('title',),
        help_text='Automatically built from the title.'
        )
# NEW
tags = models.ManyToManyField(Tag, related_name='entries')
slug = models.SlugField(db_index=True)

class EntryAdmin(admin.ModelAdmin):
    date_hierarchy = 'pub_date'
    prepopulated_fields = {&amp;quot;slug&amp;quot;: (&amp;quot;title&amp;quot;,)}
    filter_horizontal = ('tags',)
admin.site.register(Entry, EntryAdmin)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;renamed-fields-to-fieldsets&quot; name=&quot;renamed-fields-to-fieldsets&quot;&gt;Renamed 'fields' to 'fieldsets'&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;code:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
# OLD
class Admin:
    fields = [(None, {'fields': ('title', 'catalog', 'public', 'slug', 'input_format', 'body', 'tags', 'comment_count', 'read_count')})]

# NEW
class EntryAdmin(admin.ModelAdmin):
    fieldsets = [(None, {'fields': ('title', 'catalog', 'public', 'slug', 'input_format', 'body', 'tags', 'comment_count', 'read_count')})]
admin.site.register(Entry, EntryAdmin)
&lt;/pre&gt;
&lt;p&gt;更详细的变更请参考Blog-app. &lt;a class=&quot;reference&quot; href=&quot;http://code.google.com/p/blog-app/source/detail?r=67&quot;&gt;http://code.google.com/p/blog-app/source/detail?r=67&lt;/a&gt;&lt;/p&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ul class=&quot;first last simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges/&quot;&gt;http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.djangoproject.com/documentation/admin/&quot;&gt;http://www.djangoproject.com/documentation/admin/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;--EOF--&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=28ddb00d077cd5d670df939bcf39da86&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=28ddb00d077cd5d670df939bcf39da86&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=bcf3d21b2e8e347cfac655903cf755dc&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=bcf3d21b2e8e347cfac655903cf755dc&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=c12fb9aa5e0631a298ecbb3071270780&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=c12fb9aa5e0631a298ecbb3071270780&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=0bac4ea25a48043217c394e2cd51e6ab&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=0bac4ea25a48043217c394e2cd51e6ab&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=9538b2f2c65fb6e9ce476a7ccaf82cd5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=9538b2f2c65fb6e9ce476a7ccaf82cd5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=76f8fbf8b1640e0f3a0fc7cdb14e7042&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=76f8fbf8b1640e0f3a0fc7cdb14e7042&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=177bfe6f4dccaf8b05b76231ca08772d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=177bfe6f4dccaf8b05b76231ca08772d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Fri, 08 Aug 2008 00:50:32 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/08/08/django-096-update-10-logging/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/08/08/django-096-update-10-logging/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725544/1233371</fs:itemid></item><item><title>GNU Configure 中的 build target和host 的区别</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725545/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/08/02/GNU-configure-build-targethost/</id><description>&lt;blockquote&gt;
这几天在做交叉编译的时候，对configure的build, target和host 一直搞不明白,搜了些资料记录一下:&lt;/blockquote&gt;
&lt;p&gt;一、 &lt;a class=&quot;reference&quot; href=&quot;http://en.wikipedia.org/wiki/Cross_compile&quot;&gt;http://en.wikipedia.org/wiki/Cross_compile&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The GNU autotools packages (i.e. autoconf, automake, and libtool) use the notion of a build platform, a host platform, and a target platform.&lt;/p&gt;
&lt;p&gt;The build platform is where the code is actually compiled.&lt;/p&gt;
&lt;p&gt;The host platform is where the compiled code will execute.&lt;/p&gt;
&lt;p&gt;The target platform usually only applies to compilers. It represents what type of object code the package itself will produce (such as cross-compiling a cross-compiler); otherwise the target platform setting is irrelevant. For example, consider cross-compiling a video game that will run on a Dreamcast. The machine where the game is compiled is the build platform while the Dreamcast is the host platform.&lt;/p&gt;
&lt;p&gt;二、 &lt;a class=&quot;reference&quot; href=&quot;http://www.airs.com/ian/configure/configure_5.html#SEC30&quot;&gt;http://www.airs.com/ian/configure/configure_5.html#SEC30&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When building cross compilation tools, there are two different systems involved: the system on which the tools will run, and the system for which the tools generate code.&lt;/p&gt;
&lt;p&gt;The system on which the tools will run is called the host system.&lt;/p&gt;
&lt;p&gt;The system for which the tools generate code is called the target system.&lt;/p&gt;
&lt;p&gt;For example, suppose you have a compiler which runs on a GNU/Linux system and generates ELF programs for a MIPS embedded system. In this case the GNU/Linux system is the host, and the MIPS ELF system is the target. Such a compiler could be called a GNU/Linux cross MIPS ELF compiler, or, equivalently, a 'i386-linux-gnu' cross 'mips-elf' compiler.&lt;/p&gt;
&lt;p&gt;简单说明一下:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol class=&quot;arabic simple&quot;&gt;
&lt;li&gt;build 就是你现在使用的机器。&lt;/li&gt;
&lt;li&gt;host 就是你编译好的程序能够运行的平台。&lt;/li&gt;
&lt;li&gt;target 编译程序能够处理的平台。一般都用在构建编译本身的时候(gcc), 才用target, 也就是说平时我们所说的交叉编译用不到target.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;Target usually have a meaning for developemt tool only.&lt;/p&gt;
&lt;p&gt;比如: 在386的平台上编译可以运行在arm板的程序 ./configure --build=i386-linux,--host=arm-linux就可以了.&lt;/p&gt;
&lt;p&gt;因为一般我们都是编译程序而不是编译工具.&lt;/p&gt;
&lt;p&gt;如果我们编译工具,比如gcc,这个target就有用了.如果我们需要在一个我们的机器上为arm开发板编译一个可以处理 mips程序的gcc,那么target就是mips了.&lt;/p&gt;
&lt;p&gt;比如:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
1. ./configure --build=mipsel-linux --host=mipsel-linux
--target=mipsel-linux' will build native mipsel-linux binutils on
mipsel-linux.

2. ./configure --build=i386-linux --host=mipsel-linux
--target=mipsel-linux' will cross-build native mipsel-linux binutils on
i386-linux.

3. ./configure --build=i386-linux --host=i386-linux
--target=mipsel-linux' will build mipsel-linux cross-binutils on
i386-linux.

4. ./configure --build=mipsel-linux --host=i386-linux
--target=mipsel-linux' will cross-build mipsel-linux cross-binutils for
i386-linux on mipsel-linux.

As you see, only if $build != $host a cross-compilation is performed.
&lt;/pre&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ol class=&quot;first last arabic simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://en.wikipedia.org/wiki/Cross_compile&quot;&gt;http://en.wikipedia.org/wiki/Cross_compile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://www.airs.com/ian/configure/configure_5.html#SEC30&quot;&gt;http://www.airs.com/ian/configure/configure_5.html#SEC30&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://oss.lzu.edu.cn/blog/blog.php?/do_showone/tid_116.html&quot;&gt;http://oss.lzu.edu.cn/blog/blog.php?/do_showone/tid_116.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;-- EOF --&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=b84e64e2f5629b49cda1f7345de971ff&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=b84e64e2f5629b49cda1f7345de971ff&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=22d745da2ab9ceec45c2242983f8d44e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=22d745da2ab9ceec45c2242983f8d44e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=907a95cb31e83c5701cb2dc0f33559a1&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=907a95cb31e83c5701cb2dc0f33559a1&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=f225a99163ab49043f51d401cd447a55&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=f225a99163ab49043f51d401cd447a55&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=382809aab3fb08de0f77905c1380d15c&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=382809aab3fb08de0f77905c1380d15c&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5e81b8fc39bd13392a02c60ff72b37b0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5e81b8fc39bd13392a02c60ff72b37b0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=6758ae412d0b49bfdb0a8ef08f933ea8&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=6758ae412d0b49bfdb0a8ef08f933ea8&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Sat, 02 Aug 2008 13:51:13 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/08/02/GNU-configure-build-targethost/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/08/02/GNU-configure-build-targethost/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725545/1233371</fs:itemid></item><item><title>Howto-Cross-Compile-Python2.5.2-For-ARM</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725546/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/08/01/howto-cross-compile-python252-arm/</id><description>&lt;p&gt;Cross Compile Python 2.5.2 For ARM&lt;/p&gt;
&lt;p&gt;本文排版有问题可以看排版后的: &lt;a class=&quot;reference&quot; href=&quot;http://wiki.woodpecker.org.cn/moin/Cross_Compile_Python_2.5.2_For_ARM&quot;&gt;http://wiki.woodpecker.org.cn/moin/Cross_Compile_Python_2.5.2_For_ARM&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;编译环境：&lt;/p&gt;
&lt;p&gt;ubuntu 8.04, gcc 4.2.3, arm_v5t_le-gcc 3.4.3&lt;/p&gt;
&lt;ol class=&quot;arabic&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;下载Python，http://www.python.org/download/ 下载Python源码，我下载的:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;解压:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
tar jxvf Python-2.5.2.tar.bz2
cd Python-2.5.2
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;编译pc版本的语法解析器&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;由于在编译python的时候，需要先编译一个叫pgen的程序出来，用于生成语法解析器，所以我们要先生成一个pc版本的pgen:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~/tools/Python-2.5.2$ mkdir build.pc
border&amp;#64;b0rder:~/tools/Python-2.5.2$ cd build.pc/
border&amp;#64;b0rder:~/tools/Python-2.5.2/build.pc$ ../configure
border&amp;#64;b0rder:~/tools/Python-2.5.2/build.pc$ make Parser/pgen
&lt;/pre&gt;
&lt;p&gt;然后ls Parser一下，应该就能看到有pgen了。&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;4&quot;&gt;
&lt;li&gt;修改../configure&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;configure在检测编译器的printf是否支持%zd的时候，如果发现是在cross compile，就直接不干活了。这还了得？&lt;/p&gt;
&lt;p&gt;把这一部分的检测代码去掉。这段代码起始于:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
echo &amp;quot;$as_me:$LINENO: checking for %zd printf() format support&amp;quot; &amp;gt;&amp;amp;5
echo $ECHO_N &amp;quot;checking for %zd printf() format support... $ECHO_C&amp;quot; &amp;gt;&amp;amp;6
if test &amp;quot;$cross_compiling&amp;quot; = yes; then
&lt;/pre&gt;
&lt;p&gt;结束于:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
cat &amp;gt;&amp;gt;confdefs.h &amp;lt;&amp;lt;\_ACEOF
#define PY_FORMAT_SIZE_T &amp;quot;z&amp;quot;
_ACEOF

else
  echo &amp;quot;$as_me: program exited with status $ac_status&amp;quot; &amp;gt;&amp;amp;5
echo &amp;quot;$as_me: failed program was:&amp;quot; &amp;gt;&amp;amp;5
sed 's/^/| /' conftest.$ac_ext &amp;gt;&amp;amp;5

( exit $ac_status )
echo &amp;quot;$as_me:$LINENO: result: no&amp;quot; &amp;gt;&amp;amp;5
echo &amp;quot;${ECHO_T}no&amp;quot; &amp;gt;&amp;amp;6
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
&lt;/pre&gt;
&lt;p&gt;把这两段以及中间的内容都删除掉就可以了， 我的是从 22496 - 22583 行，不同的版本可能不一样。&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;5&quot;&gt;
&lt;li&gt;编译arm版本的python&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;有了语法解析器，就可以开始编译arm版本的python了:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~/tools/Python-2.5.2/build.pc$ mkdir ../build.arm
border&amp;#64;b0rder:~/tools/Python-2.5.2/build.pc$ cd ../build.arm/
../configure --prefix=/opt/arm-test/rootfs --disable-ipv6 --host=arm_v5t_le --enable-shared
&lt;/pre&gt;
&lt;p&gt;先创建一个用于编译的目录build.arm，再对python做一些配置，如安装目录，不要ipv6，使用arm-linux的编译器，生成动态链接库。&lt;/p&gt;
&lt;ol class=&quot;arabic simple&quot; start=&quot;6&quot;&gt;
&lt;li&gt;修改Makefile&lt;/li&gt;
&lt;/ol&gt;
&lt;ol class=&quot;loweralpha&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;去掉Debug:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
OPT=                -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;一行中，去掉-g，我们不要debug python，-O3改为-O2，空间紧张O2就可以了。 我的是59行。&lt;/p&gt;
&lt;ol class=&quot;loweralpha&quot; start=&quot;2&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;修改PGEN:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
PGEN=           Parser/pgen$(EXE)
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;一行的下面加上&lt;/p&gt;
&lt;blockquote&gt;
PGEN_HOST=      ../build.pc/Parser/pgen$(EXE)&lt;/blockquote&gt;
&lt;p&gt;表明我们在HOST上运行的pgen&lt;/p&gt;
&lt;p&gt;c 在要使用PGEN的地方改为PGEN_HOST (494行):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
                -&amp;#64; mkdir Include
                -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
&lt;/pre&gt;
&lt;p&gt;改为:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
                -&amp;#64; mkdir Include
                -$(PGEN_HOST) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
&lt;/pre&gt;
&lt;p&gt;d 修改所有使用新生成的python的地方为本机的python绝对地址.
所有如 ./$(BUILDPYTHON) 的地方，都改为python (为本地的python地址，不要使用刚刚编译生成的./python),
在vim里面使用:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
:%s/.\/$(BUILDPYTHON)/\/usr\/bin\/python/g
&lt;/pre&gt;
&lt;p&gt;我的是替换了11处。
如:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
platform: $(BUILDPYTHON)
        $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+&amp;quot;-&amp;quot;+sys.version[0:3]' &amp;gt;platform
&lt;/pre&gt;
&lt;p&gt;改为:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
platform: $(BUILDPYTHON)
        $(RUNSHARED)  /usr/bin/python  -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+&amp;quot;-&amp;quot;+sys.version[0:3]' &amp;gt;platform
&lt;/pre&gt;
&lt;p&gt;这种地方比较多，大家小心修改。&lt;/p&gt;
&lt;p&gt;如果出这样的错, 说明替换的有问题:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
case $MAKEFLAGS in \
        *-s*) LD_LIBRARY_PATH=/home/border/tools/Python-2.5.2/build.arm: CC='arm_v5t_le-gcc' LDSHARED='arm_v5t_le-gcc -shared' OPT='-DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes' ./python -E ../setup.py -q build;; \
        *) LD_LIBRARY_PATH=/home/border/tools/Python-2.5.2/build.arm: CC='arm_v5t_le-gcc' LDSHARED='arm_v5t_le-gcc -shared' OPT='-DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes' ./python -E ../setup.py build;; \
        esac
/bin/sh: line 2: ./python：无法执行二进制文件
&lt;/pre&gt;
&lt;p&gt;7. 修改setup.py
setup.py负责编译python的各个扩展模块。但是，由于python完全没有考虑cross compile，所以要做一些修改。&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;PyBuildExt类：&lt;/dt&gt;
&lt;dd&gt;&lt;ol class=&quot;first last arabic&quot;&gt;
&lt;li&gt;&lt;dl class=&quot;first docutils&quot;&gt;
&lt;dt&gt;build_extension函数：&lt;/dt&gt;
&lt;dd&gt;&lt;p class=&quot;first last&quot;&gt;这个函数在编译了所有的extension后，会去load这些刚编译好的extension， 但我们在i686的电脑上显然不能load，所以要跳过这些操作。 在 build_ext.build_extension(self, ext)下一行直接写一个return，不做load。&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;/blockquote&gt;
&lt;ol class=&quot;arabic&quot; start=&quot;2&quot;&gt;
&lt;li&gt;&lt;dl class=&quot;first docutils&quot;&gt;
&lt;dt&gt;detect_modules函数：&lt;/dt&gt;
&lt;dd&gt;&lt;ul class=&quot;first last&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;函数的前两行是把/usr/local加到搜索目录中，我们的cross compiler一般不会直接安装在 /usr/local里面的，所以这两行去掉：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;lib_dirs, inc_dirs的设定中，把中括号里的那些都去掉。 以下所有模块都不要:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
cmath, ctypes, _testcapi, pwd, grp, spwd, mmap, audioop, imageop, rgbimg, readline,
ssl, openssl, bdb, dbm, termios, nsl, ncurses, bz2, linuxaudiodev, ossaudiodev, tkinter
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;8 main函数&lt;/p&gt;
&lt;blockquote&gt;
setup函数调用的时候，把要安装的scripts那一部分去掉&lt;/blockquote&gt;
&lt;p&gt;之后就可以make &amp;amp;&amp;amp; make install了.&lt;/p&gt;
&lt;ol class=&quot;arabic&quot; start=&quot;9&quot;&gt;
&lt;li&gt;&lt;p class=&quot;first&quot;&gt;最后在ARM机上执行时如果遇到:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
root&amp;#64;192.168.0.167:~# python2.5
Could not find platform dependent libraries &amp;lt;exec_prefix&amp;gt;
Consider setting $PYTHONHOME to &amp;lt;prefix&amp;gt;[:&amp;lt;exec_prefix&amp;gt;]
Python 2.5.2 (r252:60911, Jul 31 2008, 18:05:30)
[GCC 3.4.3 (MontaVista 3.4.3-25.0.30.0501131 2005-07-23)] on linux2
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;就是没有配置PYTHONHOME，PYTHONPATH:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
export PYTHONHOME=/usr/lib/python2.5
export PYTHONPATH=.:$PYTHONHOME:$PYTHONHOME/site-packages
export PATH=$PATH:$PYTHONHOME:$PYTHONPATH
&lt;/pre&gt;
&lt;p&gt;如果出现'import site' failed错误，就是PYTHONPATH配置出错。&lt;/p&gt;
&lt;p&gt;感谢 Len Jay 不厌其烦的指导。&lt;/p&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ul class=&quot;first last simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://wiki.woodpecker.org.cn/moin/LeoJay/HOWTOCrossCompilePythonForARM&quot;&gt;http://wiki.woodpecker.org.cn/moin/LeoJay/HOWTOCrossCompilePythonForARM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://groups.google.com/group/python-cn/browse_thread/thread/89f7de96b5ea72dc&quot;&gt;http://groups.google.com/group/python-cn/browse_thread/thread/89f7de96b5ea72dc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;-- EOF --&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=ead9ee6358c707dcd255aaeb01b0546d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=ead9ee6358c707dcd255aaeb01b0546d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=0160605097a8876571f70a323cc02ecf&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=0160605097a8876571f70a323cc02ecf&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=daae0a9fa218c46db846fb1a6880da94&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=daae0a9fa218c46db846fb1a6880da94&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5ad18549a1f470902890242f3addd292&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5ad18549a1f470902890242f3addd292&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7e34ab64cd617b574181d0d563ab1fa0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7e34ab64cd617b574181d0d563ab1fa0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=f3a42482676d6e99591f6de30cb3fccd&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=f3a42482676d6e99591f6de30cb3fccd&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=d37fec9071d1c4e3a1398eccf1c75885&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=d37fec9071d1c4e3a1398eccf1c75885&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Fri, 01 Aug 2008 16:45:16 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/08/01/howto-cross-compile-python252-arm/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/08/01/howto-cross-compile-python252-arm/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725546/1233371</fs:itemid></item><item><title>VIA P4M890 install openchrome</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725547/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/07/23/VIA-p4m890-install-openchrome/</id><description>&lt;p&gt;把系统升级到ubuntu 8.04 后分辨率变为800*600, Google找到开源的OpenChrome驱动支持P4M890, 就自己手动编译:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~$ wget http://openchrome.org/releases/xf86-video-openchrome-0.2.902.tar.gz
border&amp;#64;b0rder:~$ tar xvzf xf86-video-openchrome-0.2.902.tar.gz
sudo apt-get build-dep xserver-xorg-driver-via
cd xf86-video-openchrome-0.2.902/
./configure --prefix=/usr
make
sudo make install
border&amp;#64;b0rder:~$ sudo displayconfig-gtk
通过displayconfig-gtk 选择openchrome驱动就可以
&lt;/pre&gt;
&lt;p&gt;硬件信息:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;b0rder:~/tools$ lspci
00:00.0 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge
00:00.1 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge
00:00.2 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge
00:00.3 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge
00:00.4 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge
00:00.5 PIC: VIA Technologies, Inc. P4M890 I/O APIC Interrupt Controller
00:00.6 Host bridge: VIA Technologies, Inc. P4M890 Security Device
00:00.7 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge
00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge
00:02.0 PCI bridge: VIA Technologies, Inc. P4M890 PCI to PCI Bridge Controller
00:03.0 PCI bridge: VIA Technologies, Inc. P4M890 PCI to PCI Bridge Controller
00:0f.0 IDE interface: VIA Technologies, Inc. VT8237A SATA 2-Port Controller (rev 80)
00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 07)
00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)
00:11.0 ISA bridge: VIA Technologies, Inc. VT8237A PCI to ISA Bridge
00:11.7 Host bridge: VIA Technologies, Inc. VT8251 Ultra VLINK Controller
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 7c)
00:13.0 PCI bridge: VIA Technologies, Inc. VT8237A Host Bridge
01:00.0 VGA compatible controller: VIA Technologies, Inc. UniChrome Pro IGP [VIA P4M890 Chipset] (rev 01)
04:01.0 Audio device: VIA Technologies, Inc. VIA High Definition Audio Controller (rev 10)
&lt;/pre&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考资料:&lt;/dt&gt;
&lt;dd&gt;&lt;div class=&quot;first last line-block&quot;&gt;
&lt;div class=&quot;line&quot;&gt;&lt;a class=&quot;reference&quot; href=&quot;http://wiki.openchrome.org/tikiwiki/tiki-index.php?page=Compiling+the+source+code&quot;&gt;http://wiki.openchrome.org/tikiwiki/tiki-index.php?page=Compiling+the+source+code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot;&gt;&lt;a class=&quot;reference&quot; href=&quot;http://ubuntuforums.org/showthread.php?t=820086&quot;&gt;http://ubuntuforums.org/showthread.php?t=820086&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;--EOF--&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=babc040d991686c6ad00f8feafa7471a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=babc040d991686c6ad00f8feafa7471a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=ca74e970e64c028fb1ed3c8a31a1f473&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=ca74e970e64c028fb1ed3c8a31a1f473&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=836047ca7a84d15c7270cf98cf9ff555&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=836047ca7a84d15c7270cf98cf9ff555&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=517bda773e38738a5908518f06dda629&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=517bda773e38738a5908518f06dda629&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=b5329b1575ad575dec4adb66f9c09233&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=b5329b1575ad575dec4adb66f9c09233&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=751fb3f909a8a80023b8757514eaee50&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=751fb3f909a8a80023b8757514eaee50&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7900df627bd0da7fa3ccbcde5b1046c6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7900df627bd0da7fa3ccbcde5b1046c6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Wed, 23 Jul 2008 19:13:56 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/07/23/VIA-p4m890-install-openchrome/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/07/23/VIA-p4m890-install-openchrome/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725547/1233371</fs:itemid></item><item><title>Install Trac and svn on ubuntu</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725548/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/07/15/install-trac-and-svn-ubuntu/</id><description>&lt;p&gt;Install Python2.5:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/bvcomsvn/svnrepos$ sudo apt-get install python
&lt;/pre&gt;
&lt;p&gt;Install Apache(如果没有必要可以不用安装):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/bvcomsvn/svnrepos$ sudo apt-get install apache2
border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ sudo apt-get install libapache2-mod-python
&lt;/pre&gt;
&lt;p&gt;Install Genshi:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:~/tools$ wget http://ftp.edgewall.com/pub/genshi/Genshi-0.5.1.tar.gz
border&amp;#64;ubuntu:~/tools$ tar xfv Genshi-0.5.1.tar.gz
border&amp;#64;ubuntu:~/tools$ cd Genshi-0.5.1/
border&amp;#64;ubuntu:~/tools/Genshi-0.5.1$ sudo python setup.py install
&lt;/pre&gt;
&lt;p&gt;Install Easy Install:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:~/tools$ wget http://peak.telecommunity.com/dist/ez_setup.py
border&amp;#64;ubuntu:~/tools$ sudo python ez_setup.py
&lt;/pre&gt;
&lt;p&gt;Install Trac:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:~/tools$ svn checkout http://svn.edgewall.org/repos/trac/trunk trac
border&amp;#64;ubuntu:~/tools$ cd trac/
border&amp;#64;ubuntu:~/tools/trac$ sudo python setup.py install
&lt;/pre&gt;
&lt;p&gt;Trac 和 Subversion 数据同步(&lt;a class=&quot;reference&quot; href=&quot;http://trac.edgewall.org/wiki/TracSubversion&quot;&gt;http://trac.edgewall.org/wiki/TracSubversion&lt;/a&gt;):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/bvcomsvn/trac$ sudo apt-get install python-subversion
&lt;/pre&gt;
&lt;p&gt;The Trac Environment ( &lt;a class=&quot;reference&quot; href=&quot;http://trac.edgewall.org/wiki/TracEnvironment&quot;&gt;http://trac.edgewall.org/wiki/TracEnvironment&lt;/a&gt; ):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/bvcomsvn$ trac-admin /bvcomsvn/trac/web2.0 initenv
&lt;/pre&gt;
&lt;p&gt;设置用户权限:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
linux 中使用 htdigest 创建用户，Windows 中使用 trac-digest.py(如果你没有安装Apache你可以自己创建
        trac-digest.py脚本来增加用户，参考: http://trac.edgewall.org/wiki/TracStandalone )

border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ htdigest -c /bvcomsvn/tracs/web2.0/passwd.digest localhost border
border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ htdigest /bvcomsvn/tracs/web2.0/passwd.digest localhost bvcom

border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ trac-admin /bvcomsvn/tracs/web2.0/ permission add admin TRAC_ADMIN
border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ trac-admin /bvcomsvn/tracs/web2.0/ permission add developer TICKET_ADMIN

border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ trac-admin /bvcomsvn/tracs/web2.0/ permission add border admin
border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ trac-admin /bvcomsvn/tracs/web2.0/ permission add bvcom developer

border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ trac-admin /bvcomsvn/tracs/web2.0/ permission remove anonymous TICKET_CREATE
border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ trac-admin /bvcomsvn/tracs/web2.0/ permission remove anonymous TICKET_MODIFY
&lt;/pre&gt;
&lt;p&gt;运行Trac:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
没有用户验证:
tracd -p 8000 /bvcomsvn/trac/
有用户验证:
border&amp;#64;ubuntu:/bvcomsvn/tracs/web2.0$ tracd -p 8000 --auth=web2.0,/bvcomsvn/tracs/web2.0/passwd.digest,localhost /bvcomsvn/tracs/web2.0/
&lt;/pre&gt;
&lt;p&gt;trac-digest.py脚本:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
from optparse import OptionParser
import md5

# build the options
usage = &amp;quot;usage: %prog [options]&amp;quot;
parser = OptionParser(usage=usage)
parser.add_option(&amp;quot;-u&amp;quot;, &amp;quot;--username&amp;quot;,action=&amp;quot;store&amp;quot;, dest=&amp;quot;username&amp;quot;, type = &amp;quot;string&amp;quot;,
                  help=&amp;quot;the username for whom to generate a password&amp;quot;)
parser.add_option(&amp;quot;-p&amp;quot;, &amp;quot;--password&amp;quot;,action=&amp;quot;store&amp;quot;, dest=&amp;quot;password&amp;quot;, type = &amp;quot;string&amp;quot;,
                  help=&amp;quot;the password to use&amp;quot;)
(options, args) = parser.parse_args()

# check options
if (options.username is None) or (options.password is None):
   parser.error(&amp;quot;You must supply both the username and password&amp;quot;)

# Generate the string to enter into the htdigest file
realm = 'trac'
kd = lambda x: md5.md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))
&lt;/pre&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ul class=&quot;first last simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://trac.edgewall.org/wiki/TracInstall&quot;&gt;http://trac.edgewall.org/wiki/TracInstall&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://trac.edgewall.org/wiki/TracStandalone&quot;&gt;http://trac.edgewall.org/wiki/TracStandalone&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://trac.edgewall.org/wiki/TracSubversion&quot;&gt;http://trac.edgewall.org/wiki/TracSubversion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://trac.edgewall.org/wiki/TracEnvironment&quot;&gt;http://trac.edgewall.org/wiki/TracEnvironment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://rain.snowrain.org/archives/23&quot;&gt;http://rain.snowrain.org/archives/23&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://hideto.javaeye.com/blog/99771&quot;&gt;http://hideto.javaeye.com/blog/99771&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;--EOF--&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5e4c538739837d765fcadc2b76c31694&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5e4c538739837d765fcadc2b76c31694&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=a5664ec7602f0fb0aa259293c0f19573&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=a5664ec7602f0fb0aa259293c0f19573&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=84d3a8a3328bd0c51f513ef7e6998fd5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=84d3a8a3328bd0c51f513ef7e6998fd5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=fc1456888b6b91b9a299bb140f654842&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=fc1456888b6b91b9a299bb140f654842&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=524daf703a462b8f565262875c52ebe2&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=524daf703a462b8f565262875c52ebe2&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=d3196f8668810d9eaa78217febf54cd5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=d3196f8668810d9eaa78217febf54cd5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7a892b085730b589352419d211b49af8&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7a892b085730b589352419d211b49af8&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Tue, 15 Jul 2008 18:52:34 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/07/15/install-trac-and-svn-ubuntu/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/07/15/install-trac-and-svn-ubuntu/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725548/1233371</fs:itemid></item><item><title>在linux中格式化一个新硬盘并加载分区</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725549/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/07/14/How-to-format-a-new-hard-disk-on-linux/</id><description>&lt;blockquote&gt;
&lt;p&gt;确定你要格式化的硬盘，我的两块硬盘都是SCSI接口的，可以通过:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/dev$ ls sd*
sda  sda1  sda2  sda5  sda6  sda7  sdb  sdb1
&lt;/pre&gt;
&lt;p&gt;如果是USB设备:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
cd /dev
ls hd*
&lt;/pre&gt;
&lt;p&gt;IDE设备是:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
cd /dev
ls hd*
&lt;/pre&gt;
&lt;p&gt;查看分区信息:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:~$ sudo fdisk -l
[sudo] password for border:

Disk /dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x980c980c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         383     3076416    b  W95 FAT32
/dev/sda2             384       17849   140295645    f  W95 Ext'd (LBA)
/dev/sda5             384        2933    20482843+   c  W95 FAT32 (LBA)
/dev/sda6            2934       17756   119065716   83  Linux
/dev/sda7           17757       17849      746991   82  Linux swap / Solaris

Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa3535cb2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        4462    35840983+   7  HPFS/NTFS
&lt;/pre&gt;
&lt;p&gt;确定要格式化的分区为sdb1.&lt;/p&gt;
&lt;p&gt;开始格式化:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/dev$ sudo fdisk /dev/sdb

The number of cylinders for this disk is set to 4462.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m  (帮助信息)
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition   (删除分区)
   l   list known partition types
   m   print this menu
   n   add a new partition  (创建新分区)
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id   (转换分区类型)
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
&lt;/pre&gt;
&lt;p&gt;删除旧分区d (delete a partition):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Command (m for help): d
Selected partition 1
&lt;/pre&gt;
&lt;p&gt;创建新分区 n (add a new partition):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4462, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4462, default 4462):
Using default value 4462
&lt;/pre&gt;
&lt;p&gt;转换分区类型 t (change a partition's system id):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l

 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot
 1  FAT12           24  NEC DOS         81  Minix / old Lin bf  Solaris
 2  XENIX root      39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 4  FAT16 &amp;lt;32M      40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 5  Extended        41  PPC PReP Boot   85  Linux extended  c7  Syrinx
 6  FAT16           42  SFS             86  NTFS volume set da  Non-FS data
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility
 9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt
 a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e1  DOS access
 b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O
 c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          e4  SpeedStor
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  EFI GPT
10  OPUS            55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor
14  Hidden FAT16 &amp;lt;3 61  SpeedStor       a9  NetBSD          f4  SpeedStor
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fd  Linux raid auto
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fe  LANstep
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid ff  BBT
1c  Hidden W95 FAT3 75  PC/IX
Hex code (type L to list codes): 83       (83 为 Linux ext3 格式)
You cannot change a partition into an extended one or vice versa
Delete it first.
&lt;/pre&gt;
&lt;p&gt;保存退出 w (write table to disk and exit):&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
Command (m for help): w
&lt;/pre&gt;
&lt;p&gt;创建文件系统:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:~$ sudo mkfs.ext3 /dev/sdb1
&lt;/pre&gt;
&lt;p&gt;单独挂载分区:
如果要挂载到/svn到话，你要先把现在/svn的文件全部（包括隐藏文件）转移到分割好到分区，再编辑/etc/fstab:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
/dev/sdb1   /svn ext3 relatime 0 2
&lt;/pre&gt;
&lt;p&gt;最后重启电脑，重启后查看格式和后的分区信息:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
border&amp;#64;ubuntu:/bvcomsvn$ sudo fdisk -l

Disk /dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x980c980c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         383     3076416    b  W95 FAT32
/dev/sda2             384       17849   140295645    f  W95 Ext'd (LBA)
/dev/sda5             384        2933    20482843+   c  W95 FAT32 (LBA)
/dev/sda6            2934       17756   119065716   83  Linux
/dev/sda7           17757       17849      746991   82  Linux swap / Solaris

Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa3535cb2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        4462    35840983+  83  Linux
&lt;/pre&gt;
&lt;p&gt;sdb1 由原来的 HPFS/NTFS 变为现在的 Linux。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;--EOF--&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7e56d7b9f177bbab82a29f9ae5b84727&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7e56d7b9f177bbab82a29f9ae5b84727&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=4a852ae43738a79aff2ad8541f0eca4c&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=4a852ae43738a79aff2ad8541f0eca4c&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8a74ca37ae302bc3391f290b998d7e9e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8a74ca37ae302bc3391f290b998d7e9e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=d4166a44819301d1382a24e002c716f3&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=d4166a44819301d1382a24e002c716f3&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=7b36b2474919d9aacd7ac20374fd9d43&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=7b36b2474919d9aacd7ac20374fd9d43&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=902cdb278fa5c9a1ce145624b09d2a7c&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=902cdb278fa5c9a1ce145624b09d2a7c&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=986aca709f6f1a6b4e9cffffdb90142b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=986aca709f6f1a6b4e9cffffdb90142b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Mon, 14 Jul 2008 13:18:56 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/07/14/How-to-format-a-new-hard-disk-on-linux/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/07/14/How-to-format-a-new-hard-disk-on-linux/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725549/1233371</fs:itemid></item><item><title>从硬盘安装 ubuntu 8.04 server</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725550/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/07/13/install-ubuntu-8-04-server-with-harddisk/</id><description>&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id1&quot; name=&quot;id1&quot;&gt;下载ubuntu 8.04 server&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
从ubuntu.com官方网站下载ubuntu 8.04 server 镜像文件 ubuntu-8.04-server-i386.iso&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;ubuntu-initrd-gz-vmlinuz&quot; name=&quot;ubuntu-initrd-gz-vmlinuz&quot;&gt;下载ubuntu硬盘安装引导文件initrd.gz和vmlinuz&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
initrd.gz和vmlinuz 从 &lt;a class=&quot;reference&quot; href=&quot;http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/hd-media/&quot;&gt;http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/hd-media/&lt;/a&gt; 目录下取得. 如果是其他本版可以从相应的路径取得硬盘安装引导文件。&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;grub&quot; name=&quot;grub&quot;&gt;下载并安装Grub&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
从 &lt;a class=&quot;reference&quot; href=&quot;http://www.gnu.org/software/grub/&quot;&gt;http://www.gnu.org/software/grub/&lt;/a&gt; 下载Grub，并默认安装&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id2&quot; name=&quot;id2&quot;&gt;配置Grub&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;Grub默认安装到windows系统根目录下，主要用到grldr和menu.lst两个文件，把menu.lst中的文件名改为了ubuntu-8.04-server-i386.iso(按你的文件再修改)
并把initrd.gz和vmlinuz解压在与iso同一根目录下. (最好放C盘，ntfs的也可以)&lt;/p&gt;
&lt;p&gt;menu.lst 修改后如下:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
timeout 10
default 0
fallback 1

title ubuntu 8.04 server
root (hd0,0)
kernel  /vmlinuz  boot=casper  iso-scan/filename=ubuntu-8.04-server-i386.iso quiet splash ro
initrd  /initrd.gz

title GO Back (MS Windwos OS)
rootnoverify (hd0,0)
makeactive
chainloader  +1
&lt;/pre&gt;
&lt;p&gt;文中的root (hd0,0), 是通过Grub获得相应硬盘的分区，如果不知道在哪个盘上可以在Grub引导的时候，root (hd 后面加Tab键自动补全，来查看是那个块硬盘和多少分区。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;windows-boot-ini&quot; name=&quot;windows-boot-ini&quot;&gt;修改windows引导文件boot.ini&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;修改C盘根目录下的boot.ini文件，在文件末尾加入下面代码:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
C:\grldr=&amp;quot;UBUNTU&amp;quot;
&lt;/pre&gt;
&lt;p&gt;从新启动电脑在引导时选择&amp;quot;UBUNTU&amp;quot;, 安装过程和其他系统安装过程一样。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;--EOF--&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=b78e6b380842d75f7b36cd47626707ef&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=b78e6b380842d75f7b36cd47626707ef&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8ebfd42309cd694bd738a6d14dc436c9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8ebfd42309cd694bd738a6d14dc436c9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=6b22a403807b8ec93670a9be68186ddc&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=6b22a403807b8ec93670a9be68186ddc&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=21bbdd6fdb0b61f9930e5a67b26c015b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=21bbdd6fdb0b61f9930e5a67b26c015b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=3f710daa8158e2e97a0e987468e517c2&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=3f710daa8158e2e97a0e987468e517c2&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=1894a0eae186f2b4b384f841ef09e403&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=1894a0eae186f2b4b384f841ef09e403&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=a47909213d212d5796908c3b9b96f2cb&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=a47909213d212d5796908c3b9b96f2cb&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Sun, 13 Jul 2008 15:37:38 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/07/13/install-ubuntu-8-04-server-with-harddisk/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/07/13/install-ubuntu-8-04-server-with-harddisk/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725550/1233371</fs:itemid></item><item><title>[学习笔记]MPEG-2概要</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725551/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/06/27/mpeg-2-summary/</id><description>&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;mpeg-2&quot; name=&quot;mpeg-2&quot;&gt;MPEG-2概要&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;MPEG-2是MPEG工作组于1994年发布的视频和音频压缩国际标准。MPEG-2通常用来为广播信号提供视频和音频编码，包括卫星电视、有线电视等。MPEG-2经过少量修改后，也成为DVD产品的核心技术。&lt;/p&gt;
&lt;p&gt;MPEG-2的系统描述部分（第1部分）定义了传输流，它用来一套在非可靠介质上传输數位视频信号和音频信号的机制，主要用在广播电视领域。&lt;/p&gt;
&lt;p&gt;MPEG-2的第二部分即视频部分和MPEG-1类似，但是它提供对隔行扫描视频显示模式的支持（隔行扫描广泛应用在广播电视领域）。MPEG-2视频并没有对低位元速率（小于1Mbps）进行优化，在3Mbit/s及以上位元速率情况下，MPEG-2明显优于MPEG-1。MPEG-2向后兼容，也即是说，所有符合标准的MPEG-2解码器也能够正常播放MPEG-1视频流。&lt;/p&gt;
&lt;p&gt;MPEG-2技术也应用在了HDTV传输系统中。&lt;/p&gt;
&lt;p&gt;MPEG-2的第三部分定义了音频压缩标准。该部分改进了MPEG-1的音频压缩，支持两通道以上的音频。MPEG-2音频压缩部分也保持了向后兼容的特点。&lt;/p&gt;
&lt;p&gt;MPEG-2的第七部分定义了不能向后兼容的音频压缩。该部分提供了更强的音频功能。通常我们所说的MPEG-2AAC指的就是这一部分。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id1&quot; name=&quot;id1&quot;&gt;MPEG-2视频编码概述&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;MPEG-2视频通常包含多个GOP（GOP = Group Of Pictures），每一个GOP包含多个帧。帧的帧类通常包括I-帧、P-帧和B-帧。其中I-帧采用帧内编码，P-帧采用前向估计，B-帧采用双向估计。&lt;/p&gt;
&lt;p&gt;I帧图像采用帧内编码方式，即只利用了单帧图像内的空间相关性，而没有利用时间相关性。
P帧图像中可以包含帧内编码的部分，即P帧中的每一个宏块可以是前向预测，也可以是帧内编码。B帧图像采用双向时间预测，可以大大提高压缩倍数.&lt;/p&gt;
&lt;p&gt;MPEG-2的编码码流分为六个层次。为更好地表示编码数据，MPEG-2用句法规定了一个层次性结构。
它分为六层，自上到下分别是：图像序列层、图像组(GOP)、图像、宏块条、宏块、块。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
&lt;h1&gt;&lt;a id=&quot;id2&quot; name=&quot;id2&quot;&gt;MPEG-2标准文档号码&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;ISO/IEC 13818-1：系统-描述视频和音频的同步和多路技术&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-2：视频-视频压缩&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-3：音频-音频压缩，包括多通道的MP3扩展。&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-4：测试规范&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-5：仿真软件&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-6：DSM-CC(Digital Storage Media Command and Control)扩展&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-7：Advanced Audio Coding (AAC)&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-9：实时接口扩展&lt;/li&gt;
&lt;li&gt;ISO/IEC 13818-10：DSM-CC规范&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;参考:&lt;/dt&gt;
&lt;dd&gt;&lt;ol class=&quot;first last arabic simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference&quot; href=&quot;http://zh.wikipedia.org/wiki/MPEG-2&quot;&gt;http://zh.wikipedia.org/wiki/MPEG-2&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;--EOF--&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=ddd9dd08b26acff2f245121039adc67b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=ddd9dd08b26acff2f245121039adc67b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=694c6127790e6ca2bd61c4c14b71d0c0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=694c6127790e6ca2bd61c4c14b71d0c0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=cbd5d19aefeb25fa306fbdc24b33aea9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=cbd5d19aefeb25fa306fbdc24b33aea9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=c867a88f8ba2e70746aa525992c1d96a&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=c867a88f8ba2e70746aa525992c1d96a&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=1b99c7ac0003ffdeb2afe926ff507ec2&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=1b99c7ac0003ffdeb2afe926ff507ec2&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=33a79893b90bb9533d9a6176bbb9cde5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=33a79893b90bb9533d9a6176bbb9cde5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8d867dabd3f778387fc5f3fd007a0931&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8d867dabd3f778387fc5f3fd007a0931&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;!-- /Feedsky flare --&gt;</description><pubDate>Fri, 27 Jun 2008 02:12:02 +0800</pubDate><guid isPermaLink="false">http://b0rder.com/blog/2008/06/27/mpeg-2-summary/</guid><dc:creator>Border</dc:creator><fs:srclink>http://b0rder.com/blog/2008/06/27/mpeg-2-summary/</fs:srclink><fs:srcfeed>http://b0rder.com/feeds/atom.xml</fs:srcfeed><fs:itemid>feedsky/border/~7053951/139725551/1233371</fs:itemid></item><item><title>Extjs Tree通过递归删除子节点</title><link>http://item.feedsky.com/~feedsky/border/~7053951/139725552/1233371/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>Border</name><email>borderj@gmail.com</email><uri>http://www.b0rder.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://b0rder.com/blog/2008/06/24/Extjs-noteTree-remove-Children-Recursively/</id><description>&lt;p&gt;Extjs Tree通过递归删除子节点信息:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
function removeChildrenRecursively(node) {
    if (!node) return;
    while (node.hasChildNodes()) {
        removeChildrenRecursively(node.firstChild);
        node.removeChild(node.firstChild);
    }
}
&lt;/pre&gt;
&lt;p&gt;参考: &lt;a class=&quot;reference&quot; href=&quot;http://www.realcoding.net/article/view/4557&quot;&gt;http://www.realcoding.net/article/view/4557&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;!-- Feedsky flare --&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=8e9633f78447ddabfac312ed08f0c0b2&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=8e9633f78447ddabfac312ed08f0c0b2&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=5baf335a6594e8fa78fff1f505e18c53&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=5baf335a6594e8fa78fff1f505e18c53&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=dc09e182ee8aaca1603e5b717e74b2b7&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/border?i=dc09e182ee8aaca1603e5b717e74b2b7&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/border?a=e4ae15afe59745df632eda0870d57ed7&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/borde