I had to clean /etc/network/interfaces and /opt/scripts/boot/am335x_evm.sh
of all references to the USB0 items.

The udhcpd.conf file tells your beagle bone how to behave as a DHCP server
(which it had to do for USB since your PC would not be handing out DHCP
licenses to a device connected by USB).

When you modified the conf file, it started handing out DHCP leases on the
interface you put in (probably eth0, which is why your beagle bone was
giving out ip address to devices on your network). If you put the interface
back to usb0 in /etc/udhcpd.conf, it will stop doing that, and will have no
adverse consequences.

At some point you might want to disable udhcpd altogether as you will not
need it unless you intend the beagle bone be a DHCP server


-=Eric Schumann



my /etc/network/interfaces

<start of file>

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
# Example to keep MAC address between reboots
#hwaddress ether 7c:66:9d:4e:5e:DD

# The secondary network interface
#auto eth1
#iface eth1 inet dhcp

# WiFi Example
#auto wlan0
#iface wlan0 inet dhcp
#    wpa-ssid "essid"
#    wpa-psk  "password"

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
#iface usb0 inet static
#    address 192.168.7.2
#    netmask 255.255.255.0
#    network 192.168.7.0
#    gateway 192.168.7.1

<end of file>

and my /opt/scripts/boot/am335x_evm.sh:


<start of file>

#!/bin/sh -e
#
# Copyright (c) 2013-2014 Robert Nelson <robertcnel...@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
copy
# of this software and associated documentation files (the "Software"), to
deal
# in the Software without restriction, including without limitation the
rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

#Based off:
#
https://github.com/beagleboard/meta-beagleboard/blob/master/meta-beagleboard-extras/recipes-support/usb-gadget/gadget-init/g-ether-load.sh

eeprom="/sys/bus/i2c/devices/0-0050/eeprom"

#Flash BeagleBone Black's eeprom:
if [ -f /boot/uboot/flash-eMMC.txt ] ; then
        eeprom_location=$(ls
/sys/devices/ocp.*/44e0b000.i2c/i2c-0/0-0050/eeprom 2> /dev/null)
        eeprom_header=$(hexdump -e '8/1 "%c"' ${eeprom} -s 5 -n 3)
        if [ "x${eeprom_header}" = "x335" ] ; then
                echo "Valid EEPROM header found"
        else
                echo "Invalid EEPROM header detected"
                if [ -f /opt/scripts/device/bone/bbb-eeprom.dump ] ; then
                        if [ ! "x${eeprom_location}" = "x" ] ; then
                                echo "Adding header to EEPROM"
                                dd
if=/opt/scripts/device/bone/bbb-eeprom.dump of=${eeprom_location}
                        fi
                fi
        fi
fi

SERIAL_NUMBER=$(hexdump -e '8/1 "%c"' ${eeprom} -s 14 -n 2)-$(hexdump -e
'8/1 "%c"' ${eeprom} -s 16 -n 12)
ISBLACK=$(hexdump -e '8/1 "%c"' ${eeprom} -s 8 -n 4)

BLACK=""
if [ "x${ISBLACK}" = "xBBBK" ] || [ "x${ISBLACK}" = "xBNLT" ] ; then
        BLACK="Black"
fi

mac_address="/proc/device-tree/ocp/ethernet@4a100000/slave@4a100200
/mac-address"
if [ -f ${mac_address} ] ; then
        cpsw_0_mac=$(hexdump -v -e '1/1 "%02X" ":"' ${mac_address} | sed
's/.$//')
fi

mac_address="/proc/device-tree/ocp/ethernet@4a100000/slave@4a100300
/mac-address"
if [ -f ${mac_address} ] ; then
        cpsw_1_mac=$(hexdump -v -e '1/1 "%02X" ":"' ${mac_address} | sed
's/.$//')
fi

unset boot_partition
boot_partition=$(LC_ALL=C lsblk -l | grep "/boot/uboot" | awk '{print $1}')
if [ "x${boot_partition}" = "x" ] ; then
        gadget_partition="/dev/mmcblk0p1"
else
        gadget_partition="/dev/${boot_partition}"
fi

modprobe g_multi file=${gadget_partition} cdrom=0 stall=0 removable=1
nofua=1 iSerialNumber=${SERIAL_NUMBER} iManufacturer=Circuitco
iProduct=BeagleBone${BLACK} host_addr=${cpsw_1_mac}

sleep 1

sed -i -e 's:DHCPD_ENABLED="no":#DHCPD_ENABLED="no":g' /etc/default/udhcpd
#Distro default...
deb_udhcpd=$(cat /etc/udhcpd.conf | grep Sample || true)
if [ "${deb_udhcpd}" ] ; then
        mv /etc/udhcpd.conf /etc/udhcpd.conf.bak
fi

if [ ! -f /etc/udhcpd.conf ] ; then
        echo "start      192.168.7.1" > /etc/udhcpd.conf
        echo "end        192.168.7.1" >> /etc/udhcpd.conf
