Kernel compilation errors after patching Raspberry Pi OS kernel

@ajudge I want to verify I’m doing all of this correctly.

I’m running in to an error on the initial kernel compile after cherry-picking commits. I’ll admit this is at the edge of my understanding and have previously done custom raspberrypi kernel compiling but only with enabling a few other features from within the .config file. I wish I could post a more specific error but the make just ends with an error occured with the Makefile. Do all these steps seem correct?

Steps I performed:

  1. cd ~
    git clone --branch stable_20250428 https://github.com/raspberrypi/linux
    cd linux
    
  2. git remote add morse https://github.com/MorseMicro/rpi-linux.git # from within ~/linux
    git fetch morse # from within ~/linux
    
  3. Looked at MorseMicro repo and saw you were 14 commits ahead the main linux repo so I started cherry-picking.

    1. git cherry-pick a58e45bf88ee4c1eb540cffac23f141112631b76
      
    2. git cherry-pick 8db61ec7a55c5b2651e02f41ad3e72c852e1b860
      
    3. git cherry-pick 8cdeb90f9b06e6ebe521e5379efc38a492292b83
      
    4. git cherry-pick 310b08f58d3514a0b8c1704c1727b915a8fc9d16
      
    5. git cherry-pick 6f0fca77d0bf5be0ad3bbdda35560fe840f01e9c
      
    6. git cherry-pick 485d6678b5d1e0dc5b8232e96164f285891cfd8c
      
    7. git cherry-pick 000a77f5066813a8be18d39d414dfa59d97e7a01
      
    8. git cherry-pick e89a4f1d00ad3f4527dae4700010a1ff89a09b42 # resolved conflict on 2 files
      
      1. You are currently cherry-picking commit e89a4f1d00ad.
          (fix conflicts and run "git cherry-pick --continue")
          (use "git cherry-pick --skip" to skip this patch)
          (use "git cherry-pick --abort" to cancel the cherry-pick operation)
        
        Changes to be committed:
                modified:   include/linux/ieee80211.h
                modified:   net/mac80211/agg-rx.c
                modified:   net/mac80211/agg-tx.c
                modified:   net/mac80211/ht.c
                modified:   net/mac80211/ieee80211_i.h
                modified:   net/mac80211/iface.c
                modified:   net/mac80211/rx.c
                modified:   net/mac80211/sta_info.h
        
        Unmerged paths:
          (use "git add <file>..." to mark resolution)
                both modified:   include/net/mac80211.h
                both modified:   net/mac80211/debugfs.c
        
    9. git cherry-pick af1d42caa061f834255784e4bec2ed6af3ff9301
      
    10. git cherry-pick 9dcdb90f3069748544a9fd3b3bc7d5120c8a3e19
      
    11. git cherry-pick 836aa308560cf2dcacca0c8d862b57c8f2f2cdd5
      
    12. git cherry-pick 2ed640414ee93a0799168e65b28bc32be024c9cd
      
    13. git cherry-pick 87bb8f092477b11b5b9017f440f946be0381dade
      
    14. git cherry-pick f746aa8a795b1330f4664b9c46d558a614b7114d # resolved conflict on 1 file
      
      1. You are currently cherry-picking commit f746aa8a795b.
          (fix conflicts and run "git cherry-pick --continue")
          (use "git cherry-pick --skip" to skip this patch)
          (use "git cherry-pick --abort" to cancel the cherry-pick operation)
        
        Changes to be committed:
                modified:   net/mac80211/mesh.h
                modified:   net/mac80211/mesh_pathtbl.c
                modified:   net/mac80211/rx.c
                modified:   net/wireless/mesh.c
        
        Unmerged paths:
          (use "git add <file>..." to mark resolution)
                both modified:   net/mac80211/mesh_hwmp.c
        
  4. Compile

    1. make bcm2712_defconfig
      sed -r -i 's/CONFIG_LOCALVERSION=\"(.*)\"/CONFIG_LOCALVERSION=\"\1-morse\"/g' .config
      make -j6 Image.gz modules dtbs
      
