1

I have a scenario where I need to recompile my display drivers after kernel updates. I'm trying to shome how automate it with bash scripts during boot time. so I need some sort of a way to know that my kernel changed and reinstalled my drivers with the new running kernel.

I was thinking of when first installing my drivers output the kernel version to a file and in my script always checking if this file content is different than what is now installed.

is this the right way? I would appreciate any suggestion on how to know if the kernel changed since I last installed my drivers.

  • I know there is DKMS and that is exactly what is for but not always it's working so I want to this this in a different way.
  • What distribution are you running? On my PC I know that kernel has changed, because I've just compiled it. – MatthewRock Dec 15 '15 at 10:51
  • 1
    How is DKMS failing for you? That really is the safest approach for this kind of problem... – Stephen Kitt Dec 15 '15 at 10:51
  • i'm managing a lot of distributions ( SLES RHEL UBUNTU DEBIAN) so on each OS DKMS might not work out of the box. the changes happen when cron task is running full OS updates and reboot the os. – Asaf Magen Dec 15 '15 at 10:54
0

you can simply run uname -mrs to see if the version has been changed, but you can also dpkg --list | grep linux-image to check the list of all installed kernels.

0

automate it with bash scripts during boot time

automate...yes, but not during boot time? After a kernel update you have to reboot. And before, shutdown. So you should know when it happens. Or am I missing something. Have that script ready to make that switch (compilation) with one command, but not while a new kernel is booting for the first time.

Just like modules have to be taken care of (by make direct, by the distro from where you get also a new initrd ), if you have something as kernel version specific as your drivers, this belongs on a checklist and not in a bootscript. Otherwise too much risk of n.a.i.w. (= not always it works :-)

uname -r was mentioned...but to store that in a file and check it?

The place to put information and to do the kernelversion - driver control could be a boot script. Over the months it could look like

# 4.1.0 dispdr=firstone
# 4.2.0 dispdr=second_driver
# 4.4.0  
dispdr=third 
# next version probably 4.6.0

This is transparent and reversible. I know nothing about these drivers, obviously.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.