diff --git a/board/raspberrypi/device_table.txt b/board/raspberrypi/device_table.txt index 348d4b6..dc6ecc5 100644 --- a/board/raspberrypi/device_table.txt +++ b/board/raspberrypi/device_table.txt @@ -6,4 +6,7 @@ /etc/ssh/ssh_host_rsa_key f 600 0 0 - - - - - #rtl8821cu usb modeswitch script -/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - - \ No newline at end of file +/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - - + +# WLAN setup +/lib/mdev/wlan_setup.sh f 755 0 0 - - - - - \ No newline at end of file diff --git a/board/raspberrypi/post-build.sh b/board/raspberrypi/post-build.sh index a8eb8e6..fdc260b 100755 --- a/board/raspberrypi/post-build.sh +++ b/board/raspberrypi/post-build.sh @@ -21,3 +21,17 @@ # Add usb_modeswitch mdev rule grep -q "usb_modeswitch" "$TARGET_DIR/etc/mdev.conf" || \ echo '$PRODUCT=bda/1a2b.* root:root 0660 */lib/mdev/rtl8821cu_usb_modeswitch.sh' >> "$TARGET_DIR/etc/mdev.conf" + +# Add wlan_setup mdev rule +grep -q "wlan_setup" "$TARGET_DIR/etc/mdev.conf" || \ + echo '$PRODUCT=bda/c820.* root:root 0660 */lib/mdev/wlan_setup.sh' >> "$TARGET_DIR/etc/mdev.conf" + +# Add wlan0 configuration +grep -q "iface wlan0" "$TARGET_DIR/etc/network/interfaces" || \ + cat >> "$TARGET_DIR/etc/network/interfaces" << 'EOF' + +auto wlan0 +iface wlan0 inet dhcp + pre-up ip link set wlan0 up + pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf +EOF \ No newline at end of file diff --git a/board/raspberrypi/rootfs-overlay/etc/wpa_supplicant.conf b/board/raspberrypi/rootfs-overlay/etc/wpa_supplicant.conf new file mode 100644 index 0000000..250341a --- /dev/null +++ b/board/raspberrypi/rootfs-overlay/etc/wpa_supplicant.conf @@ -0,0 +1,4 @@ +network={ + ssid="Gabriel_2G" + psk="gabrielwifi" +} \ No newline at end of file diff --git a/board/raspberrypi/rootfs-overlay/lib/mdev/wlan_setup.sh b/board/raspberrypi/rootfs-overlay/lib/mdev/wlan_setup.sh new file mode 100644 index 0000000..4cffb64 --- /dev/null +++ b/board/raspberrypi/rootfs-overlay/lib/mdev/wlan_setup.sh @@ -0,0 +1,13 @@ +#!/bin/sh +case "$ACTION" in + add) + [ -e /sys/class/net/wlan0 ] || exit 0 + ifdown wlan0 2>/dev/null + killall wpa_supplicant 2>/dev/null + ifup wlan0 + ;; + remove) + ifdown wlan0 2>/dev/null + killall wpa_supplicant 2>/dev/null + ;; +esac \ No newline at end of file