Install wifi driver on kernel-update

Hi,

I have a wifi dongle with the rtl8188fu driver which is not installed by default.
To get the driver I’m using this script to install the driver:
http://downloads.fars-robotics.net/wifi-drivers/install-wifi

Of course after an update of the pi kernel the driver is not working.

The script has an option to check for the latest available kernel version when running rpi-update. So this script could be added to /etc/kernel/postinst.d to install the driver,

Now it doesn’t look diepi-update will give the same kernel version as the check does from here:
https://github.com/Hexxeh/rpi-firmware

Example:
latest verion of dietpi v7.0.2
Current kernel 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux
no newer kernel is available via apt update.

Running the wifi-install script with -u options give me this
Running command ‘sudo rpi-update’ will load:

kernel revision = 5.10.23-v7+
kernel build = #1406

Doesn’t seem to lineup with dietpi.
Any suggestions or ideas maybe, much appreciated ?


\

echo -n "Please wait ... checking the kernel revision and build you will have after running command 'sudo rpi-update"
if [[ $kernelcommit != "rpi-update" ]] ; then
echo " $kernelcommit'."
else
echo "'."
fi

# download uname string if it exists
if ! (wget -q https://github.com/Hexxeh/rpi-firmware/raw/$rpi_firmware_commit_id/$uname -O .uname_string) ; then

# download the relevant kernel image if uname_string doesn't exist
if ! (wget -q https://github.com/Hexxeh/rpi-firmware/raw/$rpi_firmware_commit_id/$image -O .kernel) ; then
echo "Invalid commit-id, kernel not available for your version of the Pi, Pi $pi."
exit 1
fi

# extract uname_string from kernel image

strings -n 10 .kernel | grep "Linux version" > .uname_string

Hi,

DietPi is not providing own kernel. They are used from the underlying base image. In your case it seems your are running a Raspberry Pi. Means you have a Raspberry Pi OS. Their the normal RPi OS kernel is used

Actual stable version of RPi OS kernel is 5.10.17

5.10.23 is a development kernel version and available via rpi-upate only. It is not recommended to run development kernel if it doesn’t fix a specific issue.

“It is not recommended to run development kernel if it doesn’t fix a specific issue.”

Definitely agree with that. Any other better way of doing this ?
I’m running my Pi as a Edge Device with mainly running applications on docker, I would like to auto-update the pi on a monthly cron-schedule, but because a new kernel will break the wifi-driver I can’t do this atm.

I had a look to the driver update script and it seems it can be called with an option blank.

[option]:- 	  blank - update/install driver for currently running kernel"

Not sure what it mean exactly but it seems it will not invoke bleeding edge RPi kernel and you could stay with current stable kernel. ? Maybe you would need to play with the options or check with the developer of this scripts how to avoid using rpi-update

Yes, the script will update/install wifi driver for the current loaded version of the kernel, not the one just installed on a kernel update.
I have used it to install the wifi driver when connect via LAN to the internet.

If there is a kernel update, and you install a new kernel, uname -a still shows you the old active kernel, not the one just installed. It will get active after the reboot. If that happens I don’t have access to the internet anymore, so the driver update needs to happen together with the kernel update, and after a reboot they will both be active.

Scripts in /etc/kernel/postinst.d will get the newly installed kernel version as first argument, so the script could be adjusted to make use of this.

aaah! Thanks will give it a try.