Tag Archives: Linux driver

How to Solve Android Linux5.10 Kernel do_gettimeofday Function Error

Android Linux 5.10 kernel do_gettimeofday function prompt does not exist.

Solution: Replace with ktime_get_real_ts64 function.

Specific examples:

Code before modification:

    struct  timeval   time_now;
	struct rtc_time tm; 
    do_gettimeofday(&time_now);
	rtc_time_to_tm(time_now.tv_sec, &tm); 

Code after modification:

	struct timespec64 ts64;
	struct rtc_time tm; 
    ktime_get_real_ts64(&ts64);
	tm = rtc_ktime_to_tm(ts64.tv_sec); 

NXP mx8 Platform tensorflow-lite build error [How to Solve]

Solutions provided by NXP
Compiling L5.4.3_1.0.0 BSP On Ubuntu 180.4 LTS – NXP Community
1. Compile tensorflow-lite with bitbake
bitbake tensorflow-lite -c do_configure -v -f
The following error occurs, at this time you can see the download of the wrong package
FAILED: ruy-populate-prefix/src/ruy-populate-stamp/ruy-populate-download
The specific path is
tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/ruy-populate-stamp/ruy-populate-download

tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/

Check whether there is a corresponding zip package in the modified directory, and copy it to the tensorflow pack folder created in the corresponding root directory.

| FAILED: ruy-populate-prefix/src/ruy-populate-stamp/ruy-populate-download
| cd /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build && /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/bin/cmake -P /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/ruy-populate-stamp/download-ruy-populate.cmake && /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/bin/cmake -P /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/ruy-populate-stamp/verify-ruy-populate.cmake && /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/bin/cmake -P /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/ruy-populate-stamp/extract-ruy-populate.cmake && /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/bin/cmake -E touch /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/ruy-populate-stamp/ruy-populate-download
| ninja: build stopped: subcommand failed.
|
| CMake Error at /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/share/cmake-3.19/Modules/FetchContent.cmake:989 (message):
|   Build step for ruy failed: 1
| Call Stack (most recent call first):
|   /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/share/cmake-3.19/Modules/FetchContent.cmake:1118:EVAL:2 (__FetchContent_directPopulate)
|   /work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/recipe-sysroot-native/usr/share/cmake-3.19/Modules/FetchContent.cmake:1118 (cmake_language)
|   tools/cmake/modules/OverridableFetchContent.cmake:531 (FetchContent_Populate)
|   tools/cmake/modules/ruy.cmake:30 (OverridableFetchContent_Populate)
|   tools/cmake/modules/Findruy.cmake:16 (include)
|   CMakeLists.txt:197 (find_package)
|
|
| -- Configuring incomplete, errors occurred!
| See also "/work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/CMakeFiles/CMakeOutput.log".
| See also "/work/code/temp/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/CMakeFiles/CMakeError.log".
| + bb_sh_exit_handler
| + ret=1
| + [ 1 != 0 ]
| + echo WARNING: exit code 1 from a shell command.
| WARNING: exit code 1 from a shell command.
| + exit 1

The second error;

tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-download

Check whether there is a zip in this directory, and in the copy to tensorflow pack folder

ninja: build stopped: subcommand failed.
-- Downloading pthreadpool to /work/code/test/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-source (define PTHREADPOOL_SOURCE_DIR to avoid it)
-- Configuring done
-- Generating done
-- Build files have been written to: /work/code/test/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-download
[1/9] Creating directories for 'pthreadpool'
[2/9] Performing download step (download, verify and extract) for 'pthreadpool'
-- Downloading...
   dst='/work/code/test/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-download/pthreadpool-prefix/src/545ebe9f225aec6dca49109516fac02e973a3de2.zip'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/Maratyszcza/pthreadpool/archive/545ebe9f225aec6dca49109516fac02e973a3de2.zip'
-- [download 100% complete]
-- verifying file...
       file='/work/code/test/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-download/pthreadpool-prefix/src/545ebe9f225aec6dca49109516fac02e973a3de2.zip'
-- Downloading... done
-- extracting...
     src='/work/code/test/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-download/pthreadpool-prefix/src/545ebe9f225aec6dca49109516fac02e973a3de2.zip'
     dst='/work/code/test/ver/build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/pthreadpool-source'
-- extracting... [tar xfz]

3. Subsequent errors change in turn.

4. Execute this../cp.sh script during bitmake tensorflow Lite – C compile – V – f compilation, and tensorflow Lite will be compiled successfully.

#!/bin/bash
mkdir -p ./../build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/
cp 54774a7a2cf85963777289193629d4bd42de4a59.zip  ./../build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/_deps/ruy-subbuild/ruy-populate-prefix/src/


mkdir -p ./../build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/cpuinfo-download/cpuinfo-prefix/src/
cp 5916273f79a21551890fd3d56fc5375a78d1598d.zip ../build-imx-robot/tmp/work/cortexa53-crypto-poky-linux/tensorflow-lite/2.5.0-r0/build/cpuinfo-download/cpuinfo-prefix/src/

The difference and usage of insmod and modprobe

Differences between Insmod and modprobe and their usage
(the 2013-01-04 14:55:03)

The reproduced ▼

tag: insmod modprobe driver load driver repeat load insmod and modprobe area hash category: embedded Linux

There was a problem loading the SD card driver into the development board

/ $ modprobe hi_mci

mmc_core: exports duplicate symbol mmc_detect_change (owned by kernel)

