How to upload a driver that I created to my device?

508 views
Skip to first unread message

Lucas. B

unread,
Jul 18, 2019, 10:37:54 AM7/18/19
to Android Building
@Dear All,



I've been wondering about some of the android functions for some time now, so I made a device driver.

And I downloaded the AOSP source code and built it into ENG(or userdebug), then flash it into my Pixel 3 XL.

But as I tried to load the module with the "insmod" command, I could find the following:

 
insmod: failed to load /sdcard/.../my_driver.ko: Required key not available


As far as I know, when loading a module using the "insmod" command from the ENG(or userdebug) binary, it is not necessary to verify the signature of the module.

Anyway, I have the above signature problem, and I wonder how to solve it.

How build own drive into the kernel, whether modify the .config in the AOSP source to build a new binary, or whatever can try to build a device driver, etc. I welcome everyone.

I want to make sure my driver is working normally on the my Pixel 3 XL.



with best regard,

Thanks =)
Lucas. B.

Dan Willemsen

unread,
Jul 18, 2019, 12:31:18 PM7/18/19
to Android Building
As far as I know, when loading a module using the "insmod" command from the ENG(or userdebug) binary, it is not necessary to verify the signature of the module.

The kernel configuration / image doesn't change between eng/userdebug and user, so this would surprise me. I suspect you'd have to rebuild the kernel, but I don't know for sure. The android-kernel google group may be able to help you more -- we generally only deal with prebuilt kernels when building the rest of the platform.

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/efbcb066-7ef7-4cb7-a5b6-55e39bfedfe2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Fries

unread,
Jul 18, 2019, 2:38:55 PM7/18/19
to Android Building
Unfortunately, until you have a Q based kernel, you'll be hitting a bug that we left module signature verification enabled.

You'll want a patch like this, rebuild the kernel and then you could load a module.

commit e8291e13f6a669e9f751975ce169be291fc01e64
Author: Steve Muckle <>
Date:   Thu Dec 20 16:19:13 2018 -0800

    defconfig: b1c1: disable module signing
    
    CONFIG_CRYPTO_SHA512 was being enabled by CONFIG_MODULE_SIG_SHA512, and
    is needed by CONFIG_CRYPTO_NIAP_FPT_TST_EXT_11 (currently set), so it
    is enabled.
    
    Bug: 121347485
    Change-Id: I5d5c93ded53ba4d9ab12f8684364db0f581e4d17
    Signed-off-by: Steve Muckle <>

diff --git a/arch/arm64/configs/b1c1_defconfig b/arch/arm64/configs/b1c1_defconfig
index 77e7dead49bd..26d976ae3c16 100644
--- a/arch/arm64/configs/b1c1_defconfig
+++ b/arch/arm64/configs/b1c1_defconfig
@@ -55,9 +55,6 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SIG=y
-CONFIG_MODULE_SIG_FORCE=y
-CONFIG_MODULE_SIG_SHA512=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_ARCH_QCOM=y
@@ -641,6 +638,7 @@ CONFIG_CRYPTO_NIAP_FPT_TST_EXT_11=y
 CONFIG_CRYPTO_GCM=y
 CONFIG_CRYPTO_XCBC=y
 CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_TWOFISH=y
 CONFIG_CRYPTO_LZ4=y
 CONFIG_CRYPTO_ANSI_CPRNG=y


On Thursday, July 18, 2019 at 11:31:18 AM UTC-5, Dan Willemsen wrote:
As far as I know, when loading a module using the "insmod" command from the ENG(or userdebug) binary, it is not necessary to verify the signature of the module.

The kernel configuration / image doesn't change between eng/userdebug and user, so this would surprise me. I suspect you'd have to rebuild the kernel, but I don't know for sure. The android-kernel google group may be able to help you more -- we generally only deal with prebuilt kernels when building the rest of the platform.

- Dan

On Thu, Jul 18, 2019 at 7:37 AM Lucas. B <bsbi...@gmail.com> wrote:
@Dear All,



I've been wondering about some of the android functions for some time now, so I made a device driver.

And I downloaded the AOSP source code and built it into ENG(or userdebug), then flash it into my Pixel 3 XL.

But as I tried to load the module with the "insmod" command, I could find the following:

 
insmod: failed to load /sdcard/.../my_driver.ko: Required key not available


As far as I know, when loading a module using the "insmod" command from the ENG(or userdebug) binary, it is not necessary to verify the signature of the module.

Anyway, I have the above signature problem, and I wonder how to solve it.

How build own drive into the kernel, whether modify the .config in the AOSP source to build a new binary, or whatever can try to build a device driver, etc. I welcome everyone.

I want to make sure my driver is working normally on the my Pixel 3 XL.



with best regard,

Thanks =)
Lucas. B.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-...@googlegroups.com.

abhishekku...@gmail.com

unread,
Jul 19, 2019, 2:26:17 PM7/19/19
to android-...@googlegroups.com
If you have full source code of Android stack with the kernel then you can check at AndroidBoard.mk file which will address the config file used for kernel compilation. If you want to compile only kernel then you can do something like:
$ make -j4 KERNEL_DEFCONFIG=xyz_defconfig
Here the xyz_defconfig is the file name which you might have found in AndroidBoard.mk.
This is the usual way but I am not sure about the device you are using.

~Abhishek Dwivedi

Dan Willemsen

unread,
Jul 19, 2019, 2:29:44 PM7/19/19
to Android Building
Android (as AOSP) does not build the kernel along with the platform code -- it's expected to be delivered as a prebuilt. So setting KERNEL_DEFCONFIG won't do anything.

- Dan

Reply all
Reply to author
Forward
0 new messages