The kernel must stay at v5.x, anything v6 does not match some specific driver I need. For now, the distro is Debian 11 Bullseye, and that is a little older. For example, the latest Python from Bullseye repo is 3.9, and some scripts require 3.10, etc.
The question is, how good is the separation between the rest of a Linux distro and the kernel version? For how long an old kernel can remain unchanged, without runtime conflicts with the rest of a distro?
Due to the history of GPIO interfaces in the kernel, there are two different ways to obtain and use GPIOs:
- The descriptor-based interface is the preferred way to manipulate GPIOs, and is described by all the files in this directory excepted Legacy GPIO Interfaces.
- The legacy integer-based interface which is considered deprecated (but still usable for compatibility reasons) is documented in Legacy GPIO Interfaces.
The remainder of this document applies to the new descriptor-based interface. Legacy GPIO Interfaces contains the same information applied to the legacy integer-based interface.
They say the old style is still usable, but I've tried for my RPi and drivers that worked with kernel v5 do not work in v6. Some examples do not even compile, other examples compile but give runtime errors.
To make things even more confusing, while the old style of accessing gpio pins was already removed from v6, there is still in place a mocking interface with the old function names, but they do not work, the mocking old style function names are there only to emit compilation warnings.
I haven't followed really what exactly you need to do with the GPIOs and other constraints, but to me, adapting to the new GPIO control interface would be time much better invested. It's also much faster.
I haven't followed really what exactly you need to do with the GPIOs and other constraints, but to me, adapting to the new GPIO control interface would be time much better invested. It's also much faster.
I can boot a recent Arch installation with Linux v5.10-LTS.
pi@rpi:~/workshop/code/10_spi_bmp280 $ make
make -C /lib/modules/5.15.84+/build M=/home/pi/workshop/code/10_spi_bmp280 modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.84+'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110
You are using: gcc (Raspbian 12.2.0-14+rpi1) 12.2.0
CC [M] /home/pi/workshop/code/10_spi_bmp280/spi_bmp280.o
MODPOST /home/pi/workshop/code/10_spi_bmp280/Module.symvers
CC [M] /home/pi/workshop/code/10_spi_bmp280/spi_bmp280.mod.o
LD [M] /home/pi/workshop/code/10_spi_bmp280/spi_bmp280.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.15.84+'
pi@rpi:~/workshop/code/10_spi_bmp280 $
$ grep 'the compiler differs from the one used to build the kernel' -r *
Makefile: echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
$ git blame Makefile |grep 'the compiler differs from the one used to build the kernel'
6072b2c49d23e (Masahiro Yamada 2021-08-01 11:53:46 +0900 1793) echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
$ git show 6072b2c49d23e
commit 6072b2c49d23eb69b6dca06ad095d3a9633b2b80
Author: Masahiro Yamada <masahiroy@kernel.org>
Date: Sun Aug 1 11:53:46 2021 +0900
kbuild: warn if a different compiler is used for external module builds
It is always safe to use the same compiler for the kernel and external
modules, but in reality, some distributions such as Fedora release a
different version of GCC from the one used for building the kernel.
There was a long discussion about mixing different compilers [1].
I do not repeat it here, but at least, showing a heads up in that
case is better than nothing.
Linus suggested [2]:
And a warning might be more palatable even if different compiler
version work fine together. Just a heads up on "it looks like you
might be mixing compiler versions" is a valid note, and isn't
necessarily wrong. Even when they work well together, maybe you want
to have people at least _aware_ of it.
This commit shows a warning unless the compiler is exactly the same.
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
You are using: gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)
Check the difference, and if it is OK with you, please proceed at your
risk.
To avoid the locale issue as in commit bcbcf50f5218 ("kbuild: fix
ld-version.sh to not be affected by locale"), pass LC_ALL=C to
"$(CC) --version".
[1] https://lore.kernel.org/linux-hardening/efe6b039a544da8215d5e54aa7c4b6d1986fc2b0.1611607264.git.jpoimboe@redhat.com/
[2] https://lore.kernel.org/lkml/CAHk-=wgjwhDy-y4mQh34L+2aF=n6BjzHdqAW2=8wri5x7O04pA@mail.gmail.com/