Insmod: always insert a `/lib/modules/2.6.24 – rt1 – hi3515v100/kernel/drivers/MMC/cor

e/mmc_core.ko’: Invalid module format (-1): Exec format error

modprobe: failed to load module hi_mci

Mmc_core loads modules twice (once manually and once automatically for the kernel);

The cause of the problem has been found for a long time, and will be manually loaded later
Modprobe hi_mci was changed to insmod /lib/modules/2.6.24-rt1-hi3515v100/misc/hi_mci. Ok, the problem was solved.

Later, the relationship between modprobe and Insmod was analyzed. The reason for the error is that although both modprobe and Insmod commands can load the module, modprobe is relatively intelligent. When you use modprobe to load the module, the system will load other modules according to the dependency of the module (that is, other modules that the module depends on). As a result, the MMC_core module was loaded twice. With insmod, the system loads only one specific module, the one we want to load
Hi_mci.ko, so no more error, error resolved.

The difference between modprobe and Insmod is as follows:

(The following is excerpted from online sources)
On Linux, both modprobe and Insmod can be used to load modules, but modprobe is now generally recommended instead of Insmod.

What’s the difference between modprobe and Insmod?

1. Modprobe can solve the load module dependencies, such as the load moudleA must first load mouduleB, such as it is through the/lib/modules// modules. Dep files to find the dependencies. Insmod doesn’t solve the dependency problem.

2. Modprobe looks for modules by default under /lib/modules//, and Insmod only looks for modules in the arguments given to it (by default, in the current directory). Sometimes, insmod has its USES, for example.

Have/root/my – mod. Ko this module, CD/root /, and then use insmod my – mod. Ko (insmod/root/my – mod. Ko) can insert the module, but with modprobe my – mod. Ko (modprobe/root/my – mod. Ko) does suggest “FATAL: Ko not found”. This is because modprobe is looking for /lib/modules/ ‘uname-r’/to find Module.

Linux device drivers can be loaded in two ways, insmod and modprobe, let’s talk about the differences in their usage.
1, insmod can only load a specific device driver at a time, and the specific address of the driver is required.
insmod drv.ko
2. Modprobe can load all the dependent drivers into the kernel at one time. The address of the driver is not added, but the driver module needs to be installed as make modues_install when installing the file system. Drivers are installed in /lib/ Modules /$(uname -r)/… Under.
modprob DRV

modprobe and insmod are used to load the kernel module
but modprobe is more intelligent, it can be based on the module dependency to automatically load for you;
and insmod can’t do that.
— — — — — — — — — — — — — separation line — — — — — — — — — — — — — — — — — —
for example USES ipmitool this tool need to exist in the dev/ipmi0 equipment, if not you need to load the
modprobe ipmi_si
modprobe ipmi_devintf
Read data from the local KCS interface using -i open for example
ipmitol-i open sensor
You want to uninstall modules. Use the rmmod

 
(the 2013-01-04 14:55:03)

The reproduced ▼

tag: insmod modprobe driver load driver repeat load insmod and modprobe area hash category: embedded Linux

There was a problem loading the SD card driver into the development board

/ $ modprobe hi_mci

mmc_core: exports duplicate symbol mmc_detect_change (owned by kernel)

Insmod: always insert a `/lib/modules/2.6.24 – rt1 – hi3515v100/kernel/drivers/MMC/cor

e/mmc_core.ko’: Invalid module format (-1): Exec format error

modprobe: failed to load module hi_mci

Mmc_core loads modules twice (once manually and once automatically for the kernel);

The cause of the problem has been found for a long time, and will be manually loaded later
Modprobe hi_mci was changed to insmod /lib/modules/2.6.24-rt1-hi3515v100/misc/hi_mci. Ok, the problem was solved.

Later, the relationship between modprobe and Insmod was analyzed. The reason for the error is that although both modprobe and Insmod commands can load the module, modprobe is relatively intelligent. When you use modprobe to load the module, the system will load other modules according to the dependency of the module (that is, other modules that the module depends on). As a result, the MMC_core module was loaded twice. With insmod, the system loads only one specific module, the one we want to load
Hi_mci.ko, so no more error, error resolved.

The difference between modprobe and Insmod is as follows:

(The following is excerpted from online sources)
On Linux, both modprobe and Insmod can be used to load modules, but modprobe is now generally recommended instead of Insmod.

What’s the difference between modprobe and Insmod?

1. Modprobe can solve the load module dependencies, such as the load moudleA must first load mouduleB, such as it is through the/lib/modules// modules. Dep files to find the dependencies. Insmod doesn’t solve the dependency problem.

2. Modprobe looks for modules by default under /lib/modules//, and Insmod only looks for modules in the arguments given to it (by default, in the current directory). Sometimes, insmod has its USES, for example.

Have/root/my – mod. Ko this module, CD/root /, and then use insmod my – mod. Ko (insmod/root/my – mod. Ko) can insert the module, but with modprobe my – mod. Ko (modprobe/root/my – mod. Ko) does suggest “FATAL: Ko not found”. This is because modprobe is looking for /lib/modules/ ‘uname-r’/to find Module.

Linux device drivers can be loaded in two ways, insmod and modprobe, let’s talk about the differences in their usage.
1, insmod can only load a specific device driver at a time, and the specific address of the driver is required.
insmod drv.ko
2. Modprobe can load all the dependent drivers into the kernel at one time. The address of the driver is not added, but the driver module needs to be installed as make modues_install when installing the file system. Drivers are installed in /lib/ Modules /$(uname -r)/… Under.
modprob DRV

modprobe and insmod are used to load the kernel module
but modprobe is more intelligent, it can be based on the module dependency to automatically load for you;
and insmod can’t do that.
— — — — — — — — — — — — — separation line — — — — — — — — — — — — — — — — — —
for example USES ipmitool this tool need to exist in the dev/ipmi0 equipment, if not you need to load the
modprobe ipmi_si
modprobe ipmi_devintf
Read data from the local KCS interface using -i open for example
ipmitol-i open sensor
You want to uninstall modules. Use the rmmod