In file included from net/mac80211/mlme.c:25:
net/mac80211/mlme.c: In function ‘ieee80211_determine_ap_chan’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:177:13: note: in expansion of macro ‘ieee80211_hw_check’
  177 |         if (ieee80211_hw_check(&sdata->local->hw, STRICT))
      |             ^~~~~~~~~~~~~~~~~~
./include/net/mac80211.h:3075:65: note: each undeclared identifier is reported only once for each function it appears in
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:177:13: note: in expansion of macro ‘ieee80211_hw_check’
  177 |         if (ieee80211_hw_check(&sdata->local->hw, STRICT))
      |             ^~~~~~~~~~~~~~~~~~
net/mac80211/mlme.c: In function ‘ieee80211_verify_peer_he_mcs_support’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:399:14: note: in expansion of macro ‘ieee80211_hw_check’
  399 |         if (!ieee80211_hw_check(&sdata->local->hw, STRICT) && !ap_min_req_set)
      |              ^~~~~~~~~~~~~~~~~~
net/mac80211/mlme.c: In function ‘ieee80211_verify_sta_he_mcs_support’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:459:14: note: in expansion of macro ‘ieee80211_hw_check’
  459 |         if (!ieee80211_hw_check(&sdata->local->hw, STRICT) && !ap_min_req_set)
      |              ^~~~~~~~~~~~~~~~~~
net/mac80211/mlme.c: In function ‘ieee80211_add_vht_ie’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:1226:14: note: in expansion of macro ‘ieee80211_hw_check’
 1226 |         if (!ieee80211_hw_check(&local->hw, STRICT)) {
      |              ^~~~~~~~~~~~~~~~~~
net/mac80211/mlme.c: In function ‘ieee80211_assoc_add_rates’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:1285:14: note: in expansion of macro ‘ieee80211_hw_check’
 1285 |             !ieee80211_hw_check(&local->hw, STRICT)) {
      |              ^~~~~~~~~~~~~~~~~~
net/mac80211/mlme.c: In function ‘ieee80211_send_assoc’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:1944:14: note: in expansion of macro ‘ieee80211_hw_check’
 1944 |             !ieee80211_hw_check(&local->hw, STRICT))
      |              ^~~~~~~~~~~~~~~~~~
net/mac80211/mlme.c: In function ‘ieee80211_assoc_config_link’:
./include/net/mac80211.h:3075:65: error: ‘IEEE80211_HW_STRICT’ undeclared (first use in this function)
 3075 | #define ieee80211_hw_check(hw, flg)     _ieee80211_hw_check(hw, IEEE80211_HW_##flg)
      |                                                                 ^~~~~~~~~~~~~
net/mac80211/mlme.c:4729:14: note: in expansion of macro ‘ieee80211_hw_check’
 4729 |         if (!ieee80211_hw_check(&local->hw, STRICT) && !is_6ghz &&

Okay I see these errors.

Hi @castironclay

Your steps look correct. Not sure why you’re hitting a compilation failure in mac80211 :thinking:.

I might split this discussion out shortly to help you debug!

1 Like

Much appreciated and I fully expect I’ve made an error along the way. You’ve demonstrated with multiple guides that this set of hardware should work just fine.

make_log.txt (132.2 KB)

Attached the output. Not sure if this helps or not @ajudge

Hi @castironclay

I’ve moved all the messages from that thread into this new thread to help you debug.

Can you share your versions of the patches
mac80211: add halow specific mesh optimizations and
mac80211: implement support for thin LMAC S1G NDP block acknowledgements
after resolving the conflicts.

What I believe has happened, is in applying the NDP block acknowledgement support, the patch has failed on adding the line IEEE80211_HW_SUPPORTS_NDP_BLOCKACK to mac80211.h because the newer kernel version added IEEE80211_HW_STRICT which changed the context lines. Because we don’t own that flag, we probably shouldn’t remove it.

When I’m back in the office on Monday, I’ll upload the versions of the patches I had resolved to that build thread so others can see how the patches were resolved.

I understand dealing with patches is difficult :frowning: , it’s an unfortunate necessity until we have a feature complete driver in the kernel - which will take some time.

Thanks @ajudge . Below are the details I think you’re looking for. These patches were all applied using the command git cherry-pick a58e45bf88ee4c1eb540cffac23f141112631b76..morse/mm/rpi-6.12.21/1.16.x

commit f250a71823d5d9409892edf8e3324b8e7178d5ed (HEAD)
Author: Pradeep Reddy <pradeep.reddy@morsemicro.com>
Date:   Sat Jun 21 03:14:25 2025 +1000

    mac80211: add halow specific mesh optimizations

    A collection of smaller patches to improve mesh performance in rate
    limited network links such as Wi-Fi HaLow. These include tuning
    adjustments for buffered frames, timeout increases to reduce control
    frame traffic, increases to maximum discovery times and so on.

commit 97ad1b2e5044b0e80af7ee24d6bfc3989d7388f0
Author: Liam Kearney <liam.kearney@morsemicro.com>
Date:   Thu Mar 13 01:36:11 2025 +1100

    mac80211: implement support for thin LMAC S1G NDP block acknowledgements

    This is an optional patch and is only required for Morse Micro's "Thin LMAC
    Mode", which is enabled when support for more than 200 stations is required.

    Morse Micro note: This commit is required if using Thin LMAC firmware.

im going to try a new build today and maybe ill leave out that patch that’s causing problems

For these patches, how did you amend them to resolve the conflicts? I haven’t had a chance yet to pull up the patches as I had applied them to my tree - but as soon as I do I will update the build thread.

Can you share your version of the patches exactly as they are applied to your tree?

I definitely will. What’s an example command to gather the information you request? Is the process of patching different than simply doing the hash..mm/ cherry-pick command and having it apply all of the commits? Of course also resolving conflicts along the way and choosing to keep changes coming from your repo. Or is that where I messed up and I should have instead, during my conflict resolving, not kept your changes for those 2 files?

Try running git show 97ad1b2 and share the output. We can compare that with git show e89a4f1 which is the patch directly from our tree.


You will likely find that the first git show has removed IEEE80211_HW_STRICT from the newer kernel version resulting in the errors you have seen.

The reason this has happened is because when a merge conflict occurs git will determine the differences between the two states (HEAD - your current tree - and the incoming patch), and show you the conflicting lines. In the case of the patch above you would see the following:

        IEEE80211_HW_DISALLOW_PUNCTURING,
        IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
        IEEE80211_HW_HANDLES_QUIET_CSA,
<<<<<<< HEAD
        IEEE80211_HW_STRICT,
=======
        IEEE80211_HW_SUPPORTS_NDP_BLOCKACK,
>>>>>>> e89a4f1d00ad (mac80211: implement support for thin LMAC S1G NDP block acknowledgements)

        /* keep last, obviously */
        NUM_IEEE80211_HW_FLAGS

Now, if you simply take our incoming changes (as many diff editors offer as an option) - you’re removing the changes that were made on HEAD. In this example, you’re removing IEEE80211_HW_STRICT.

The correct thing to do isn’t to accept our incoming changes - it’s to inspect the incoming changes against the existing content on HEAD, and make a judgement about what is needed. A good way to do this is to look at the corresponding hunk in git show e89a4f1 (keep in mind, that the context here is 6.12.21)

@@ -2885,6 +2896,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_DISALLOW_PUNCTURING,
        IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
        IEEE80211_HW_HANDLES_QUIET_CSA,
+       IEEE80211_HW_SUPPORTS_NDP_BLOCKACK,

        /* keep last, obviously */
        NUM_IEEE80211_HW_FLAGS

In this case it’s simply adding a line, so instead of taking the incoming change, and rejecting the existing line - you want both. Something that looks like:

        IEEE80211_HW_DISALLOW_PUNCTURING,
        IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
        IEEE80211_HW_HANDLES_QUIET_CSA,
        IEEE80211_HW_STRICT,
        IEEE80211_HW_SUPPORTS_NDP_BLOCKACK,

        /* keep last, obviously */
        NUM_IEEE80211_HW_FLAGS

which would then form a patch hunk against 6.12.25 that looks something like

@@ -2885,6 +2896,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
        IEEE80211_HW_HANDLES_QUIET_CSA,
        IEEE80211_HW_STRICT,
+       IEEE80211_HW_SUPPORTS_NDP_BLOCKACK,

        /* keep last, obviously */
        NUM_IEEE80211_HW_FLAGS

I hope that made sense.

That does make sense. I will go through those steps again this evening and for the 2 merge conflicts we run in to (or any new ones) I will do them properly this time :smiling_face_with_tear: .

@ajudge I have a successful compile! Apologies for my lack of merge conflict experience but after resolving the conflicts more precisely the kernel did compile successfully. I am continuing with the steps now.

No problem! Happy to help, and glad you got it all compiling!

I am all booted up and confirmed I am using the correct morse tagged kernel. I am not however seeing my new interface. The final steps of the guide were a bit tricky but here is the layout of the final files.

I have the bottom part of my config.txt

[all]
dtoverlay=wm6108-spi
dtparam=spi=on
kernel=kernel_2712-morse.img

my modprobe.d/morse.conf

options morse bcf=bcf_fgh100mhaamd.bin

my dts file

/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709", "brcm,bcm2711";

        fragment@0 {
                target = <&spi0>;
                frag0: __overlay__ {
                        pinctrl-0 = <&rp1_spi0_gpio9 &rp1_spi0_cs_gpio7 &morse_wake &morse_trst &morse_busy &morse_irq &morse_reset>;
                        cs-gpios = <&gpio 8 1>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";

                        mm6108: mm6108@0 {
                                compatible = "morse,mm610x-spi";
                                reg = <0>;
                                reset-gpios = <&gpio 17 0>;
                                power-gpios = <&gpio 23 0>,
                                              <&gpio 24 0>;
                                spi-irq-gpios = <&gpio 25 0>;
                                spi-max-frequency = <50000000>;
                                status = "okay";
                        };
                        spidev@0 {
                                reg = <0>;
                                status = "disabled";
                        };
                        spidev@1 {
                                reg = <1>;
                                status = "disabled";
                        };

                };
        };

        fragment@1 {
                target = <&rp1_spi0_cs_gpio7>;
                frag1: __overlay__ {
                        function = "gpio";
                        pins = "gpio8";
                        bias-pull-up;
                };
        };

        fragment@2 {
                target = <&gpio>;
                frag2: __overlay__ {
                        morse_wake: morse_wake {
                                function = "gpio";
                                pins = "gpio23";
                                output-high;
                                bias-disable;
                        };

                        morse_busy: morse_busy {
                                function = "gpio";
                                pins = "gpio24";
                                input;
                                bias-pull-down;
                        };

                        morse_irq: morse_irq {
                                function = "gpio";
                                pins = "gpio5";
                                bias-pull-up;
                                input;
                        };

                        morse_reset: morse_reset {
                                function = "gpio";
                                pins = "gpio17";
                                output-high;
                                bias-disable;
                        };
                };
        };

        fragment@3 {
                target = <&rp1_spi0_gpio9>;
                frag3: __overlay__ {
                        bias-disable;
                };
        };
};

