FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
6204 Discussions

invalid module format LKM DE1-SOC

aiedb
Beginner
409 Views

hii i am trying to compile a simple device driver and insert it on lenux system that is on the DE1-SOC board that i have
i included the files when i compile the lkm module gets generated but when i move it to the de1-soc board and try the insmod command i get an error i it cant load

when i do file hello.ko i can see that its elf 32bit arm file

but when i put on the board it says invalid module format

what i missing here i be glad for help

the make file code

Target object file

obj-m := hello.o

Cross-compiler path for ARM (BeagleBone)

CROSS_COMPILE_ARM = arm-linux-gnueabihf-

Cross-compiler path for x86 (Intel)

CROSS_COMPILE_X86 =

Target architecture (default: ARM)

ARCH ?= arm

ifeq ($(ARCH),x86_64)
# Compile for x86 (Intel)
CROSS_COMPILE := $(CROSS_COMPILE_X86)
else
# Compile for ARM (default)
CROSS_COMPILE := $(CROSS_COMPILE_ARM)
endif

Kernel directory

KERNELDIR ?= $(HOME)/linux

Current directory

PWD := $(shell pwd)

Build target for building the module

module:
$(MAKE) -C $(KERNELDIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
@Echo “Building module for $(ARCH) architecture”

Clean target for cleaning the module build artifacts

clean:
$(MAKE) -C $(KERNELDIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) clean
rm -rf *.o ~ core .depend ..cmd *.ko *.mod.c .tmp_versions

Declare the targets as phony targets

.PHONY: module clean

the lkm modle code

/*

  • $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
    */
    #include <linux/init.h>
    #include <linux/module.h>

static int hello_init(void)
{
printk(KERN_ALERT “hello world \n”);
printk(KERN_ALERT “module is up \n”);
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT “bye bye \n”);
printk(KERN_ALERT “module is down \n”);
return ;
}

module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE(“Dual BSD/GPL”);

Labels (1)
0 Kudos
4 Replies
JingyangTeh
Employee
246 Views

Hi


We sincerely apologize for the inconvenience caused by the delay in addressing your Forum queries. Due to an unexpected back-end issue in our system, your Forum cases, along with others, did not get through as intended. As a result, we have a backlog of cases that we are currently working through one by one.

Please be assured that we are doing everything we can to resolve this issue as quickly as possible. However, this process will take some time, and we kindly ask for your patience and understanding during this period. The cases will be attended by AE shortly.

We appreciate your patience and understanding, and we are committed to providing you with the best support possible. 

Thank you for your understanding.


Back to your issue, for the cycloneV device could you use the cross compiler with CROSS_COMPILE=arm-none-linux-gnueabihf-


Regards

Jingyang, Teh


Regards

Jingyang, Teh


0 Kudos
JingyangTeh
Employee
210 Views

Hi


Do you have any follow up question on this case?


Regards

Jingyang, Teh


0 Kudos
aiedb
Beginner
201 Views
0 Kudos
JingyangTeh
Employee
166 Views

Hi


I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


Regards

Jingyang, Teh


0 Kudos
Reply