开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

HOWTO: Patch the kernel for the AX.25 fix


 
Edited

#### 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

For the 64-bit kernel:

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


 

Nice you got it working nice write up on it. I haven’t yet run into the issue will tinker on a test system



Here is a link to the patch summary.

kelly


 

It would be cool to get it committed to the Raspberry Pi kernel and pushed as an update.? I don't have the time to mess with it today as I am leaving town.? I was looking at the Pi's website, and it does not look that difficult.? Basically, request a pull, and apply the patches, and submit that pull.? Then I would imagine you would see the result in an update.

73 de Chris KQ6UP


 

I submitted this as a bug report on the RPi kernel GIT repository regarding this.? I think having to go back and repatch this every time will get tedious.? Hopefully they will fix it.

Regards,
Chris KQ6UP


 

Ok I had a response to my bug post, and the fix has now been backported to the 5.15 source tree, so it should be there the next binary kernel update which may be a couple of months from now unless we get lucky.? The only thing that has to be done above is download the source and compile the kernel.? The fix is applied to the current tree for 5.15 now.? So again just download the source and follow the steps for compiling and installing the the kernel that are posted above **skipping the patch steps**.

-Chris KQ6UP


 

I built the mainline 5.15 kernel code that contains the AX25 patch for my HamIQ Quadra system today. I tested it with ardopc. Sadly, it didn't seem to help with the ardopc issue or, if it helped at all, it wasn't enough to make at all reliable connections to a Winlink RMS. I still needed to use the --leaderlength adjustment and dsnoop/dmix .asoundrc file to get the patched kernel to work with ardopc.

I don't know about the pat problem with AX25 packet. I don't have any 2m packet radio close enough to my QTH to really test it.

73,
Cal (AD8Q)


Mike Lussier - AE4ML
 

Chris,?
Everything in the kernel rebuild under step #3 is missing. all the files don't exist.?

3. Apply the patches here found here:


 

If you sync to the latest 5.15 source, they are already applied. ?The next binary update will have the back port. ?So the patches are not really relevant unless you need to go back to 5.10 to solve the ARDOP problem. ?If that is the case, I can post them here. ?Your link seems to be a dead end too.

-Chris KQ6UP


 

Here is the link that works for anyone else wanting to back port their own kernel (be advised the current tree at the git repository already has them applied).

-Chris KQ6UP