command used to generate dtbo file

dtc -I dts -O dtb wm6108-spi.dts -o wm6108-spi.dtbo

and I placed the file in /boot/overlays

Getting there. Please send the output of dmesg, iw phy and ifconfig -a

dmesg.txt (39.6 KB)

ifconfig_a.txt (1.3 KB)

iw_phy.txt (5.4 KB)

So close!

From the dmesg output, I can’t see the Morse driver loading. Did you follow the steps for compiling and installing the morse driver?

Assuming you did, then it may be that some extra configuration is needed in /etc/modprobe.d to insert the module - which I may have not documented in the original thread (I will update)

As a test, can you run modprobe morse bcf=bcf_fgh100mhaamd.bin country=US and share any console output and reshare dmesg after running that command.

I believe I did those steps properly. That is for driver and firmware. Ran the commands again.

root@pi5-halow:~# cd morse_driver
make KERNEL_SRC=~/linux/ CONFIG_WLAN_VENDOR_MORSE=m CONFIG_MORSE_SPI=y CONFIG_MORSE_USER_ACCESS=y CONFIG_MORSE_VENDOR_COMMAND=y
make MORSE_VERSION="0-rel_1_16_4_2025_Sep_18" -C /root/linux/ M=/root/morse_driver
make[1]: Entering directory '/root/linux'
make[1]: Leaving directory '/root/linux'
root@pi5-halow:~/morse_driver# sudo make KERNEL_SRC=~/linux modules_install
make MORSE_VERSION="0-rel_1_16_4_2025_Sep_18" -C /root/linux M=/root/morse_driver modules_install
make[1]: Entering directory '/root/linux'
  INSTALL /lib/modules/6.12.25-v8-16k-morse+/updates/morse.ko
  XZ      /lib/modules/6.12.25-v8-16k-morse+/updates/morse.ko.xz
  INSTALL /lib/modules/6.12.25-v8-16k-morse+/updates/dot11ah/dot11ah.ko
  XZ      /lib/modules/6.12.25-v8-16k-morse+/updates/dot11ah/dot11ah.ko.xz
  DEPMOD  /lib/modules/6.12.25-v8-16k-morse+
