1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #2472 from jvonau/firmware

RFC Firmware downgrading [WiFi hotspot capacity workaround, for Raspberry Pi]
This commit is contained in:
A Holt 2020-08-06 12:14:47 -04:00 committed by GitHub
commit 8d3b2f6ff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 131 additions and 4 deletions

View file

@ -0,0 +1,26 @@
# check the timestamps, might want to preserve the old ones
- name: Backup OS provided Firmware
copy:
src: "/lib/firmware/brcm/{{ item }}"
dest: "/lib/firmware/brcm/{{ item }}.orig"
with_items:
- brcmfmac43430-sdio.bin
- brcmfmac43455-sdio.bin
- brcmfmac43455-sdio.clm_blob
# grab the old firmware
- name: Retrieve older firmware
get_url:
url: "{{ item.url }}"
dest: "{{ item.dest }}"
with_items:
- { url: 'http://d.iiab.io/packages/brcmfmac43430-sdio.clm_blob_2018-09-11_7.45.98.65', dest: '/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab' }
- { url: 'http://d.iiab.io/packages/brcmfmac43430-sdio.bin_2018-09-11_7.45.98.65', dest: '/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab' }
- { url: 'http://d.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1', dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab' }
- { url: 'http://d.iiab.io/packages/brcmfmac43455-sdio.clm_blob_2018-02-26_rpi', dest: '/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.iiab' }
- name: "Add 'firmware_retrieved: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^RPi_firmware_retrieved'
line: 'RPi_firmware_retrieved: True'

View file

@ -0,0 +1,20 @@
- name: Include older RPi Firmware
include_tasks: install.yml
when: RPi_firmware_retrieved is undefined
- name: Install check-firmware service files
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
with_items:
- { src: 'fw_warn.sh', dest: '/etc/profile.d/', mode: '0644' }
- { src: 'check-firmware.service', dest: '/etc/systemd/system/', mode: '0644' }
- { src: 'check-firmware.sh', dest: '/usr/sbin/', mode: '0755' }
- name: Enable and Start check-firmware.service
systemd:
name: check-firmware.service
daemon_reload: yes
state: restarted
enabled: yes

View file

@ -0,0 +1,11 @@
[Unit]
Description=Check Firmware service
Before=clone-wifi.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/check-firmware.sh
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,47 @@
#!/bin/bash
FW_MODE=$(grep wifi_hotspot_capacity_rpi_fix /etc/iiab/local_vars.yml| grep True)
WARN=0
DATE=$(date +%F-%T)
if [ -z "$FW_MODE" ]; then
echo "FW marker not found"
else
echo "$FW_MODE"
if ! $(diff -q /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin); then
mv /lib/firmware/brcm/brcmfmac43455-sdio.bin /lib/firmware/brcm/brcmfmac43455-sdio.bin.$DATE
cp /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin
echo "replacing firmware"
WARN=1
fi
if ! $(diff -q /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob); then
mv /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.$DATE
cp /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob
echo "replacing firmware"
WARN=1
fi
if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin); then
mv /lib/firmware/brcm/brcmfmac43430-sdio.bin /lib/firmware/brcm/brcmfmac43430-sdio.bin.$DATE
cp /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin
cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob
echo "replacing firmware"
WARN=1
fi
if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob); then
mv /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.$DATE
cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob
echo "replacing firmware"
WARN=1
fi
fi
if [ "$WARN" = "1" ]; then
echo -e " \033[31;5mFirmware has been replaced\033[0m"
echo -e " \033[31;5mReboot is required to activate\033[0m"
touch /.fw_replaced
#echo "rebooting..."
#reboot
else
echo -e " Firmware check \033[32;5mPASSED\033[0m"
if [ -f /.fw_replaced ]; then
rm /.fw_replaced
fi
fi
exit 0

View file

@ -0,0 +1,6 @@
#!/bin/bash
if [ -f /.fw_replaced ]; then
echo -e " \033[31;5mFirmware has been replaced\033[0m"
echo -e " \033[31;5mReboot is required to activate\033[0m"
fi

View file

@ -1,3 +1,8 @@
- name: Select RPi firmware mode
include_role:
name: firmware
when: rpi_model != "none"
- name: detected_network - name: detected_network
include_tasks: detected_network.yml include_tasks: detected_network.yml

View file

@ -95,7 +95,10 @@ hostapd_secure: False
hostapd_password: changeme hostapd_password: changeme
hostapd_install: True # 2020-01-21: this var MIGHT be implemented in future. hostapd_install: True # 2020-01-21: this var MIGHT be implemented in future.
hostapd_enabled: True hostapd_enabled: True
wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal
# WiFi hotspots to service 30-to-32 client devices. Background explanation:
# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472.
wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi
# (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot).
# You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet.

View file

@ -46,7 +46,10 @@ host_wifi_mode: g
host_channel: 6 host_channel: 6
hostapd_secure: False hostapd_secure: False
hostapd_password: changeme hostapd_password: changeme
wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal
# WiFi hotspots to service 30-to-32 client devices. Background explanation:
# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472.
wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi
# (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot).
# You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet.

View file

@ -46,7 +46,10 @@ host_wifi_mode: g
host_channel: 6 host_channel: 6
hostapd_secure: False hostapd_secure: False
hostapd_password: changeme hostapd_password: changeme
wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal
# WiFi hotspots to service 30-to-32 client devices. Background explanation:
# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472.
wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi
# (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot).
# You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet.

View file

@ -46,7 +46,10 @@ host_wifi_mode: g
host_channel: 6 host_channel: 6
hostapd_secure: False hostapd_secure: False
hostapd_password: changeme hostapd_password: changeme
wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal
# WiFi hotspots to service 30-to-32 client devices. Background explanation:
# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472.
wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi
# (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot).
# You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet.