cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
doreenyen
Explorer
Explorer
5,450 Views
Registered: ‎06-23-2013

insmod blink.ko -> Invalid module format, next trying to build against git cloned sources

  Since ug873-zynq-ctt.pdf describes the provided ug873-design-files/LKM/blink.ko as built against ISE 14.3,

and the information below, the next step is build against the git cloned sources.  Neither command line using Makefile below, make all

nor excluding/including Makefile in Vivado 2013.2 SDK 14.6 Application project can build blink.ko

 

The command line output is:

 

make ARCH=arm -C /home/doreen/Xilinx/gitLinux/linux-xlnx/ M=/home/doreen/Xilinx/ug873-design-files/LKM modules
make[1]: Entering directory `/home/doreen/Xilinx/gitLinux/linux-xlnx'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump /home/doreen/Xilinx/gitLinux/linux-xlnx/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/doreen/Xilinx/ug873-design-files/LKM/blink.o
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized argument in option ‘-mabi=apcs-gnu’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
make[2]: *** [/home/doreen/Xilinx/ug873-design-files/LKM/blink.o] Error 1
make[1]: *** [_module_/home/doreen/Xilinx/ug873-design-files/LKM] Error 2
make[1]: Leaving directory `/home/doreen/Xilinx/gitLinux/linux-xlnx'
make: *** [all] Error 2

The SDK Console output is:

17:34:27 **** Build of configuration Debug for project blink ****
make all
Building file: ../src/blink.c
Invoking: ARM Linux gcc compiler
arm-xilinx-linux-gnueabi-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MMD -MP -MF"src/blink.d" -MT"src/blink.d" -o "src/blink.o" "../src/blink.c"
../src/blink.c:5:55: fatal error: linux/module.h: No such file or directory
compilation terminated.
make: *** [src/blink.o] Error 1

17:34:27 Build Finished (took 64ms)

 

 

# modinfo blink.ko                                
filename:       blink.ko                                                       
depends:                                                                       
vermagic:       3.5.0-14.3-build2 SMP preempt mod_unload modversions ARMv7 

 

# uname -a                                        
Linux pbzynq1 3.8.0-xilinx-00015-gabc285b #1 SMP PREEMPT Mon Apr 15 09:22:29 PDx

 

$ cat Makefile
ARCH := arm
# This is the Ubuntu12.10 www.wiki.xilinx/com/Ubuntu+on+Zynq
KER_DIR := /home/doreen/Xilinx/gitLinux/linux-xlnx/
obj-m += blink.o
all:
    make ARCH=$(ARCH) -C $(KER_DIR) M=$(PWD) modules
clean:
    make ARCH=$(ARCH) -C $(KER_DIR) M=$(PWD) clean

dogbytes
0 Kudos
4 Replies
sorenb
Xilinx Employee
Xilinx Employee
5,447 Views
Registered: ‎03-13-2012


@doreenyen wrote:

 

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


Did you do what the build system told you? You need a configured kernel tree. Bare sources don't cut it.

0 Kudos
doreenyen
Explorer
Explorer
5,428 Views
Registered: ‎06-23-2013

Ah, this morning got around to a couple commands additionally run, as below,

 

    After running the Vivado settings64.sh,
    At the linux-xlnx directory of the Ubuntu kernel:
      cp ./arch/arm/configs/xilinx_zynq_defconfig .config
       make oldconfig
    make prepare
    make modules

so now the blink.ko was built, thanks.

dogbytes
0 Kudos
doreenyen
Explorer
Explorer
5,423 Views
Registered: ‎06-23-2013

Now the blink.ko linked to the same Linux kernel version for 32bit ARM, so what else causes invalid module format ?

Are there any other diagnostics available ?

 

# insmod blink.ko                                 
insmod: error inserting 'blink.ko': -1 Invalid module format                   
# modinfo blink.ko                                
filename:       blink.ko                                                       
depends:                                                                       
vermagic:       3.8.0-xilinx-00015-gabc285b SMP preempt mod_unload modversions 

 

# uname -a                                        

Linux pbzynq1 3.8.0-xilinx-00015-gabc285b #1 SMP PREEMPT Mon Apr 15 09:22:29 PDT 2013 armv7l armv7l armv7l GNU/Linux

# file blink.ko                                   
blink.ko: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), BuildID[sha1]=0x22d


 

dogbytes
0 Kudos
doreenyen
Explorer
Explorer
5,420 Views
Registered: ‎06-23-2013

Hm,  blink.c does not have any MODULE_ parameters nor

module_init( init_module);

module_exit( cleanup_module);

 

soooo, gonna try it, stay tuned.

dogbytes
0 Kudos