From 1ce7412052af2e2a8a5dffc451035b8025bb78ee Mon Sep 17 00:00:00 2001 From: Rock Qu Date: Thu, 13 Jun 2019 15:08:09 -0700 Subject: [PATCH] fix wpa_ap service --- Ultra96/packages/wilc3000/pre.sh | 9 ++-- Ultra96/packages/wilc3000/qemu.sh | 44 ++++++++++++++----- Ultra96/packages/wilc3000/wpa_ap.service | 11 +++++ .../wilc3000/{ap_v2.sh => wpa_ap/ap.sh} | 4 +- Ultra96/packages/wilc3000/wpa_ap/wpa_ap.conf | 10 +++++ Ultra96/specs/Ultra96_v2.spec | 3 +- 6 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 Ultra96/packages/wilc3000/wpa_ap.service rename Ultra96/packages/wilc3000/{ap_v2.sh => wpa_ap/ap.sh} (83%) create mode 100644 Ultra96/packages/wilc3000/wpa_ap/wpa_ap.conf diff --git a/Ultra96/packages/wilc3000/pre.sh b/Ultra96/packages/wilc3000/pre.sh index 4b61693..76bdff4 100755 --- a/Ultra96/packages/wilc3000/pre.sh +++ b/Ultra96/packages/wilc3000/pre.sh @@ -1,14 +1,11 @@ -#!/bin/bash - -set -e -set -x +#! /bin/bash target=$1 script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +sudo cp $script_dir/wpa_ap.service $target/lib/systemd/system +sudo cp -r $script_dir/wpa_ap $target/usr/local/share/ sudo mkdir $target/wilc_bld sudo mkdir -p $target/lib/firmware/mchp sudo mkdir -p $target/lib/modules/4.14.0-xilinx-v2018.3/extra sudo cp $script_dir/wilc-sdio.ko $target/lib/modules/4.14.0-xilinx-v2018.3/extra/ -sudo cp $script_dir/ap_v2.sh $target/usr/local/share/wpa_ap/ - diff --git a/Ultra96/packages/wilc3000/qemu.sh b/Ultra96/packages/wilc3000/qemu.sh index 8cc9b04..7300b36 100755 --- a/Ultra96/packages/wilc3000/qemu.sh +++ b/Ultra96/packages/wilc3000/qemu.sh @@ -1,29 +1,49 @@ -#! /bin/bash +#!/bin/bash -set -x set -e - -cd /wilc_bld +set -x # Install firmware files on root filesystem +cd /wilc_bld git clone https://github.com/linux4wilc/firmware cd firmware git checkout tags/wilc_linux_15_2 cp /wilc_bld/firmware/wilc3000_wifi_firmware.bin /lib/firmware/mchp/ cp /wilc_bld/firmware/wilc3000_ble_firmware.bin /lib/firmware/mchp/ - cd / rm -rf wilc_bld -# Register wifi driver (depmod doesn't work here) -# depmod -a - # Start module on bootup echo "wilc-sdio" >> /etc/modules # Wilc cannot do wlan1 only wlan0 and p2p0, so fix that for host ap -echo "INTERFACES=\"usb0 p2p0\"" > /etc/default/isc-dhcp-server -cp /usr/local/share/wpa_ap/ap.sh /usr/local/share/wpa_ap/ap_v1.sh -cp /usr/local/share/wpa_ap/ap_v2.sh /usr/local/share/wpa_ap/ap.sh chmod a+x /usr/local/share/wpa_ap/ap.sh - +if [ -f /etc/default/isc-dhcp-server ] && \ + grep -q "INTERFACES=" /etc/default/isc-dhcp-server; then + if ! grep -q "p2p0" /etc/default/isc-dhcp-server; then + sed -i 's/\(INTERFACES=\)"\(.*\)"/\1"\2 p2p0"/g' \ + /etc/default/isc-dhcp-server + fi +else + echo 'INTERFACES="p2p0"' > /etc/default/isc-dhcp-server +fi + +cat - >> /etc/dhcp/dhcpd.conf < /etc/network/interfaces.d/wlan0 < wpa_ap_actual.conf ifconfig p2p0 down sleep 2 -wpa_supplicant -c ./wpa_ap_actual.conf --ip2p0 & +wpa_supplicant -c ./wpa_ap_actual.conf -ip2p0 & ifconfig p2p0 $ip diff --git a/Ultra96/packages/wilc3000/wpa_ap/wpa_ap.conf b/Ultra96/packages/wilc3000/wpa_ap/wpa_ap.conf new file mode 100644 index 0000000..9f2346d --- /dev/null +++ b/Ultra96/packages/wilc3000/wpa_ap/wpa_ap.conf @@ -0,0 +1,10 @@ +ctrl_interface=/var/run/wpa_supplicant +ctrl_interface_group=0 +update_config=1 + +network={ + ssid="pynq" + mode=2 + key_mgmt=NONE + frequency=2437 +} diff --git a/Ultra96/specs/Ultra96_v2.spec b/Ultra96/specs/Ultra96_v2.spec index 28b3523..2922639 100755 --- a/Ultra96/specs/Ultra96_v2.spec +++ b/Ultra96/specs/Ultra96_v2.spec @@ -1,4 +1,5 @@ ARCH_Ultra96 := aarch64 BSP_Ultra96 := sensors96b_v2.bsp -STAGE4_PACKAGES_Ultra96 := pynq mraa upm usbgadget wpa_ap usb-eth0 sensorconf wilc3000 +STAGE4_PACKAGES_Ultra96 := pynq mraa upm usbgadget usb-eth0 sensorconf +STAGE4_PACKAGES_Ultra96 += wilc3000