Solution to the failure of 6ull to load the Linux driver module

Solution to the failure of 6ull to load the Linux driver module

0x01 Failed to load the driver module

The description of the failure to load the driver is as follows. The error message indicates that the Linux kernel version running on the board is 4.1.15-g49efdaa, and the architecture is ARMv7; while the kernel source code version used to compile the driver is 4.1.15, and the architecture is ARMv6. This indicates that the kernel version name and architecture used to compile the driver are inconsistent with those running on the board.

root@ALIENTEK-IMX6U:~/get# insmod led.ko
[ 1634.442887] led: version magic '4.1.15 SMP preempt mod_unload modversions ARMv6 p2v8 ' should be '4.1.15-g49efdaa SMP preempt mod_unload modversions ARMv7 p2v8 '
insmod: ERROR: could not insert module led.ko: Invalid module format

0x02 Solution

There are two ways to solve this:
(1) Recompile the kernel and device tree and burn them to the board.
(2) Change the kernel configuration information in the host to make it consistent with that in the board.

Reburning the kernel is troublesome, so here we use method 2 .

1. Enter the commands uname -r and uname -p in the board terminal to view the version and architecture information of the kernel running on the board.

root@ALIENTEK-IMX6U:~/get# uname -r
4.1.15-g49efdaa
root@ALIENTEK-IMX6U:~/get# uname -p
armv7l

The Linux kernel version running on the board is 4.1.15-g49efdaa , and the processor architecture is ARMv7

2. Enter the root directory of the Linux kernel used by the driver module in the host, and execute make menuconfig to start the Linux kernel graphical configuration interface (if you cannot use menuconfig, you can use Baidu to install the corresponding dependent libraries)

As shown in the figure below, enter System Type option:

insert image description here

Then enter the Multiple platform selection option:

insert image description here

Then in the interface below, cancel the * in front of the first ARMv6 based platforms(ARM11) (press the spacebar to cancel after selecting it)

insert image description here

After canceling, save and exit, and the architecture supported by the kernel will be changed to ARMv7.
After configuring menuconfig, do not enter other kernel configuration commands, otherwise the previous configuration will be flushed.

3. Open the Makefile in the kernel root directory and add the second half of the Linux kernel version number running on your board after the EXTRAVERSION variable. For example, the second half of my kernel is -g49efdaa .

insert image description here

Save the changes after completion, and execute make -j12 in the Linux kernel root directory to recompile the kernel.
Recompile the driver module after the kernel is compiled.

After the driver module is compiled, use NFS to download it to the board. Enter modinfo [驅動模塊名] to view the driver module information:

root@ALIENTEK-IMX6U:~/get# modinfo led.ko
filename: /home/root/get/led.ko
author: zuozhongkai
license: GPL
srcversion:597E1DDC8A372707B8FD0DE
depends:
vermagic: 4.1.15-g49efdaa SMP preempt mod_unload modversions ARMv7 p2v8

It can be seen that the kernel version and processor architecture of the driver module displayed in vermagic line are consistent with the kernel information in the board, and the driver module can be loaded successfully.

root@ALIENTEK-IMX6U:~/get# uname -r
4.1.15-g49efdaa
root@ALIENTEK-IMX6U:~/get# uname -p
armv7l

Summarize

This is the end of this article about the solution to the failure of 6ull to load the Linux driver module. For more related content about the failure to load the Linux driver module, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Linux kernel device driver Linux kernel module loading mechanism notes summary

<<:  How to use flat style to design websites

>>:  Detailed explanation of Vue project packaging

Recommend

SQL implementation LeetCode (185. Top three highest salaries in the department)

[LeetCode] 185. Department Top Three Salaries The...

Javascript to achieve the drag effect of the login box

This article shares the specific code of Javascri...

How to delete a MySQL table

It is very easy to delete a table in MySQL, but y...

An article tells you how to implement Vue front-end paging and back-end paging

Table of contents 1: Front-end handwritten paging...

MySQL 5.7.10 installation and configuration tutorial under Windows

MySQL provides two different versions for differe...

js to achieve the complete steps of Chinese to Pinyin conversion

I used js to create a package for converting Chin...

How to display texture at the position of swipe in CocosCreator

Table of contents 1. Project requirements 2. Docu...

Correct modification steps for Docker's default network segment

background A colleague is working on his security...

Win10 64-bit MySQL8.0 download and installation tutorial diagram

How do I download MySQL from the official website...

JavaScript two pictures to understand the prototype chain

Table of contents 1. Prototype Relationship 2. Pr...

How to build gitlab on centos6

Preface The original project was placed on the pu...

Implementation of breakpoint resume in vue-video-player

In a recent project, I needed to implement the fu...

Summary of Linux date command knowledge points

Usage: date [options]... [+format] or: date [-u|-...