Problem creating a kernel module for MT300n-v2

I am trying to build a “hello world” kernel module for MT300n-v2 following the example here:

    https://www.programmersought.com/article/14485920468/

I was able to build the module, but when trying to install it I got an architecture error:

opkg install kmod-mydrv_4.14.63-1_mipsel_24kc.ipk

Unknown package ‘kmod-mydrv’.
Collected errors:

  • pkg_hash_fetch_best_installation_candidate: Packages for kmod-mydrv found, but incompatible with the architectures configured
  • opkg_install_cmd: Cannot install package kmod-mydrv.

I verified during the make process that LINUX_KARCH is “mips”. In the same environment I can build user apps that run on the same MT300n-v2 unit without problem.

Do you have a working example of kernel module that I can use as a template?