Loading kernel module on samsung s9 device

224 views Asked by At

I trying to load simple kernel module like "hello world" program without success. The file helloworld.c looks like:

#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */

int init_module(void)
{
        printk(KERN_INFO "Hello world\n");

        return 0;
}

void cleanup_module(void)
{
        printk(KERN_INFO "Goodbye world\n");
}

MODULE_LICENSE("GPL");
MODULE_INFO(intree, "Y");

The Makefile looks like the following:

obj-m += helloworld.o

ARCH := arm64
CROSS := /home/user/Desktop/toolchains/standalone/aarch64-linux-android-4.9/bin/aarch64-linux-android-
KDIR := ../..
PWD := $(shell pwd)

default:
        $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS) -C $(KDIR) M=$(PWD) modules

clean:
        $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS) -C $(KDIR) M=$(PWD) clean

Unfortunately, while I loading the helloworld.ko binary file I'm getting page fault exception. This is what I see in "/proc/last_kmsg":

                   [2:         insmod:12311] Unable to handle kernel paging request at virtual address ffffff8000e48004
 
<2>[ 1924.769921]  [2:         insmod:12311]
sec_debug_set_extra_info_fault = KERN / 0xffffff8000e48004

<1>[ 1924.770135]  [2:         insmod:12311] pgd = ffffffc030d50000

<1>[ 1924.772303]  [2:         insmod:12311] [ffffff8000e48004]
*pgd=0000000000000000, *pud=0000000000000000

<0>[ 1924.781553]  [2:         insmod:12311] Internal error: Oops:
8600000f [#1] PREEMPT SMP

<4>[ 1924.789431]  [2:         insmod:12311] Modules linked in:
helloworld(+)

<0>[ 1924.795773]  [2:         insmod:12311] exynos-snapshot: core
  register saved(CPU:2)

<0>[ 1924.803319]  [2:         insmod:12311] DISR_EL1:
  0000000000000000

<0>[ 1924.809402]  [2:         insmod:12311] 1st : ERXSTATUS_EL1:
  0000000000000000, ERXADDR_EL1: 0000000000000000, ERXMISC0_EL1:
  0000000000000000

<0>[ 1924.821900]  [2:         insmod:12311] 2nd : ERXSTATUS_EL1:
  0000000000000000, ERXADDR_EL1: 0000000000000000, ERXMISC0_EL1:
  0000000000000000

<0>[ 1924.834397]  [2:         insmod:12311] exynos-snapshot: context
saved(CPU:2)

<6>[ 1924.841553]  [2:         insmod:12311] exynos-snapshot: item -
  log_kevents is disabled

<6>[ 1924.849330]  [2:         insmod:12311] TIF_FOREIGN_FPSTATE: 1,
FP/SIMD depth 0, cpu: 0

Maybe I need to pass anything to KCFLAGS of add/remove feature to the kernel?

0

There are 0 answers