Ursa Major
Ursa Major

Reputation: 901

How do you create a signed loadable kernel module for Android?

I read what David Howells wrote on: https://kernel.googlesource.com/pub/scm/linux/kernel/git/dhowells/linux-modsign/+/modsign-rusty/Documentation/module-signing.txt

I heard that the CONFIG_MODULE_SIG has to be turned on, but it was not stated particularly how. I am also not sure how to use a kernel make command.

I am not able to piece together enough information to generate a mini signed LKM.

Would anyone here have done it before, and able to guide me on a minimallist example on signing a helloworld LKM?

Upvotes: 2

Views: 5663

Answers (2)

vinit patel
vinit patel

Reputation: 11

CONFIG_MODULE_SIG=y only enables feature, to enforce it you also have to put CONFIG_MODULE_SIG_FORCE=y in the config file.

basically I found that there are three flags associated with this feature: CONFIG_MODULE_SIG=y #to enable the feature CONFIG_MODULE_SIG_ALL=y #to sign all the loadable modules during build process CONFIG_MODULE_SIG_FORCE=y #to enforce the feature so that no unsigned module can be loaded.

Upvotes: 1

72DFBF5B A0DF5BE9
72DFBF5B A0DF5BE9

Reputation: 5002

For enabling CONFIG_MODULE_SIG, simply in configure file (.config), have this line:

CONFIG_MODULE_SIG=y

I've not tried, but I think even you can have CONFIG_MODULE_SIG=y in make command like:

make CONFIG_MODULE_SIG=y

For how to build a LKM for android, there is several tutorials in internet, for example take a look at this: How do you create a loadable kernel module for Android?

Upvotes: 2

Related Questions