cross compile net-snmp for mips
- By: Bian Jiang (borderj@gmail.com)
- From: http://www.b0rder.com
- Date: 2008.11.17
I’m trying to cross-compile NetSNMP 5.4.2 for running on an embedded system (mips).
由于我使用的CPU是little endian 交叉编译工具是 mipsel-linux
但是如果你用的是Big endian,交叉编译用具就可能是 mips-linux
如果你是ARM平台的话,相应的改为 arm-linux
-
设置环境变量:
TOOLCHAIN=mipsel-linux- CC=${TOOLCHAIN}gcc CPP=${TOOLCHAIN}cpp AR=${TOOLCHAIN}ar STRIP=${TOOLCHAIN}strip RANLIB=${TOOLCHAIN}ranlib LD=${TOOLCHAIN}ld -
编译安装:
../net-snmp-5.4.2.1/configure --build=i686-linux --host=mipsel-linux --target=mipsel-linux \ --with-transports="UDP" --prefix=/opt/rootfs/snmp --with-endianness=little \ --with-persistent-directory=/var/net-snmp/ --with-default-snmp-version="2" \ --enable-mini-agent --without-kmem-usage --disable-debugging --disable-embedded-perl \ --without-perl-modules make make install
-
- 如果你采用的是 Big endian, –with-endianness=little 应该改为 –with-endianness=big
-
- 如果不想对openssl 的支持,用 –without-openssl
-
测试:
border@ubuntu:/opt/rootfs/snmp/sbin$ pwd /opt/rootfs/snmp/sbin border@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@ubuntu:/opt/rootfs/snmp/sbin$ file snmptrapd snmptrapd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
–Bian Jiang
–EOF–
Only for test