#### EDIT #### PATCHING IS NO LONGER REQUIRED #####
However, until the next binary kernel release of 5.15.*, the syncing source and building of the kernel still apply. ?The latches linked to bellow have already been applied to the
current tree in the GIT repository linked below.
As far as I can tell this gets the kernel up to the latest patch level for the AX.25 code in the kernel.? This is only necessary if you are using pat with the native Linux AX.25 (kissattach).
1. Back up your stuff:
2. Get the kernel source:
sudo apt install git bc bison flex libssl-dev make
git clone --depth=1
3. Apply the patches here found here:
This is done by cutting and pasting the deltas from the original tree into a text file with a name of your choice.
The deltas look like this:
@@ -228,6 +228,7 @@ typedef struct ax25_dev {
ax25_dama_info dama;
#endif
refcount_t refcount;
+ bool device_up;
} ax25_dev;
typedef struct ax25_cb {
Say you named your text file ax25.h.patch then apply like:
patch ax25.h ax25.h.patch?
You may want to make a copy of the original pre patched file in case something goes awry.
There are four patches and the 2nd one needs a larger fuzz factor for it not to fail, so apply it with a fuzz of 3 like this:
patch -F 3 af_ax25.c af_ax25.c.patch
You will need to descend into the source tree directories to find them, but their locations are under the folders "a" and "b" on the patch authors original post.
I put my source in /usr/src so that the tree becomes /usr/src/linux
4. Apply the default configuration.? This tells the compiler to setup the kernel the way it was before (except it won't be in a deb package).? Choose the one that is appropriate for your architecture, so you need to make sure you are running 32 or 64 bit system or it won't work.
I am going to paste the relevant sections from this website:
Apply the Default Configuration
First, prepare the default configuration by running the following commands, depending on your Raspberry Pi model:
For Raspberry Pi 1, Zero and Zero W, and Raspberry Pi Compute Module 1 default (32-bit only) build configuration
cd linux
KERNEL=kernel
make bcmrpi_defconfig
For Raspberry Pi 2, 3, 3+ and Zero 2 W, and Raspberry Pi Compute Modules 3 and 3+ default 32-bit build configuration
cd linux
KERNEL=kernel7
make bcm2709_defconfig
For Raspberry Pi 4 and 400, and Raspberry Pi Compute Module 4 default 32-bit build configuration
cd linux
KERNEL=kernel7l
make bcm2711_defconfig
For Raspberry Pi 3, 3+, 4, 400 and Zero 2 W, and Raspberry Pi Compute Modules 3, 3+ and 4 default 64-bit build configuration
cd linux
KERNEL=kernel8
make bcm2711_defconfig
5. Rename your custom kernel (from the pi page):
Customising the Kernel Version Using?LOCALVERSION
In addition to your kernel configuration changes, you may wish to adjust the?LOCALVERSION
?to ensure your new kernel does not receive the same version string as the upstream kernel. This both clarifies you are running your own kernel in the output of?uname
?and ensures existing modules in?/lib/modules
?are not overwritten.
To do so, change the following line in?.config
:
CONFIG_LOCALVERSION="-v7l-MY_FIXED_AX25"
You can also change that setting graphically as shown in?. It is located in "General setup" => "Local version - append to kernel release".
6. Compile and install (also from the RP page):
Building the Kernel
Build and install the kernel, modules, and Device Tree blobs; this step can take a?long?time depending on the Raspberry Pi model in use. For the 32-bit kernel:
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
make -j4 Image.gz modules dtbs
sudo make modules_install
sudo cp arch/arm64/boot/dts/broadcom/*.dtb /boot/
sudo cp arch/arm64/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm64/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm64/boot/Image.gz /boot/$KERNEL.img
NOTE
|
On a Raspberry Pi 2/3/4, the?-j4 ?flag splits the work between all four cores, speeding up compilation significantly. |
If you now reboot, your Raspberry Pi should be running your freshly-compiled kernel!
Maybe someone could make deb packages that install the patched and compiled binary modules, or possibly even include in the build-a-pi script.? That would make it a lot easier.? I think I have messed with it as much as I am going to.
73 de Chris KQ6UP