1

I have a simple "hello world" Linux kernel module that I would like to compile for a different host. My host is on a 5.x kernel version and the target is on 4.x.

I do not want to update the kernel versions. This is a virtualized lab environment for testing purposes.

When the target kernel version's headers are in the repos, this is a straightforward task. All it usually takes is an apt install linux-headers-$(uname -r) or similar, followed by make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules. It doesn't seem so easy otherwise.

Even when attempting to download header packages manually from the Debian archive I'm met with dependency issues with older binaries that I do not want to overwrite my up-to-date binaries with. I have even tried to compile against the full Linux kernel source and have similar issues.

I have no experience building kernel modules except for simple ones using my own kernel's headers. Any help?

1 Answer 1

-1

You may need to adjust your environment variables to point to the version you downloaded with "full Linux kernel source"

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 17, 2022 at 7:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .