Loading kernel module in Android on iMX6q-sabre SD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Loading kernel module in Android on iMX6q-sabre SD

Jump to solution
2,273 Views
ankitsoni
Contributor I

Hello everyone,

I am new with iMX6 board, and recently started work with iMX6 board, and I am trying to port device drivers on this board. I have used ltib for developing Linux kernel 3.0.35 and successfully patched kernel module (.ko) file of the same driver. but while loading same file (.ko) using insmod command on Android (demo image provided by Freescale) which also has kernel 3.0.35 is showing error(Format exec error).I searched Internet and found that this ko file should be digitally signed.

so my question is how can I get rid of this problem?

the second approach I have used is building the android for the board (Android user guide )and patching the the kernel before building the images.but i am not getting at what stage of this process the module should be loaded..?

Kindly help me out for solving this issue ASAP..

Labels (2)
0 Kudos
1 Solution
1,246 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

You have to recompile the module agains the kernel version you have.

Or recompile the entire kernel.

From the BSP Android documents:

3.6 Building a kernel image

Kernel image is built while building the Android root file system.

If you do not need to build the kernel image, skip this section.

To run the Android platform using NFS or from SD, build the kernel with the default configuration as follows:

Assume you had already built U-Boot. mkimage was generated under myandroid/bootable/bootloader/uboot-imx/tools/ and it

is in your PATH.

$ export PATH=~/myandroid/bootable/bootloader/uboot-imx/tools:$PATH

$ cd ~/myandroid/kernel_imx

$ echo $ARCH && echo $CROSS_COMPILE

Make sure that you have those two environment variables set. If the two variables are not set, set them as follows:

$ export ARCH=arm

$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-

# Generate ".config" according to default config file under arch/arm/configs.

# To build the kernel image for i.MX 6Dual/Quad, 6DualLite, 6Solo, 6SoloLite, and 6SoloX

$ make imx_v7_android_defconfig

# To build the kernel image for i.MX 6Dual/Quad, 6DualLite, and 6Solo

$ make uImage LOADADDR=0x10008000

# To build the kernel image for i.MX 6SoloLite

$ make uImage LOADADDR=0x80008000

# To build the kernel image for i.MX 6SoloX

$ make uImage LOADADDR=0x80008000

The kernel images are found in the folders: ~/myandroid/kernel_imx/arch/arm/boot/zImage and ~/myandroid/kernel_imx/

arch/arm/boot/uImage.

Alejandro

View solution in original post

0 Kudos
3 Replies
1,246 Views
alejandrolozan1
NXP Employee
NXP Employee

If you patched the kernel, you have to generate the module as loadable module (.ko, M option in menuconfig). After that you can copy the module in the rootfs and then load it in Android (insmod).

/Alejandro

0 Kudos
1,246 Views
ankitsoni
Contributor I

Thank you Alejandro for reply..

I have read somewhere for inserting the kernel module you will need digitally signed .ko file. would it be possible to insmod the unsigned .ko file in android kernel? if is it so then Can you please elaborate the stpes?

0 Kudos
1,247 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

You have to recompile the module agains the kernel version you have.

Or recompile the entire kernel.

From the BSP Android documents:

3.6 Building a kernel image

Kernel image is built while building the Android root file system.

If you do not need to build the kernel image, skip this section.

To run the Android platform using NFS or from SD, build the kernel with the default configuration as follows:

Assume you had already built U-Boot. mkimage was generated under myandroid/bootable/bootloader/uboot-imx/tools/ and it

is in your PATH.

$ export PATH=~/myandroid/bootable/bootloader/uboot-imx/tools:$PATH

$ cd ~/myandroid/kernel_imx

$ echo $ARCH && echo $CROSS_COMPILE

Make sure that you have those two environment variables set. If the two variables are not set, set them as follows:

$ export ARCH=arm

$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-

# Generate ".config" according to default config file under arch/arm/configs.

# To build the kernel image for i.MX 6Dual/Quad, 6DualLite, 6Solo, 6SoloLite, and 6SoloX

$ make imx_v7_android_defconfig

# To build the kernel image for i.MX 6Dual/Quad, 6DualLite, and 6Solo

$ make uImage LOADADDR=0x10008000

# To build the kernel image for i.MX 6SoloLite

$ make uImage LOADADDR=0x80008000

# To build the kernel image for i.MX 6SoloX

$ make uImage LOADADDR=0x80008000

The kernel images are found in the folders: ~/myandroid/kernel_imx/arch/arm/boot/zImage and ~/myandroid/kernel_imx/

arch/arm/boot/uImage.

Alejandro

0 Kudos