Enable Ethernet/SSH using Buildroot [Solved]

Spearitch

Member
Joined
Oct 14, 2020
Messages
45
Reaction score
6
Credits
475
Hello Everyone


I built a Buildroot image for my STM32MP157C-DK2 and I would like to enable Wifi and Ethernet.

Are there some specific packages that I need to install before doing so ?

I found this article here but I it is specific for an STM32 device with OpenSTLinux so I don't know if it is also possible to apply this method.

I worked with embedded Linux before and I always had a direct connection to ethernet through SSH. in my case ifconfig does not output an IP-Adress for eth0.

Any suggestion on how I should proceed in order to have Ethernet and then Wifi operating on my device?


Thank you.

p.s I am using a remote controle software: MobaXterm for SSH access
 


What network hardware? You mentioned an article about OpenSTLinux, is that the distro you are using?

Can you give output of...

cat /etc/os-release

ip add

lspci
 
What network hardware? You mentioned an article about OpenSTLinux, is that the distro you are using?

Can you give output of...

cat /etc/os-release

ip add

lspci
Sorry I have made a Mistake.. My actual distro is Buildroot and not OpenSTLinux. Quiet confused these days because I am working with both. But yeah the problem remains the same.

This is the Output that I get

Code:
# cat /etc/os-release
NAME=Buildroot
VERSION=2019.02.1-00104-g0dbb719bf0
ID=buildroot
VERSION_ID=2019.02.1
PRETTY_NAME="Buildroot 2019.02.1"
# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

# ip add
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> mtu 1500 qdisc noop qlen 1000
    link/ether 00:80:e1:42:6b:16 brd ff:ff:ff:ff:ff:ff
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
# lspci
lspci: /sys/bus/pci/devices: No such file or directory
 
For ifconfig, you sometimes have to use the "-a" flag.

ifconfig -a (a for all)

Buildroot is more of a IOT, embedded Linux. It doesn't come with many networking tools.

Can you also give output from

uname -a

and

systemctl list-unit-files
 
systemctl list-unit-files does not work in my case --> command not found
is it a package ? because I also didn't find it when searching for it in the package list included in buildroot. (there is systemd and systemd-bootchart

Code:
# uname -a
Linux buildroot 4.19.26 #1 SMP PREEMPT Sun Oct 25 11:25:55 CET 2020 armv7l GNU/Linux
#
#
# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:80:E1:42:6B:16
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:60 Base address:0x8000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
Don't worry about the systemd, it was just a check to see which way to go.

It has been a long time since I have even seen buildroot. :)

Do you have a /etc/sysconfig/network-scripts directory?

If not, it could also be at...

/usr/share/initramfs-tools/scripts/

Wifi on IOT is often difficult.
 
Don't worry about the systemd, it was just a check to see which way to go.

It has been a long time since I have even seen buildroot. :)

Do you have a /etc/sysconfig/network-scripts directory?

If not, it could also be at...

/usr/share/initramfs-tools/scripts/

Wifi on IOT is often difficult.

What is difficult exactly ?



Code:
cd etc
# ls
auto.master            inittab                request-key.conf
auto.misc              inputrc                request-key.d
auto.net               issue                  resolv.conf
auto.smb               mtab                   sensors.d
autofs.conf            network                sensors3.conf
autofs_ldap_auth.conf  nsswitch.conf          services
default                os-release             shadow
fstab                  passwd                 shells
group                  profile                ssl
hostname               profile.d              xattr.conf
hosts                  protocols
init.d                 random-seed

and this is what I have in usr/share/
Code:
# cd usr/share/
# ls
applications     glib-2.0         lua              pixmaps
gettext          installed-tests  luajit-2.0.5     systemtap
git-core         keyutils         mysql            terminfo
gitweb           locale           perl             udhcpc

As far as I understood you are searching for packages is that right ?
If you want to have an Idea on the available packages here is a repo where to find the list of packages that I can implement.
git clone git://git.buildroot.net/buildroot

p.s I replaced git with http in my case so that it can work
 
We are looking for network config files.

I see you have an /etc/network
It's possible they could be in there.
Usually they will start with ifcfg like...