#       echo "interface  usb0" >> /etc/udhcpd.conf
        echo "max_leases 1" >> /etc/udhcpd.conf
        echo "option subnet 255.255.255.252" >> /etc/udhcpd.conf
fi
/etc/init.d/udhcpd restart

#/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252
/usr/sbin/udhcpd -S /etc/udhcpd.conf

eth0_addr=$(ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1)
#usb0_addr=$(ip addr list usb0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1)
wlan0_addr=$(ip addr list wlan0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1)

sed -i -e '/Address/d' /etc/issue

if [ ! "x${eth0_addr}" = "x" ] ; then
        echo "The IP Address for eth0 is: ${eth0_addr}" >> /etc/issue
fi
if [ ! "x${wlan0_addr}" = "x" ] ; then
        echo "The IP Address for wlan0 is: ${wlan0_addr}" >> /etc/issue
fi
#if [ ! "x${usb0_addr}" = "x" ] ; then
#       echo "The IP Address for usb0 is: ${usb0_addr}" >> /etc/issue
#fi

if [ -f /boot/uboot/flash-eMMC.txt ] ; then
        if [ ! -d /boot/uboot/debug/ ] ; then
                mkdir -p /boot/uboot/debug/ || true
        fi

        if [ -f /opt/scripts/tools/beaglebone-black-eMMC-flasher.sh ] ; then
                /bin/bash
/opt/scripts/tools/beaglebone-black-eMMC-flasher.sh
>/boot/uboot/debug/flash-eMMC.log 2>&1
        fi
fi

if [ -f /boot/uboot/resizerootfs ] || [ -f /resizerootfs ] ; then
        if [ ! -d /boot/uboot/debug/ ] ; then
                mkdir -p /boot/uboot/debug/ || true
        fi

        drive=$(cat /boot/uboot/resizerootfs)
        if [ "x${drive}" = "x" ] ; then
                drive=$(cat /resizerootfs)
        fi
        if [ "x${drive}" = "x" ] ; then
                drive="/dev/mmcblk0"
        fi

        #FIXME: only good for two partition "/dev/mmcblkXp2" setups...
        resize2fs ${drive}p2 >/boot/uboot/debug/resize.log 2>&1
        rm -rf /boot/uboot/resizerootfs || true
        rm -rf /resizerootfs || true
fi

#

<end of file>





On Thu, Jun 4, 2015 at 11:04 AM, <ferro...@gmail.com> wrote:

> Hi Robert,
>
> old thread I know but I've been trying to disable ethernet on USB0 and
> this is the closest I've gotten to an answer.
> Is this the correct way to go about it?
>
> I'm asking because I tried commenting out everything regarding usb0 in
> /opt/scripts/boot/am335x_evm.sh and /etc/network/interfaces as well as in
> /etc/udhcpd.conf.
> I rebooted and the usb0 ehthernet was disabled (no USB0 when I did
> ifconfig) but my colleagues were a bit upset as I apparently had started a
> dhcp server on my beaglebone at the same time, which messed with our real
> dhcp server so they got bad ip addresses.
>
> So, what did I do wrong? Should I have left the /etc/udhcp.conf alone?
>
> cheers,
>
> Per
>
> NNNN
>
>
> On Friday, May 2, 2014 at 11:14:27 PM UTC+2, RobertCNelson wrote:
>>
>>
>> On May 2, 2014 2:11 PM, <geo...@gmail.com> wrote:
>> >
>> > How do we disable the USB0 interface on the newer images? Do we wipe
>> the references from /opt/scripts/boot/am335x_evm.sh, and
>> /etc/network/interfaces, or is there something else?
>>
>> Correct..
>>
>> >
>> >
>> >
>> > On Friday, April 11, 2014 11:49:51 AM UTC-4, RobertCNelson wrote:
>> >>
>> >> On Fri, Apr 11, 2014 at 10:41 AM,  <xdon...@gmail.com> wrote:
>> >> > I installed an image which is
>> BBB-eMMC-flasher-ubuntu-13.10-2014-02-16-2gb.
>> >> > Probably that's why I didn't find the file. I want to change the
>> default ip
>> >> > address for usb0. I found out that in the script
>> >> > /opt/scripts/boot/am335x_evm.sh there is one line to setup the port.
>> Can I
>> >> > change it there? will it work?
>> >>
>> >> Yeap, but also /etc/network/interfaces... (don't ask why i do it in
>> >> both places..)
>> >>
>> >> Regards,
>> >>
>> >> --
>> >> Robert Nelson
>> >> http://www.rcn-ee.com/
>> >
>> > --
>> > For more options, visit http://beagleboard.org/discuss
>> > ---
>> > You received this message because you are subscribed to the Google
>> Groups "BeagleBoard" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to beagleboard...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>  --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/f2YvaQTRPNE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> beagleboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to