Compile module with kernel dependence


I'm trying to compile the following module (for Chaos Calmer):

In the howto, the proposed method is recompiling the entire openwrt image with the module inserted and re-flash the router, but I'm trying to build it as a package and install it through opkg.

For doing so, I downloaded the SDK for the corresponding Openwrt version and architecture. I followed the guide "Using the SDK" and I ended with the module ipk's. But after installing them on the router, the kernel module fails to start and the Dmesg output is:

[   17.340000] lirc_gpioblaster: Unknown symbol lirc_unregister_driver (err 0)
[   17.350000] lirc_gpioblaster: Unknown symbol lirc_dev_fop_poll (err 0)
[   17.370000] lirc_gpioblaster: Unknown symbol lirc_dev_fop_open (err 0)
[   17.380000] lirc_gpioblaster: Unknown symbol lirc_dev_fop_close (err 0)
[   17.390000] lirc_gpioblaster: Unknown symbol lirc_dev_fop_read (err 0)
[   17.410000] lirc_gpioblaster: Unknown symbol lirc_register_driver (err 0)
[   17.420000] lirc_gpioblaster: Unknown symbol lirc_dev_fop_ioctl (err 0)

After searching, these symbols are defined in "lirc.h" and "lirc_dev.h", which are part of the kernel itself. The actual kernel which is running my device apparently doesn't have them and therefore the module throws the previous errors. Is there any way of building a kernel module so it can be installed to add these definitions without need of rebuilding and reflashing the entire kernel?

Thanks for your attention

Finally, I was able to solve it somehow, it isn't the right way but I leave it here as a reference because it worked.

I downloaded the source code corresponding to the kernel used in my openwrt version (3.18.23) and found that the missing symbols were defined in "drivers/media/rc/lirc_dev.c". So I modified the module "lirc_gpioblaster" by changing it's name in the makefile and substituting all the source code by the one of "lirc_dev.c". I compiled it in the SDK and surprisingly it gave no errors and it produced a package that I could install by opkg. I installed that package and after restarting the router the errors shown in the initial posts disappeared, but now two different symbols were missing.

I tried repeating the procedure with the file which defined these two symbols but now the compilation process didn't finish. As they were only two symbols, I decided to copy-paste directly it's definition into the module based in "lirc_dev.c". It was only about 20 lines. I re-compiled it, it gave no errors and after flashing on the router finally it worked. I tried irsend and is working correctly.

As a summary, I achieved my proposal of making the module work without recompiling and re-flashing the entire system.