make[1]: Leaving directory '/root/linux'
root@pi5-halow:~/morse_driver# cd ~/morse-firmware
sudo make install
install -D -t /lib/firmware/morse bcf/quectel/bcf_fgh100mabmd.bin bcf/quectel/bcf_fgh100mhaamd.bin bcf/quectel/bcf_fgh100maamd.bin bcf/quectel/bcf_fgh100mjaamd.bin bcf/morsemicro/bcf_mf08651_jp.bin bcf/morsemicro/bcf_boardtype_0801.bin bcf/morsemicro/bcf_mf08651_4v3_us.bin bcf/morsemicro/bcf_boardtype_0802.bin bcf/morsemicro/bcf_mf08651_us.bin bcf/morsemicro/bcf_mf15457.bin bcf/morsemicro/bcf_mm_hl1_4v3.bin bcf/morsemicro/bcf_mf28551.bin bcf/morsemicro/bcf_mm_hl1.bin bcf/morsemicro/bcf_boardtype_0807.bin bcf/morsemicro/bcf_boardtype_0804.bin bcf/azurewave/bcf_aw_hm677.bin bcf/azurewave/bcf_aw_hm593_4v3.bin bcf/azurewave/bcf_boardtype_0a02.bin bcf/azurewave/bcf_aw_hm593.bin bcf/azurewave/bcf_boardtype_0a01.bin firmware/mm6108.bin firmware/mm6108-tlm.bin firmware/mm8108b2-flm-rl.bin firmware/mm8108b2-rl.bin firmware/mm8108b2-tlm-rl.bin

No errors with the modprobe

root@pi5-halow:~/morse-firmware# modprobe morse bcf=bcf_fgh100mhaamd.bin country=US
root@pi5-halow:~/morse-firmware# lsmod | grep morse
morse                 442368  0
dot11ah               114688  1 morse
crc7                   49152  1 morse
mac80211             1097728  1 morse
cfg80211             1032192  4 dot11ah,brcmfmac,mac80211,morse

New output in dmesg as well.

[ 3661.763291] dot11ah: loading out-of-tree module taints kernel.
[ 3661.764166] Morse Micro Dot11ah driver registration. Version 0-rel_1_16_4_2025_Sep_18
[ 3662.105107] morse micro driver registration. Version 0-rel_1_16_4_2025_Sep_18

My full config.txt

config.txt (1.2 KB)

All those steps re the driver and firmware are correct.

Looks like the driver isn’t probing. The only reasons I believe this would fail is that the system can’t find the mm610x-spi compatible - which would only happen if the device tree overlay hasn’t loaded properly - or if the host spi controller driver hasn’t loaded.

Check the node is present in the kernels loaded device tree by running
grep -r mm610x /sys/firmware/devicetree/base/

Check the SPI controller driver is loaded with
lsmod | grep spi

Looks like you’re doing everything correct so far though, so not sure why this isn’t working yet!