hi3520DV300 移植 dhcpd

交叉编译工具:arm-hisiv300-linux -gcc

1.解压    配置   编译

   tar zxvf dhcp-4.2.5-P1.tar.gz

./configure CC=arm-hisiv300-linux-gcc --host=arm-hisiv300-linux  --prefix=/root/newdisk/Hi3521A_SDK_V1.0.3.0/wstapp/dhcp-4.2.5/install/  ac_cv_file__dev_random=yes     

2:   cd bind

             修改Makefile

             注释掉 gunzip -c bind.tar.gz | tar xf -;

             在cd ${bindsrcdir} && ./configure 后边加上   BUILD_CC=gcc ac_cv_file_dev_random=yes --host=arm-hisiv300-linux 即可

             tar zxvf  bind.tar.gz

              进入bind.tar.gz解压后的文件  ,修改vi lib/export/dns/Makefile.in 

                                                                      gen: ${srcdir}/gen.c
                                                                                      ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS}
                                                                       改为
                                                                      gen: ${srcdir}/gen.c
                                                                      ${BUILD_CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS} 

 

3. 完成,然后退回dhcp , make DESTDIR=$PWD/tmp install 

4

           把文件复制到NFS
            sudo cp bin/*   开发板的bin/
            sudo cp sbin/* 开发板sbin/
            sudo cp etc/dhclient.conf.example 开发板etc/dhclient.conf
            sudo cp etc/dhcpd.conf.example 开发板etc/dhcpd.conf


            sudo cp client/scripts/linux 开发板etc/dhclient-script
            chmod +x 开发板上的etc/dhclient-script
          

            并修改
                #!/bin/bash
                   改为
                #!/bin/sh

查看状态:netstat -nutap | grep dhcpd

执行: dhcpd wlan0 & 

wlan 是MT7601

 

dhcpd.conf  内容:

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers ns1.example.org, 114.114.114.114;

default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

# This is a very basic subnet declaration.

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.40 192.168.0.50;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}

此时需要将 wlan0 设置192.168.0.1  netmask 255.255.255.0

你可能感兴趣的:(linux)