Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ IMAGE_INSTALL:append:am62xx = " ti-gst-plugins-source ti-gst-plugins-dev ti-gst-
IMAGE_INSTALL:append:am62pxx = " ti-gst-plugins-source ti-gst-plugins-dev ti-gst-utils "
IMAGE_INSTALL:remove:am62dxx = " packagegroup-arago-graphics"
IMAGE_INSTALL:append:am62dxx = " cpld-ctl"
IMAGE_INSTALL:append:am64xx = " wifi-oob"

IMAGE_INSTALL:append = "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' packagegroup-core-selinux', '', d)}"
IMAGE_INSTALL:append = "${@bb.utils.contains('BBFILE_COLLECTIONS', 'chromium-browser-layer', ' chromium-ozone-wayland', '', d)}"
57 changes: 57 additions & 0 deletions meta-ti-foundational/recipes-demos/wifi-oob/wifi-oob.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
SUMMARY = "WiFi out-of-box experience launcher"
DESCRIPTION = "WiFi out-of-box experience launcher"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

PR = "r1"

COMPATIBLE_MACHINE = "am64xx"
PACKAGE_ARCH = "${MACHINE_ARCH}"

SRC_URI = " \
file://startwlanap.sh \
file://startwlanap.service \
file://01-wlan1-static.network \
file://startwlansta.service \
file://startwlansta.sh \
file://wificfg \
"

RDEPENDS:${PN} += "bash python3"

inherit systemd deploy

SYSTEMD_SERVICE:${PN} = "startwlanap.service startwlansta.service"
SYSTEMD_AUTO_ENABLE:${PN} = "enable"

do_install() {
install -d ${D}${sysconfdir}/systemd/network
install -m 0644 ${UNPACKDIR}/01-wlan1-static.network ${D}${sysconfdir}/systemd/network

install -d ${D}${sysconfdir}/init.d
install -m 0755 ${UNPACKDIR}/startwlanap.sh ${D}${sysconfdir}/init.d
install -m 0755 ${UNPACKDIR}/startwlansta.sh ${D}${sysconfdir}/init.d

install -d ${D}${systemd_system_unitdir}
install -m 0644 ${UNPACKDIR}/startwlanap.service ${D}${systemd_system_unitdir}
install -m 0644 ${UNPACKDIR}/startwlansta.service ${D}${systemd_system_unitdir}

install -d ${D}${datadir}/wl18xx
install -m 0755 ${UNPACKDIR}/wificfg ${D}${datadir}/wl18xx
}

do_deploy() {
install -d ${DEPLOYDIR}
install -m 0755 ${UNPACKDIR}/wificfg ${DEPLOYDIR}
}
addtask deploy after do_compile

FILES:${PN} += " \
${sysconfdir}/systemd/network/01-wlan1-static.network \
${sysconfdir}/init.d/startwlanap.sh \
${sysconfdir}/init.d/startwlansta.sh \
${systemd_system_unitdir}/startwlanap.service \
${systemd_system_unitdir}/startwlansta.service \
${datadir}/wl18xx/ \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Match]
Name=wlan1

[Network]
Address=192.168.43.1
Broadcast=192.168.43.255
Netmask=255.255.255.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=startwlanap

[Service]
Type=exec
ExecStart=/etc/init.d/startwlanap.sh
After=systemd-logind.service
StandardOutput=journal+console
RemainAfterExit=yes


[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

board_model=$(tr -d '\0' </proc/device-tree/model)

if [[ $board_model == *"AM642 SK"* || $board_model == *"AM625 SK"* ]]
then
if [[ $board_model == *"AM642 SK"* ]]
then
defapname=AM64xSK-AP
else
defapname=AM62xSK-AP
fi

cd /usr/share/wl18xx

./load_wlcore.sh
sleep 1

a3=$(iw wlan0 info | grep "addr" | awk '{split($0,a,":"); print a[3]}')

a4=$(iw wlan0 info | grep "addr" | awk '{split($0,a,":"); print a[4]}')

a5=$(iw wlan0 info | grep "addr" | awk '{split($0,a,":"); print a[5]}')

apname="${defapname}_${a3}${a4}${a5}"

sed -i "s/ssid=.*/ssid=${apname}/g" /usr/share/wl18xx/hostapd.conf

./ap_start.sh
sleep 1

iperf3 -B 192.168.43.1 -p 6001 -s -i 5 &
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=startwlansta

[Service]
Type=exec
ExecStart=/etc/init.d/startwlansta.sh
After=startwlanap.service
StandardOutput=journal+console
RemainAfterExit=yes


[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

get_cfg ()
{
configfile=$1
section=$2
param=$3

python3 -c "
import configparser;
config = configparser.ConfigParser();
config.read('$configfile');
print (config.get('$section','$param'));
"
}


board_model=$(tr -d '\0' </proc/device-tree/model)

filename=/media/mmcblk1p1/wificfg

if [[ $board_model == *"AM642 SK"* ]]
then
defapname=AM64xSK-AP
else
defapname=AM62xSK-AP
fi


cd /usr/share/wl18xx

if [ ! -d "/media/mmcblk1p1" ]; then
mkdir /media/mmcblk1p1
fi

mount /dev/mmcblk1p1 /media/mmcblk1p1

./load_wlcore.sh
sleep 1

if [ ! -f $filename ]; then
echo "Wi-Fi user configuration file missing, exit"
exit
else
ENABLE=`get_cfg $filename Wifi-STA demo_enable`
WIFINAME=`get_cfg $filename Wifi-STA ssid`
WIFIPASSWORD=`get_cfg $filename Wifi-STA password`

if [ $ENABLE != "yes" ]; then
exit
fi

if [ -z "$WIFINAME" ] ; then
echo "Client WiFi network NOT configured..exit"
exit
fi

ifconfig wlan0 up

sleep 1
./sta_start.sh
sleep 1

if [ -z "$WIFIPASSWORD" ] ; then
./sta_connect-ex.sh ${WIFINAME} NONE
else
./sta_connect-ex.sh ${WIFINAME} WPA-PSK ${WIFIPASSWORD}
fi

sleep 1

fi
10 changes: 10 additions & 0 deletions meta-ti-foundational/recipes-demos/wifi-oob/wifi-oob/wificfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is used for configuring the credentials required when the
# board is acting as a WiFi station.
# Customize this as per your need
# Set the demo_enable to yes so that the board connects to the AP automatically
# after the boot

[Wifi-STA]
demo_enable = no
ssid = homewifi
password = password123