This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TMDXSK437X: Kernel modules build issue

Part Number: TMDXSK437X

Tool/software: Linux

How to correctly rebuild loadable kernel modules with "Enable stack unwinding support" ?

When kernel and modules are built with debug info and "Enable stack unwinding support" config option,
the modules are failed to boot: "disagrees about version of symbol module_layout"


ti-processor-sdk-linux-am437x-evm-04.03.00.05
am437x-sk-evm


Boot log:
===========================================
...
[FAILED] Failed to start Load Kernel Modules.                                                                                                         
See 'systemctl status systemd-modules-load.service' for details.                                                                                      
[  OK  ] Started Remount Root and Kernel File Systems.                                                                                                
...                                                                                                                 
[   11.018150] remoteproc: disagrees about version of symbol module_layout                                                                            
[   11.042719] omap_wdt: disagrees about version of symbol module_layout                                                                              
...                                                                         
[   11.556268] snd_soc_tlv320aic3x: disagrees about version of symbol module_layout                                                                   
[   12.202015] am437x_vpfe: disagrees about version of symbol module_layout                                                                           
[   12.219460] am437x_vpfe: disagrees about version of symbol module_layout                                                                                                                                             
...                                         

Insmod:
===========================================
root@am437x-evm:~# insmod /lib/modules/4.9.69-g9ce43c71ae/kernel/drivers/media/platform/am437x/am437x-vpfe.ko                                         
[ 1522.165787] am437x_vpfe: disagrees about version of symbol module_layout                                                                           
insmod: ERROR: could not insert module /lib/modules/4.9.69-g9ce43c71ae/kernel/drivers/media/platform/am437x/am437x-vpfe.ko: Invalid module format     

Modinfo:
===========================================
root@am437x-evm:~# modinfo /lib/modules/4.9.69-g9ce43c71ae/kernel/drivers/media/platform/am437x/am437x-vpfe.ko                                        
filename:       /lib/modules/4.9.69-g9ce43c71ae/kernel/drivers/media/platform/am437x/am437x-vpfe.ko                                                   
version:        0.1.0                                                                                                                                 
license:        GPL                                                                                                                                   
description:    TI AM437x VPFE driver                                                                                                                 
author:         Texas Instruments                                                                                                                     
srcversion:     068F2F1D15C039784AD1932                                                                                                               
alias:          of:N*T*Cti,am437x-vpfeC*                                                                                                              
alias:          of:N*T*Cti,am437x-vpfe                                                                                                                
depends:                                                                                                                                              
intree:         Y                                                                                                                                     
vermagic:       4.9.69-g9ce43c71ae preempt mod_unload modversions ARMv7 p2v8                                                                          
parm:           debug:Debug level 0-8 (int)  

Objdump:
===========================================
root@am437x-evm:~# objdump -i /lib/modules/4.9.69-g9ce43c71ae/kernel/drivers/media/platform/am437x/am437x-vpfe.ko                                     
BFD header file version (GNU Binutils) 2.27.0.20160806                                                                                                
elf32-littlearm                                                                                                                                       
 (header little endian, data little endian)                                                                                                           
  arm                                                                                                                                                 
elf32-bigarm                                                                                                                                          
 (header big endian, data big endian)                                                                                                                 
  arm                                                                                                                                                 
elf32-little                                                                                                                                          
 (header little endian, data little endian)                                                                                                           
  plugin                                                                                                                                              
  arm                                                                                                                                                 
elf32-big                                                                                                                                             
 (header big endian, data big endian)                                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
plugin                                                                                                                                                
 (header little endian, data little endian)                                                                                                           
srec                                                                                                                                                  
 (header endianness unknown, data endianness unknown)                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
symbolsrec                                                                                                                                            
 (header endianness unknown, data endianness unknown)                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
verilog                                                                                                                                               
 (header endianness unknown, data endianness unknown)                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
tekhex                                                                                                                                                
 (header endianness unknown, data endianness unknown)                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
binary                                                                                                                                                
 (header endianness unknown, data endianness unknown)                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
ihex                                                                                                                                                  
 (header endianness unknown, data endianness unknown)                                                                                                 
  plugin                                                                                                                                              
  arm                                                                                                                                                 
                                                                                                                                                      
               elf32-littlearm elf32-bigarm elf32-little elf32-big plugin srec                                                                        
        plugin --------------- ------------ elf32-little elf32-big ------ srec                                                                        
           arm elf32-littlearm elf32-bigarm elf32-little elf32-big ------ srec                                                                        
                                                                                                                                                      
               symbolsrec verilog tekhex binary ihex                                                                                                  
        plugin symbolsrec verilog tekhex binary ihex                                                                                                  
           arm symbolsrec verilog tekhex binary ihex                                                                                                  


Built with "Enable stack unwinding support" in cofig:
===================================================
export PATH=$PATH:/home/od/ti/ti-processor-sdk-linux-am437x-evm-04.03.00.05/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export INSTALL_MOD_PATH=/home/od/ti/ti-processor-sdk-linux-am437x-evm-04.03.00.05/targetNFS
make mrproper
make am437x-evm_debug_defconfig
echo "=================================zImage===================================="
make zImage
cp arch/arm/boot/zImage ../../targetNFS/boot/
echo "=================================modules==================================="
make modules
make modules_install


  • Hello Oleksiy,

    Please, do it in this way.

    1) Clean.
    make linux_clean

    2) Backup your defconfig file
    cp board-support/linux-<version>/arch/arm/configs/tisdk_am437x-evm_defconfig board-support/linux-<version>/arch/arm/configs/tisdk_am437x-evm_defconfig.bak

    3) Load default config.
    cd board-support/linux-<version>/
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am437x-evm_defconfig

    4) Config in Menuconfig and enable the needed options, unwinding support in your case.

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

    Kernel hacking ---> [*] Enable stack unwinding support

    5) Replace the old defconfig file with the new one which includes unwinding support.
    cd ../../
    cp board-support/linux-<version>/.config board-support/linux-<version>/arch/arm/configs/tisdk_am437x-evm_defconfig

    6) Compile and install the dtb, linux and modules.
    make linux
    make linux_install

    7) Compile and install the ti-sgx-ddk-km modules.
    make ti-sgx-ddk-km
    make ti-sgx-ddk-km_install

    8) Copy the needed dtb, kernel and modules in a proper places at your SD card.

    sudo cp -r targetNFS/boot/ /media/<username>/rootfs/
    sudo cp -r targetNFS/lib/modules/ /media/<username>/rootfs/lib/

    Best regards,
    Kemal