ifcfg-eth0 or something similar.

The difficulty for wifi is that the drivers are often missing,
also the networking tools to support wifi are often missing.
 
We are looking for network config files.

I see you have an /etc/network
It's possible they could be in there.
Usually they will start with ifcfg like...

ifcfg-eth0 or something similar.

The difficulty for wifi is that the drivers are often missing,
also the networking tools to support wifi are often missing.
1603728784903.png
 
try...

cat interfaces

and possibly...

find / -name ifcfg*
 
try...

cat interfaces

and possibly...

find / -name ifcfg*
Code:
# cat interfaces
# interface file auto-generated by buildroot

auto lo
iface lo inet loopback
#

The other command does not trigger an error but displays nothing but in the network folder I found these docs

Code:
if-down.d       if-pre-up.d     interfaces
if-post-down.d  if-up.d

p.s interfaces is not a directory
 
Last edited:
what is in if-up.d ?
 
if-up.d is empty.

I found this on a website and configured it according to my own network which I got from windows CMD --> ipconfiall /all --> Wireless LAN adapter WLAN
1603738313704.png


Code:
# Configure eth0 with static IP

auto eth0

iface eth0 inet static
#same as the adress found in the network and internet settings window on my Windows
        address 192.168.8.124
#Last number different from the one found in the network and internet settings window on my Windows
        network 192.168.8.0

        netmask 255.255.255.0


# Configure eth0 with dhcp IP
# auto eth0
# iface eth0 inet dhcp

When I reboot I get
Code:
Welcome to Buildroot
buildroot login: [    4.237815] stm32-dwmac 5800a000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[    4.251345] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


I did so and now when I ifconfig -a I get:
Code:
eth0      Link encap:Ethernet  HWaddr 00:80:E1:42:6B:16
          inet addr:192.168.8.124  Bcast:192.168.8.0  Mask:255.255.255.0
          inet6 addr: fd54:25ea:6f3c:e600:280:e1ff:fe42:6b16/64 Scope:Global
          inet6 addr: fe80::280:e1ff:fe42:6b16/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:960 (960.0 B)  TX bytes:844 (844.0 B)
          Interrupt:60 Base address:0x8000

Still does not want to connect. Maybe I filled them the interfaces document in the wrong way.
 
I would think you would need a gateway defined somewhere.
Also I believe the line that says "auto eth0" might have to be changed to
"none eth0"
 
I would think you would need a gateway defined somewhere.
Also I believe the line that says "auto eth0" might have to be changed to
"none eth0"
Why should I do so ? I want to use ethernet too, not only wifi
 
The "auto" enables DHCP.
You can't have DHCP and a static IP on the same interface.
In a normal ifcfg-eth0 network file you have a line that looks like this.
BOOTPROTO=none
or
BOOTPROTO=dhcp

none doesn't disable the interface, it disables dhcp.

network 192.168.8.0
netmask 255.255.255.0
gateway 192.168.8.1
dns1 8.8.8.8
dns2 8.8.4.4

edit the values above to match your network.
 
this what I get when I ifconfig -a

Code:
# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:80:E1:42:6B:16
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:60 Base address:0x8000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
The "auto" enables DHCP.
You can't have DHCP and a static IP on the same interface.
In a normal ifcfg-eth0 network file you have a line that looks like this.
BOOTPROTO=none
or
BOOTPROTO=dhcp

none doesn't disable the interface, it disables dhcp.

network 192.168.8.0
netmask 255.255.255.0
gateway 192.168.8.1
dns1 8.8.8.8
dns2 8.8.4.4

edit the values above to match your network.
auto lo
iface lo inet loopback
# Configure eth0 with static IP
none eth0
iface eth0 inet static
network 192.168.8.0
netmask 255.255.255.0
gateway 192.168.8.1
dns1 8.8.8.8
dns2 8.8.4.4
# Configure eth0 with dhcp IP
# auto eth0
# iface eth0 inet dhcp

This is what I get when I reboot and ifconfig -a
Code:
# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:80:E1:42:6B:16
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:60 Base address:0x8000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 

It appears the the "auto eth0" line is in the config file twice.
It is needed once.
 

Members online


Latest posts

Top