Skip to content

Instantly share code, notes, and snippets.

@marcsello
Created April 23, 2021 20:23
Show Gist options
  • Save marcsello/3622b9669151e0dc28d7f4e18a44615d to your computer and use it in GitHub Desktop.
Save marcsello/3622b9669151e0dc28d7f4e18a44615d to your computer and use it in GitHub Desktop.
Firmware loader for the Gen1 WD MyCloud network interface when there is no udev available
#!/bin/ash
# Written for Alpine 3.13 userland
# The sleep stuff isn't necessary... it's just there to stand as safe guards
echo "Start loading of PFE kernel module"
modprobe pfe lro_mode=1 tx_qos=1 alloc_on_init=1 disable_wifi_offload=1 &
WAITPID=$!
sleep 1
while test -d /sys/devices/platform/pfe.0/firmware; do
source /sys/devices/platform/pfe.0/firmware/pfe.0/uevent
echo "Loading $FIRMWARE"
echo 1 > /sys/devices/platform/pfe.0/firmware/pfe.0/loading
cat "/lib/firmware/$FIRMWARE" > /sys/devices/platform/pfe.0/firmware/pfe.0/data
echo 0 > /sys/devices/platform/pfe.0/firmware/pfe.0/loading
sleep 2
done
wait $WAITPID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment