From 7873d287300c204c594bc46429bca066cbd68bea Mon Sep 17 00:00:00 2001 From: Philippe Schenker Date: Fri, 15 May 2020 17:18:55 +0200 Subject: recipes-connectivity: add hostapd-example package This will add an example hostapd package that will contain all necessary files to just "enable" an acces-point on a demo image. Relates-to: ELB-1303 Signed-off-by: Philippe Schenker --- .../hostapd-example/hostapd-example.bb | 37 ++++++++++++++++++++++ .../hostapd-example/enable-wifi.service | 13 ++++++++ .../hostapd-example/hostapd-example.network | 5 +++ .../hostapd-example/hostapd-example.service | 12 +++++++ .../hostapd-example/hostapd-tdx-demo-img.conf | 8 +++++ recipes-images/images/packagegroup-tdx-cli.bb | 1 + 6 files changed, 76 insertions(+) create mode 100644 recipes-connectivity/hostapd-example/hostapd-example.bb create mode 100644 recipes-connectivity/hostapd-example/hostapd-example/enable-wifi.service create mode 100644 recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.network create mode 100644 recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.service create mode 100644 recipes-connectivity/hostapd-example/hostapd-example/hostapd-tdx-demo-img.conf diff --git a/recipes-connectivity/hostapd-example/hostapd-example.bb b/recipes-connectivity/hostapd-example/hostapd-example.bb new file mode 100644 index 0000000..dc0b9db --- /dev/null +++ b/recipes-connectivity/hostapd-example/hostapd-example.bb @@ -0,0 +1,37 @@ +SUMMARY = "Deployment of example files to run hostapd on Toradex demo images" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +RDEPENDS_${PN} = "hostapd" + +S = "${WORKDIR}" + +SRC_URI = " \ + file://enable-wifi.service \ + file://hostapd-example.service \ + file://hostapd-example.network \ + file://hostapd-tdx-demo-img.conf \ +" + +inherit allarch systemd + +SYSTEMD_SERVICE_${PN} = "hostapd-example.service" +SYSTEMD_AUTO_ENABLE_${PN} = "disable" + +do_install() { + install -d ${D}${systemd_unitdir}/system/ ${D}${systemd_unitdir}/network/ ${D}${sysconfdir}/ + install -m 0644 enable-wifi.service ${D}${systemd_unitdir}/system/ + install -m 0644 hostapd-example.network ${D}${systemd_unitdir}/network/ + install -m 0644 hostapd-example.service ${D}${systemd_unitdir}/system/ + install -m 0644 hostapd-tdx-demo-img.conf ${D}${sysconfdir}/ + sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/hostapd-example.service +} + +FILES_${PN} += " \ + ${systemd_unitdir}/system/* \ + ${systemd_unitdir}/network/hostapd-example.network \ + ${sysconfdir}/hostapd-tdx-demo-img.conf \ +" + diff --git a/recipes-connectivity/hostapd-example/hostapd-example/enable-wifi.service b/recipes-connectivity/hostapd-example/hostapd-example/enable-wifi.service new file mode 100644 index 0000000..623c281 --- /dev/null +++ b/recipes-connectivity/hostapd-example/hostapd-example/enable-wifi.service @@ -0,0 +1,13 @@ +[Unit] +Description=Enable Wifi +BindsTo=sys-subsystem-net-devices-uap0.device +After=sys-subsystem-net-devices-uap0.device + +[Service] +Type=oneshot +ExecStart=/usr/bin/connmanctl enable wifi +ExecStop= +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.network b/recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.network new file mode 100644 index 0000000..b498584 --- /dev/null +++ b/recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.network @@ -0,0 +1,5 @@ +[Match] +Name=uap0 +[Network] +Address=192.168.8.1/24 +DHCPServer=yes diff --git a/recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.service b/recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.service new file mode 100644 index 0000000..9f576ef --- /dev/null +++ b/recipes-connectivity/hostapd-example/hostapd-example/hostapd-example.service @@ -0,0 +1,12 @@ +[Unit] +Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator +Requires=enable-wifi.service + +[Service] +Type=forking +PIDFile=/run/hostapd.pid +ExecStart=@SBINDIR@/hostapd @SYSCONFDIR@/hostapd-tdx-demo-img.conf -P /run/hostapd.pid -B + + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/hostapd-example/hostapd-example/hostapd-tdx-demo-img.conf b/recipes-connectivity/hostapd-example/hostapd-example/hostapd-tdx-demo-img.conf new file mode 100644 index 0000000..bc93609 --- /dev/null +++ b/recipes-connectivity/hostapd-example/hostapd-example/hostapd-tdx-demo-img.conf @@ -0,0 +1,8 @@ +interface=uap0 +ssid=testwifi +hw_mode=a +channel=40 +ieee80211n=1 +own_ip_addr=192.168.8.1 +wpa=2 +wpa_passphrase=testwifipw diff --git a/recipes-images/images/packagegroup-tdx-cli.bb b/recipes-images/images/packagegroup-tdx-cli.bb index 18a394b..cfcc5df 100644 --- a/recipes-images/images/packagegroup-tdx-cli.bb +++ b/recipes-images/images/packagegroup-tdx-cli.bb @@ -177,6 +177,7 @@ BACKPORTS = "backports" RRECOMMENDS_packagegroup-wifi-tdx-cli = "\ ${BACKPORTS} \ hostapd \ + hostapd-example \ wireless-regdb-static \ " -- cgit v1.2.3