How to add a Kernel Config setting to package makefile

So I am about the starting testing my kernel driver only to find out that some parts are not automatically included in the Kernel, resulting in my module not loading due to missing symbols.

Specifically I need to have "CONFIG_CRYPTO_ENGINE=y" added to the config file when building the Kernel. How do I add that to a Makefile for a kernel package? The original idea was to have just a package with my kernel module that the user could select in the "make menuconfig". However, the need to have additional stuff compiled into the kernel sort of defeats that purpose/idea.

Alternatively could I just add the missing file to my own makefile? In effect its only missing 1 file (crypto_engine.c) that gets compiled using the above switch.

Rather than enabling that kernel symbol in your Makefile, you should make your package depend on it, so when you select the package in the buildroot, it enables that symbol. That's the clean way to do it. Look at how other driver Makefiles do it.

You shouldn't be setting kernel stuff in a package Makefile afaik.

I tried looking at some other examples. Even when I add a "config" definition section with just "select CRYPTO_ENGINE" it doesn't work, even according the old openwrt wiki it should.

For now I did the dirty thing and just hacked the Makefile inside linux/crypto to always include the engine. This will help me to continue writing/debugging/improving my code. Once I'm happy with the result I will have some of you more clever people have a look at how best to add this into the Lede project and improve my work even further.

Let me ask the question again:

In "linux/crypto/Kconfig" there is "config CRYPTO_ENGINE" which is only "tristate"
In "linux/driver/crypto/Kconfig" as an example the "config CRYPTO_DEV_OMAP_AES" section has "select CRYPTO_ENGINE" (and other stuff).

I would like my driver as "package" under "openwrt/package/mypackage" with its own Makefile that can "select" the crypto_engine which is part of the kernel. I realise that my package will not work as "package" unless the kernel running my package at some point in time had this dependancy build-in, but for now I don't see another way to do it (short of having all the crypto_engine code inside my own package).

My Makefile with "DEPENDS:=+@CRYTPO_ENGINE" does show that my package will select "CRYPTO_ENGINE" when I select "help" in "make menuconfig". However selecting the above mentioned OMAP driver in "make kernel_menuconfig" shows "selects CRYPTO_ENGINE [=y]". The "[=y]" seems to be the "Trick".

Maybe I can't (or shouldn't) like @Borromini said. Either way, suggestions how to solve this issue are welcome.

The kernel bits are turned on by prefixing them with CONFIG_KERNEL_. So to integrate CRYPTO_ENGINE into OpenWrt's .config, you'd use e.g. CONFIG_KERNEL_CRYPTO_ENGINE=y; I don't know how to use that in a Makefile though. I've grepped through the tree but no clear analogies show up.

I Googled with your suggestion and there seems to be a few makefiles like that. Not home right now, will try in the evening if it will give the proper results.

After it works using this “buildin” engine I might change to use my own queue handling and start using tasklets. That way I should be able to “feed” the hardware new packets as soon as they are read, not once they are processed and written back. Like that I should be able to improve throughout (at least in theory) and reduce the amount of interrupts generated by the hardware.

I almost finished my initial build so once that’s done I can do some tests to see how the theory stacks up against reality.