This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Host DHCP server



Hi Experts,

I am using Linux SDK v7.0 in AM335x EVM board.

I am trying to launch a DHCP server in the EVM board so that any PC connected to it will get a DHCP IP address. Here EVM is the DHCP server and PC is the DHCP client.


In order to do that I changed the configuration file

/roootfs/etc/udhcpd.conf

containing "interface wlan0" to "interface eth0"

But I am not able to establish the connection. Is it something I need to do in addition ?

Regards,

Lyf

  • Hi Lyf,

    Pass "ip=dhcp" in u-boot bootargs to get IP address through DHCP server.

  • Hi Titus,

    I am right now using boot from SD card. So where to interrupt and pass the above  arguments ?

    Also I am trying to pose my EVM as a DHCP server  and connected PC as the client machine which queries the IP address from the EVM. I am bit eager on how boot arg "ip=dhcp" will enable this ?

    Regards,

    Lyf

  • Hi Lyf,

    Use "printenv" command to check your bootargs for MMC boot.

    If suppose bootargs is setenv bootargs 'console=ttyO0,115200n8 root=/dev/mmcblk0p2 mem=128M rootwait'  then you must change to setenv bootargs 'console=ttyO0,115200n8 ip=dhcp root=/dev/mmcblk0p2 mem=128M rootwait'

  • Hi Titus,

    I couldn't  find exact statement but the following things. It seems like already assigned

    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp

    The whole log on issuing printenv is as follows

    printenv
    arch=arm
    baudrate=115200
    board=am335x
    board_name=A33515BB
    board_rev=1.5C
    boot_fdt=try
    boot_targets= mmc0 nand
    bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
    bootcmd_mmc0=setenv devnum 0; setenv rootpart 2; run mmc_boot;
    bootcmd_nand=run nandboot;
    bootcmd_usb=setenv devnum 0; run usb_boot;
    bootdelay=3
    bootdir=/boot
    bootenv=uEnv.txt
    bootfile=zImage
    bootpart=0:2
    console=ttyO0,115200n8
    cpu=armv7
    dfu_alt_info_emmc=rawemmc mmc 0 3751936
    dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw mmc 100 100;u-boot.img.raw mmc 300 400;spl-os-args.raw mmc 80 80;spl-os-image.raw mmc 900 2000;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
    dfu_alt_info_nand=NAND.SPL part 0 1;NAND.SPL.backup1 part 0 2;NAND.SPL.backup2 part 0 3;NAND.SPL.backup3 part 0 4;NAND.u-boot-spl-os part 0 5;NAND.u-boot part 0 6;NAND.u-boot-env part 0 7;NAND.u-boot-env.backup1 part 0 8;NAND.kernel part 0 9;NAND.rootfs part 0 10
    dfu_alt_info_ram=kernel ram 0x80200000 0xD80000;fdt ram 0x80F80000 0x80000;ramdisk ram 0x81000000 0x4000000
    eth1addr=c4:ed:ba:88:47:b3
    ethact=cpsw
    ethaddr=c4:ed:ba:88:47:b1
    fdt_high=0xa0000000
    fdtaddr=0x80F80000
    fdtfile=undefined
    findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi; if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
    loadaddr=0x80200000
    loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}
    loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
    loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
    mmc_boot=setenv devtype mmc; if mmc dev ${devnum}; then run mmcargs;run scan_boot; run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;fi
    mmcargs=setenv bootargs console=${console} ${optargs} root=${mmcroot} rootfstype=${mmcrootfstype}
    mmcboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run loadimage; then run mmcloados;fi;fi;
    mmcdev=0
    mmcloados=run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
    mmcroot=/dev/mmcblk0p2 ro
    mmcrootfstype=ext4 rootwait
    mtdids=nand0=nand.0
    mtdparts=mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.rootfs)
    nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfstype=${nandrootfstype}
    nandboot=echo Booting from nand ...; run nandargs; nand read ${fdtaddr} NAND.u-boot-spl-os; nand read ${loadaddr} NAND.kernel; bootz ${loadaddr} - ${fdtaddr}
    nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
    nandrootfstype=ubifs rootwait=1
    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    netboot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${loadaddr} ${bootfile}; tftp ${fdtaddr} ${fdtfile}; run netargs; bootz ${loadaddr} - ${fdtaddr}
    nfsopts=nolock
    partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}
    ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype}
    ramboot=echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr}
    ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M
    ramrootfstype=ext2
    rdaddr=0x81000000
    rootpart=2
    rootpath=/export/rootfs
    scan_boot=echo Scanning ${devtype} ${devnum}...; for prefix in ${bootdir}; do for script in ${bootfile}; do run script_boot; done; done;
    script_boot=if load ${devtype} ${devnum}:${rootpart} ${loadaddr} ${bootdir}/${bootfile}; then run findfdt; load ${devtype} ${devnum}:${rootpart} ${fdtaddr} ${bootdir}/${fdtfile};fi;
    soc=am33xx
    spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}
    spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootz ${loadaddr}
    spibusno=0
    spiimgsize=0x362000
    spiroot=/dev/mtdblock4 rw
    spirootfstype=jffs2
    spisrcaddr=0xe0000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial
    usb_boot=setenv devtype usb; run usb_init; if usb dev 0; then run usbargs;run scan_boot; bootz ${loadaddr} - ${fdtaddr}; fi
    usb_init=usb start 0;
    usbargs=setenv bootargs console=${console} ${optargs} root=${usbroot} rootfstype=${usbrootfstype}
    usbnet_devaddr=c4:ed:ba:88:47:b3
    usbroot=/dev/sda2 rw
    usbrootfstype=ext4 rootwait
    vendor=ti
    ver=U-Boot 2013.10-00189-g78d8ebd (Sep 08 2014 - 18:04:35)

    Environment size: 5413/131067 bytes
    U-Boot#

    Kindly assist me.

  • Hi Lyf,

    Try the below command.

    u-boot # setenv mmcroot /dev/mmcblk0p2 ro ip=dhcp

    u-boot # saveenv

    u-boot # boot

  • There is script used on the evm-sk with dual mac eabled that sets up a dhcp server. That script is located here in the SDK file system.

    bin/eth1_nat.sh

    It references a dhcp conf file located in the SDK file system.

    /etc/udhcpd_eth1.conf

     

  • Hi TItus,

    It doesn't worked out.

    This is the following log I am getting

    [   12.175274] Waiting up to 110 more seconds for network.
    [   22.175268] Waiting up to 100 more seconds for network.
    [   32.175269] Waiting up to 90 more seconds for network.
    [   42.175267] Waiting up to 80 more seconds for network.
    [   52.175267] Waiting up to 70 more seconds for network.
    [   60.325604] PM: request_firmware failed
    [   62.175271] Waiting up to 60 more seconds for network.
    [   72.175269] Waiting up to 50 more seconds for network.
    [   82.175267] Waiting up to 40 more seconds for network.
    [   83.156039] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
    [   83.175278] Sending DHCP requests ...... timed out!
    [  155.058947] IP-Config: Reopening network devices...
    [  155.064098] net eth0: initializing cpsw version 1.12 (0)
    [  155.071901] net eth0: phy found : id is : 0x4dd074
    [  155.081784] 8021q: adding VLAN 0 to HW filter on device eth0
    [  157.066180] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
    [  157.085278] Sending DHCP requests .....

    It seems like EVM is looking for DHCP server address rather than it provides the same.

    Regards,

    Lyf

  • Hi Schuyler Patton,

    Thanks for the reply.

    It would be great if you elaborate me bit more on use case of the script.  Also where eth1 port is available in EVM.

  • Hi Lyf,

    Also please make sure that you have enabled "DHCP support" in kernel configuration.

    make menuconfig ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi-

        [*] Networking support  --->

             Networking options  --->

                 [*]   IP: kernel level autoconfiguration

                        [*]     IP: DHCP support

  • Hi Titus,

    Yeah it has been enabled already.

    Regards,

    Lyf

  • Titus - It looks like Lyf wants the EVM to have a static IP address and have a dhcp server on the EVM to serve IP addresses.

    Lyf - You probably want to assign a static IP address to eth0. Maybe put ip=none in your boot args and then assign a static IP address after the board boots. Make sure you configure the dhcp server to serve IP addresses from the same subnet.

    Steve K.

  • Depending on which evm you have there are two ethernet ports such as the evm-sk or a single ethernet port such as the gp evm or the beagle bone series of boards.

    The script I mentioned was used to demonstrate NAT functionality with the evm-sk. For a board with a single ethernet port such as eth0 you could replace all the eth1 in the script with eth0. But now you need to setup a port that provides WAN capabilty or network access.  In the script eth0 is the WAN port, you will need to replace this with whatever you have chosen to be your WAN port.

  • hi  i too want to configure the am335xevm as dhcp server how to do that. it can act as dhcp client that i tested but to make a dhcp server so that it can gv ip address to pc

  • Hi Sanjeev,

    There are various decisions to install and configure dhcp server on am335x EVM board depending on what OS running on your board and what dhcp server application you have chosen. I give links to two tutorials:
    pixelsvsbytes.com/.../
    www.tldp.org/.../x369.html

    BR
    Tsvetolin Shulev