sama5d2 buildroot 添加 net-snmp

118 篇文章 9 订阅

buildroot 添加 net-snmp

###工作目录:
/home/sam5d2/mytest/buildroot/buildroot-2017.02.2/output/images
编译时间长度为大于1个小时

#make menuconfig 

这里写图片描述

这里写图片描述

这里写图片描述

###python配置:

这里写图片描述

这里写图片描述

这里写图片描述

/home/sam5d2/mytest/buildroot/buildroot-2017.02.2/output/images

1.建立一个目录:buildroot/
  mkdir –p buildroot
2. tar xvf buildroot-2017.02.2.tar.gz –C buildroot/
3.tar xvf sama5d2_buildroot.tar  -C buildroot/
4.ls buildroot/
4.cd buildroot/sama5d2_buildroot

5.   ./ do_cmd.sh

6.cd ../ buildroot-2017.02.2/

7.make

如果要保存改动:
#make savedefconfig
#make busybox-update-config
#make uclibc-update-config
#cp .config ../sama5d2_buildroot/config/defconfig
#2017_06_06
修改python配置的话
#make menuconfig
#make clean
#make
然后在out目录下是新生成的image文件
#2018_01_10
增加了netsnmp选项
经过了make clean
要得到image文件 需要执行make

#2018-01-11

###遇到问题

这里写图片描述

[*] python-pysendfile

*** python-pysmb needs a toolchain w/ C++ ***

*** python-pysnmp needs a toolchain w/ C++ ***

*** python-pysnmp-apps needs a toolchain w/ C++ ***

*** python-pysnmp-libs needs a toolchain w/ C++ ***

###解决方法:
这里写图片描述

这里写图片描述

编译之后的文件系统为:
/home/sam5d2/mytest/buildroot/buildroot-2017.02.2/output/images/rootfs.tar

将rootfs.tar 解压到 另外一个目录下面:

sudo tar xvf rootfs.tar
进入 rootfs 里面执行如下命令:
sudo tar cvf usr.tar usr/

将usr.tar拷贝到 板子的root目录下,
进入板子root目录,
在板子中执行如下指令:
tar xvf usr.tar -C /
会自动覆盖 板子文件系统/usr目录下面的内容。
不能提前删除/usr目录,删除的话,会报错。缺少./rootfs/usr/lib/libtirpc.so.3

测试程序:snmp_test.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pysnmp.hlapi import *

errorIndication, errorStatus, errorIndex, varBinds = next(
    getCmd(SnmpEngine(),
           CommunityData('public', mpModel=0),
           UdpTransportTarget(('demo.snmplabs.com', 161)),
           ContextData(),
           ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)))
)

if errorIndication:
    print(errorIndication)
elif errorStatus:
    print('%s at %s' % (errorStatus.prettyPrint(),
                        errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
    for varBind in varBinds:
        print(' = '.join([x.prettyPrint() for x in varBind]))

运行:
python snmp_test.py

运行结果:

SNMPv2-MIB::sysDescr.0 = Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686
1

buildroot交叉编译出现如下错误的时候:

You seem to have the current working directory in your
LD_LIBRARY_PATH environment variable. This doesn’t work.
support/dependencies/dependencies.mk:21: recipe for target ‘dependencies’ failed
make[1]: *** [dependencies] Error 1
Makefile:84: recipe for target ‘_all’ failed
make: *** [_all] Error 2

解决最有效的办法是:$ sudo make

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值