Build mainline driver for another Kernel Version

Lucas Tanure tanure at linux.com
Wed May 17 04:47:21 EDT 2023


On Wed, May 17, 2023 at 9:22 AM Greg KH <greg at kroah.com> wrote:
>
> On Wed, May 17, 2023 at 09:16:45AM +0100, Lucas Tanure wrote:
> > Hi,
> >
> > Can I build a driver in the mainline kernel to a previous kernel version?
>
> Not easily, and you really do not want to do that as the whole kernel
> source, drivers included, are a snapshot in time and depend on each
> other.
>
> > Like, in the mainline kernel, I have a Z driver, and I want to use
> > that driver for my current stable driver in my embedded system with
> > version kernel 5.15. Is there a procedure to build a kernel driver
> > against other specific kernel headers?
>
> Update to a newer kernel version, it will be much easier and simpler
> overall.
>
> Drivers consume _everything_ from the core kernel, and are not
> stand-alone at all.  They depend on everything else, trying to pick one
> out and put it into a different kernel is not how Linux works at all,
> sorry.
>
> What prevents you from just using a newer kernel?
>
> thanks,
>
> greg k-h

It's not me or my team; it's every client for the company I work for
that uses different kernel versions.
And I am investigating how we can upstream our driver in the future
and provide our driver to all customers having to support many
different kernel versions.

I think the only way is to have a few kernel branches with different
kernel versions, but our driver is updated in those branches.
Any better idea?

Thanks!
Lucas



More information about the Kernelnewbies mailing list