Configure Wireless using wpa_supplicant for Odroid minimal image
Find the wireless card Interface name.
# iwconfig sit0 no wireless extensions. lo no wireless extensions. eth0 no wireless extensions. ip6tnl0 no wireless extensions. wlx40a5efd52a6d unassociated Nickname:"<WIFI@REALTEK>" Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated Sensitivity:0/0 Retry:off RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=0/100 Signal level=0 dBm Noise level=0 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Need to append the net.ifnames=0 to bootargs in /media/boot/boot.ini to change the interface name to wlan0.
Following are the steps to Create wireless service to connect to your router.
Step1 : Find SSID to connect.
# sudo iwlist wlan0 scanning | egrep 'Cell |Encryption|Quality|Last beacon|ESSID' Cell 01 - Address: 5E:CF:7F:84:54:70 ESSID:"smartpower2" Encryption key:on Quality=0/100 Signal level=-45 dBm Cell 02 - Address: 5E:CF:7F:13:91:D6 ESSID:"smartpower2" Encryption key:on Quality=0/100 Signal level=-45 dBm Cell 03 - Address: 2C:30:33:5E:8C:9D ESSID:"MYSSID" Encryption key:on Quality=0/100 Signal level=-45 dBm Cell 04 - Address: 2C:30:33:5E:8C:9C ESSID:"GoToHell-5G" Encryption key:on Quality=0/100 Signal level=-45 dBm
Step2: Generate wireless wpa_supplicant configuration file
This connection method allows quickly connecting to a network whose SSID is already known
# wpa_passphrase MY_SSID MY_PASSWORD > /etc/wpa_supplicant/wpa_supplicant.conf
Replace MY_SSID with the actual network name, and replace MY_PASSWORD with the actual security key for the network.
Step3: Create Wireless Service file. /etc/systemd/system/network-wireless@.service Append the following to the service file
[Unit] Description=Wireless network connectivity (%i) Wants=network.target Before=network.target BindsTo=sys-subsystem-net-devices-%i.device After=sys-subsystem-net-devices-%i.device [Service] Type=oneshot RemainAfterExit=yes ExecStart=/sbin/ip link set dev %i up ExecStart=/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf ExecStart=/sbin/dhclient %i ExecStop=/sbin/ip link set dev %i down [Install] WantedBy=multi-user.target
Note: depend on you setting in your image you need to update the absolute patch for ip, wpa_supplicant and dhclient command
Step4 : Need to Create Symbolic link to update the service.
# ln -s /etc/systemd/system/network-wireless@.service /etc/systemd/system/multi-user.target.wants/network-wireless@wlan0.service
Step5 : Enable the service.
# systemctl enable network-wireless@wlan0.service
Step6: Reload the all the serivce
# systemctl daemon-reload
Step7: Start the systemctrl service
# systemctl start network-wireless@wlan0.service
After this we will get ip address from the router.
# ifconfig eth0 Link encap:Ethernet HWaddr 00:1e:06:10:dc:ad inet addr:10.0.0.138 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::21e:6ff:fe10:dcad/64 Scope:Link inet6 addr: 2002:ac10:e33c:e472:21e:6ff:fe10:dcad/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6808 errors:0 dropped:0 overruns:0 frame:0 TX packets:3519 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7876906 (7.8 MB) TX bytes:298180 (298.1 KB) Interrupt:40 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:160 errors:0 dropped:0 overruns:0 frame:0 TX packets:160 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB) wlan0 Link encap:Ethernet HWaddr 40:a5:ef:d5:2a:6d inet addr:10.0.0.111 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: 2002:ac10:e33c:e472:42a5:efff:fed5:2a6d/64 Scope:Global inet6 addr: 2002:ac10:e33c:e472:c056:d96b:b7f9:4425/64 Scope:Global inet6 addr: fe80::42a5:efff:fed5:2a6d/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:1 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2830 (2.8 KB) TX bytes:1700 (1.7 KB)