Installing a driver on balenaOS

Hi,

We need to replace the rtl8188eu driver due to a problem with the original driver supplied with balena (it does not allow setting regdomain/country).

We already compiled and tested the replacement driver.

What would be the best way to ‘install’ the new driver?
On a newly created image?
On an existing image (already at customer site)?
Is there a way to ensure the driver will be maintained if/when we do an OS upgrade? (I assume it will be kept with regular app/container upgrades)

Thank you :wink:

I would appreciate any help on this. Thank you.

Hi,

I haven’t tried it yet myself, but there is this post from a while back that suggests adding it from your own container.

I would expect your fix would look something like:

  1. Add module (ex. /usr/src/rtl8188eu.ko) and labels to your container;
  2. On start up:
    2.a. Unload the old driver: modprobe --remove rtl8188eu;
    2.b. Load the new driver: insmod /usr/src/rtl8188eu.ko;
  3. Enjoy your wifi.

If this works, you can roll it out to the existing devices simply by updating them normally.
Of course, this assumes you have some connection other than your broken wifi.

I’m not sure how this would work with HostOS updates, you might need specific builds of your module for the different versions.

If you’re building your own OS image, you might be able to patch it with a .bbappend file, but updating custom OS images isn’t really supported at the moment I think.

1 Like

Hi TJvV,

I assume the change needs to be on Host OS and cannot be made inside a container.

Also, what would be your recommendation as to how to automatically replace driver on startup? use /etc/init.d script? something else?

Thank you :wink:

Hi @n42,

The post I linked in my previous answer suggests it can be done from container.

I would run the driver update in your CMD script.
For example if your Dockerfile is something like

FROM balenalib/raspberrypi3

RUN mkdir -p /usr/src
COPY rtl8188eu.ko /usr/src
COPY run.sh /usr/src
COPY actual_script.sh /usr/src

CMD ["/bin/bash", "/usr/src/run.sh"]

Then run.sh would look something like:

#!/bin/sh
modprobe --remove rtl8188eu
insmod /usr/src/rtl8188eu.ko

/usr/src/actual_script.sh

Where actual_script.sh is whatever you would normally run in the container.

I’m quite busy at the moment, but might have some time to test things over the weekend.

1 Like