cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
915 Views
Registered: ‎04-06-2018

compile module : invalid module format

Jump to solution

I am trying a simple thing , compiling a module.

where I downloaded : linux-xlnx-xlnx_rebase_v4.14_2018.2

my makefile to compile the module is :

export ARCH:=arm
export CROSS_COMPILE:=arm-xilinx-linux-gnueabi-

CC=$(CROSS_COMPILE)gcc
obj-m += luscher.o

KDIR  := /home/maikon/Downloads/linux-xlnx-xlnx_rebase_v4.14_2018.2
PWD        := $(shell pwd)

default:
    ${MAKE} -C ${KDIR} -I ${KDIR}/include -I. M=${PWD} modules

clean:
    rm -rf *.o *.mod.* *.symvers *.order *~ *.cmd .tmp*

 

in the directory : linux-xlnx-xlnx_rebase_v4.14_2018.2 , which is the same the makefile is pointing I run:

make ARCH=arm xilinx_zynq_defconfig

make ARCH=arm modules

but I tried other commands like :

source ~/x/Vivado/2018.2/settings64.sh
cp ./arch/arm/configs/xilinx_zynq_defconfig .config
make ARCH=arm xilinx_zynq_defconfig
make ARCH=arm prepare
make ARCH=arm modules

my board has a kernel : Linux peta64v2 4.14.0-xilinx-v2018.2 #2 SMP PREEMPT Fri Feb 8 09:34:20 PST 2019 armv7l GNU/Linux

 

when I run file my module I get:

file luscher.ko
luscher.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=11b866e74481f70b1fc274305ddd5171756a748c, not stripped

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
840 Views
Registered: ‎04-06-2018

Re: compile module : invalid module format

Jump to solution

tks for replying , I feel a bit embarassed .. I just followed :

how to compile the module in a cross compiling way


https://github.com/SDU-Embedded/linux_zynq/wiki/Installing-Linux-on-the-ZYBO
https://github.com/SDU-Embedded/linux_zynq/wiki/Cross-Compiling-Kernel-Modules-for-the-Zynq-7000-Series-Platform

apt install libncurses5-dev libncursesw5-dev u-boot-tools device-tree-compiler flex libssl-dev

export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
source <Xilinx installation directory>/Vivado/<version>/settings64.sh

in the download kernel free downloaded:

make ARCH=arm xilinx_zynq_defconfig
make ARCH=arm menuconfig

make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage
make ARCH=arm modules

then the makefile of the module is :

export ARCH:=arm
export CROSS_COMPILE:=arm-xilinx-linux-gnueabi-

CC=$(CROSS_COMPILE)gcc

obj-m += simple.o

KDIR  := path/to/linux-xlnx-zynmp-dt-fixes-for-4.10
PWD        := $(shell pwd)

default:
    ${MAKE} -C ${KDIR} M=${PWD} modules

clean:
    ${MAKE} -C ${KDIR} M=${PWD} clean

View solution in original post

0 Kudos
2 Replies
Highlighted
Voyager
Voyager
889 Views
Registered: ‎10-21-2015

Re: compile module : invalid module format

Jump to solution

Hi

Could you show the result of the following command?

$ modinfo luscher.ko
0 Kudos
Highlighted
Contributor
Contributor
841 Views
Registered: ‎04-06-2018

Re: compile module : invalid module format

Jump to solution

tks for replying , I feel a bit embarassed .. I just followed :

how to compile the module in a cross compiling way


https://github.com/SDU-Embedded/linux_zynq/wiki/Installing-Linux-on-the-ZYBO
https://github.com/SDU-Embedded/linux_zynq/wiki/Cross-Compiling-Kernel-Modules-for-the-Zynq-7000-Series-Platform

apt install libncurses5-dev libncursesw5-dev u-boot-tools device-tree-compiler flex libssl-dev

export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
source <Xilinx installation directory>/Vivado/<version>/settings64.sh

in the download kernel free downloaded:

make ARCH=arm xilinx_zynq_defconfig
make ARCH=arm menuconfig

make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage
make ARCH=arm modules

then the makefile of the module is :

export ARCH:=arm
export CROSS_COMPILE:=arm-xilinx-linux-gnueabi-

CC=$(CROSS_COMPILE)gcc

obj-m += simple.o

KDIR  := path/to/linux-xlnx-zynmp-dt-fixes-for-4.10
PWD        := $(shell pwd)

default:
    ${MAKE} -C ${KDIR} M=${PWD} modules

clean:
    ${MAKE} -C ${KDIR} M=${PWD} clean

View solution in original post

0 Kudos