OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3364|回复: 0

busybox-1.24.0制作AM335X文件系统 第四天

[复制链接]

27

主题

30

帖子

0

精华

初级会员

Rank: 2

积分
194
金钱
194
注册时间
2012-4-4
在线时间
46 小时
发表于 2016-1-14 16:52:56 | 显示全部楼层 |阅读模式
本帖最后由 fuqiye 于 2016-1-14 16:52 编辑

busybox-1.24.0制作AM335X文件系统         第四天

/*****************************************************************************************************************************/
开始:
1、构建lib目录
    复制交叉编译器usr/local/arm_linux_4.7.3/arm-linux-gnueabihf/libc/lib/arm-linuxgnueabihf/目录下所有文件到/home/voip_sever_am335x_project/rootfs/rootfs/lib/下
    #cp -rfa   usr/local/arm_linux_4.7.3/arm-linux-gnueabihf/libc/lib/arm-linuxgnueabihf/*    /home/voip_sever_am335x_project/rootfs/rootfs/lib/
2、构建网卡启动肢本
    在usr/sbin/目录下创建StartNetwork.sh文件
    文件内容:
#!/bin/sh
echo Try to bring eth0 interface up ...>/dev/console
ReadIni()#设备初始化
{
        INIFILE=$1; SECTION=$2; ITEM=$3
        _readIni=`awk -F '=' '/\['$SECTION'\]/{a=1}a==1&&$1~/'$ITEM'/{print $2;exit}' $INIFILE`
        echo $_readIni
}
if [ -e /etc/NetConfig.ini ] ; then
        NETCARDTYPE=$( ReadIni /etc/NetConfig.ini NetConfig NetCardType )
        ADDRCONFIGTYPE=$( ReadIni /etc/NetConfig.ini NetConfig AddrConfigType )
        IPADDR=$( ReadIni /etc/NetConfig.ini NetConfig IpAddr )
        NETMASK=$( ReadIni /etc/NetConfig.ini NetConfig Netmask )
        GATEWAY=$( ReadIni /etc/NetConfig.ini NetConfig Gateway )
        MAC=$( ReadIni /etc/NetConfig.ini NetConfig MacAddr )
        if [ -z $NETCARDTYPE ] ; then
                echo "NetCardType is empty !" >/dev/console
                exit 1
        fi
        if [ -z $ADDRCONFIGTYPE ] ; then
                echo "AddrConfigType is empty !" >/dev/console
                exit 1
        fi
        if [ -z $IPADDR ] ; then
                echo "IpAddr is empty !" >/dev/console
                exit 1
        fi
        if [ -z $NETMASK ] ; then
                echo "Netmask is empty !" >/dev/console
                exit 1
        fi
        if [ -z $GATEWAY ] ; then
                echo "Gateway is empty !" >/dev/console
                exit 1
        fi
        if [ -z $MAC ] ; then
                echo "MacAddr is empty !" >/dev/console
                exit 1
        fi
        if [ $NETCARDTYPE = "LAN" ] ; then
                if [ $ADDRCONFIGTYPE = "DHCP" ] ; then
                        echo "Get ip type :"$ADDRCONFIGTYPE >/dev/console
                        ifconfig eth0 down
                        ifconfig eth0 hw ether $MAC
                        echo ifconfig eth0 hw ether $MAC >/dev/console
                        udhcpc
                else
                        if [ $ADDRCONFIGTYPE = "MANUAL" ] ; then
                                echo "Get ip type :"$ADDRCONFIGTYPE >/dev/console
                                ifconfig eth0 down
                                ifconfig eth0 hw ether $MAC
                                echo ifconfig eth0 hw ether $MAC >/dev/console
                                ifconfig eth0 $IPADDR netmask $NETMASK up
                                echo ifconfig eth0 $IPADDR netmask $NETMASK up >/dev/console
                                route add default gw $GATEWAY
                                echo add default gw $GATEWAY >/dev/console
                        fi
                fi
        else
                if [ $NETCARDTYPE = "WIFI" ] ; then
                        echo "wifi device not found!!!" >/dev/console
                fi
        fi        
else
        echo "/etc/NetConfig.ini not found!!!" >/dev/console
fi
echo Done > /dev/console

   


正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-14 17:52

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表