It's common practice to deliver Linux kernel drivers (kernel objects KOs) in the source code, and build and install them on the target computer. For example Nvidia display drivers, Oracle VirtualBox guest add-on drivers are installed this way. It is also common to receive new version of kernel (with appropriate headers) through system update. This requires the KO to be re-built and re-installed, otherwise the device will stop working after update.
In our product installation startup script we want to add the step to make and install the KO on every boot. User may choose to opt-out, and would have to build and install the KO manually. The device driver communicates with a USB device. Pertinent Details: 1. The Actual re-build will happen only once when the new kernel is installed, because make will not try to re-build the file that is already there and up-to date. 2. It takes about 2 seconds to rebuild the driver, and milliseconds to skip the build during the normal boot (not after kernel update) 3. In the unlikely event that build will fail, it should not crash the system or make it unstable, however our hardware device will not work. 4. Some distributions may allow to register hooks, to do actions on certain events, like kernel update. However, we are trying to implement something that will work on the most of the distributions in the uniform way. Our installer is script+tar or script+rpm. Unfortunately for this release we do not have bandwidth to prepare native packages for all the distributions (for example debian style).
Questions: 1. Is this an acceptable solution? If not, why? 2. What are the potential risks associated with this approach? 3. What the correct/preferred place to run make during startup? rc.local or script under init.d or other? The goal is to make it work on the most of the distributions using the same method (if at all possible).