I am doing yocto project (kirkstone) on Beaglebone Black Board using meta-ti layer. How to set static IP address for eth0 in BBB.
These are the contents of my /etc/network/interfaces file.
Unless you have a specific reason for you using the yocto build, the best solution for this to get you up and running would be the use the IoT image for the bbb.
These images are running systemd. If memory is correct about the only thing you might need to add to those images might be gdb and cmake. This image has cockpit installed, you will like that.
I connected an ethernet cable to my BBB.
The ip addr show gave the following output.
root@beaglebone:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
link/ether 64:8c:bb:f7:74:15 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.125/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::668c:bbff:fef7:7415/64 scope link
valid_lft forever preferred_lft forever
Next I connected from a PC to BBB using an ethernet cable. The output is
root@beaglebone:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
link/ether 64:8c:bb:f7:74:15 brd ff:ff:ff:ff:ff:ff
inet6 fe80::668c:bbff:fef7:7415/64 scope link
valid_lft forever preferred_lft forever
Actually I need yocto project for my linux based HMI which launches a Qt application on boot. I also want to communicate to other boards through RS485, ethernet and USB from my HMI.
I set a static ip address in my linux PC. I gave values for address, subnet and gateway. After that I connected an ethernet cable from PC ethernet port to BBB ethernet port.
I haven’t made any changes in the BBB side. When I checked ifconfig, I got some random IP address. Each time I reboot this address will change.
I run this /etc/init.d/networking restart in my BBB.
It gave me the following error.
[ 74.164290] cpsw-switch 4a100000.switch: starting ndev. mode: dual_mac
[ 74.189893] cpsw-switch 4a100000.switch: phy "/ocp/interconnect@4a000000/segment@0/target-module@100000/switch@0/mdio@1000/ethernet-phy@0" not found on slave 0
I don’t have anything running connman so I cannot work along with you.
Did check the bing chat bot regarding the connman config.
If you use an exit node from EU instead of USA you will get better information. They are playing games with content delivered to USA endpoints.
You should be able to set static ip per the bing instructions and ping each device.
At this point without having a parallel setup it is hard to troubleshoot.
Bing chat bot:
Certainly! If you’re using ConnMan to manage network connections on your Linux system and want to set a static IP address, here are the steps you can follow:
Identify the Service Name: First, you need to find the service name associated with the network interface you want to configure. You can do this by running the following command:
connmanctl services
Look for the service name corresponding to the network interface (e.g., ethernet_6ceceb5cc3e2_cable or wifi_<HASH>_managed_psk).
Set the Static IP Address: Once you have the service name, use the following command to set a static IP address (replace <service_name> with the actual service name and adjust the IP address, subnet mask, and gateway as needed):
sudo connmanctl config <service_name> --ipv4 manual 10.0.10.0 255.255.0.0
For example, if your service name is ethernet_6ceceb5cc3e2_cable, the command would be:
sudo connmanctl config ethernet_6ceceb5cc3e2_cable --ipv4 manual 10.0.10.0 255.255.0.0
Verify the Configuration: To verify that the static IP address has been set, you can check the configuration file associated with the service. For Wi-Fi networks, the configuration file is located at /var/lib/connman/wifi_<HASH>_managed_psk/settings. You can manually create or edit this file with the desired settings. Here’s an example of the content:
[wifi_<HASH>_managed_psk]
Name=<SSID>
SSID=544f52414445585f4252
Favorite=true
IPv4.method=manual
IPv4.netmask_prefixlen=24
IPv4.local_address=192.168.0.133
IPv4.gateway=192.168.0.1
Passphrase=<PASS>
AutoConnect=true
Replace <SSID> with the network name, <PASS> with the Wi-Fi password, and adjust the IP address as needed.
Remember to replace placeholders like <service_name>, , , and with actual values relevant to your network configuration. If you encounter any issues, refer to the man page for connman-service.config1. Additionally, if you’re configuring Wi-Fi, ensure that the desired IP address is not conflicting with other devices on the network.
You will not get a good image using the ti recipe.
I used good old poky, added the ti layers and my own meta layer. Yocto just takes us so much space i had to delete so much of the stuff done for the BBB to make room for the i7 builds.
The IoT BBB image works just fine and is much simpler the use. Doing a proof of concept with a BBB in the system and regret deleting our previous work…
The yocto image in the yocto example for the BBB works perfectly. If memory is correct networking is up, out of the box with that one.
This is a local.conf we used to get the weston compositor up on bbb. Pretty sure if you just delete the opengl wayland and pam, then repoint the ss-cache and download directory you should get a good image.
MACHINE ?= "beaglebone-yocto"
DL_DIR ?= "/home/fred/build-files/downloads"
SSTATE_DIR ?= "/home/fred/build-files/ss-cache-armhf"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_deb"
INIT_MANAGER = "systemd"
EXTRA_IMAGE_FEATURES ?= " debug-tweaks tools-debug tools-testapps tools-sdk dbg-pkgs dev-pkgs"
USER_CLASSES ?= "buildstats"
DISTRO_FEATURES ?= "opengl wayland pam"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
HALT,${TMPDIR},100M,1K \
HALT,${DL_DIR},100M,1K \
HALT,${SSTATE_DIR},100M,1K \
HALT,/tmp,10M,1K"
CONF_VERSION = "2"
```
Here is the layer.conf for that build. I cannot
post the custom layer so just delete that.
```
```
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/fred/core-builds/poky/meta \
/home/fred/core-builds/poky/meta-poky \
/home/fred/core-builds/poky/meta-yocto-bsp \
/home/fred/meta-layers/meta-arm/meta-arm-toolchain \
/home/fred/meta-layers/meta-arm/meta-arm \
/home/fred/meta-layers/meta-arm/meta-arm-bsp \
/home/fred/meta-layers/meta-basic-weston-dev \
/home/fred/meta-layers/meta-openembedded/meta-oe \
/home/fred/meta-layers/meta-wayland \
"
```
#!/bin/sh
DAEMON=/usr/sbin/connmand
PIDFILE=/var/run/connmand.pid
DESC="Connection Manager"
if [ -f /etc/default/connman ] ; then
. /etc/default/connman
fi
set -e
nfsroot=0
exec 9<&0 < /proc/mounts
while read dev mtpt fstype rest; do
if test $mtpt = "/" ; then
case $fstype in
nfs | nfs4)
nfsroot=1
break
;;
*)
;;
esac
fi
done
do_start() {
if test $nfsroot -eq 1 ; then
NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
if [ ! -z "$NET_ADDR" ]; then
if [ "$NET_ADDR" = dhcp ]; then
ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
if [ ! -z "$ethn" ]; then
EXTRA_PARAM="$EXTRA_PARAM -I $ethn"
fi
else
for i in $NET_DEVS; do
ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
if [ "$NET_ADDR" = "$ADDR" ]; then
EXTRA_PARAM="$EXTRA_PARAM -I $i"
break
fi
done
fi
fi
fi
if [ -f /usr/share/connman/wired-setup ] ; then
. /usr/share/connman/wired-setup
fi
$DAEMON $EXTRA_PARAM
}
do_stop() {
start-stop-daemon --stop --name connmand --quiet
}
case "$1" in
start)
echo "Starting $DESC"
do_start
;;
stop)
echo "Stopping $DESC"
do_stop
;;
restart|force-reload)
echo "Restarting $DESC"
do_stop
sleep 1
do_start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
That should be in the default local.conf. Don’t touch any thing, then do the initial build as they say and test the qemu. When that checks out modify your local config. Also, since you have a download directory from the previous builds, point your “poky” build to that. Or move the download directory into a common ground location, that will save you hours of downloading. Also set up the sscache, use one sscache for armhf and another for arch64.
Also, if you have NVMe move your yocto stuff onto it.
I don’t believe all the Ti layers are much past the kirkstone release, so if you need to use Ti layers you will have to checkout kirkstone.
that’s what i did for a nanbield build, don’t remember all the issue he’s having.
testing kirkstone now, will get back
NetworkManager does not seem to work on kirkstone branch
will look at nanbield branch over the week end. already built, just need to program an sdcard and test.
I should have thought about this sooner, if you have multiple ethernet interfaces running such as wire and wifi turn one off, the wifi. You will have instability, it does work on both at the same time just be aware so you can restart or turn one off.
Connect your wire directly between bbb and your host.
Assign your host an IP in the IPv4 tab,
manual
address 192.168.60.20
Netmask 255.255.255.0
Gateway 192.168.60.1
You can use what ever subnet and address you need, just make sure all devices are on same subnet and gateway is .1
If you have wifi leave it alone, just toggle it off and on. Preferable leave it off until you get your wire up.
It should be fine, assuming the interface is configured for static.
At this point the best plan would be to load the IoT image on SD and run it. Get your networking configured with static IP first then go back to the yocto build when you know the proper settings. I know for fact the IoT (12) image (flasher) networking works fine, too many unknowns is too much trouble to deal with at one time.
Using the BB IoT image, set this file like mine. You should see the same interface id. This will allow you to have a static IP then if you need to connect to the internet to download packages or whatever you just connect the ethernet to your local gateway/router.
It is best practice to run your dev network on a subnet that is different than your “main” network with internet access.