Android Kernel Modules, Custom kernel - linux-device-driver

Was trying to make custom kernel. After making some changes build a kernel and installd on mediatek device gps, wifi stopped working
checked $ls -la /dev/ no devices found related to gps, wifi and bluetooth, extracted vendor.img and tried to insmod/modprobe the binary files of kernel still showing
insmod: failed to load bt_drv.ko: Exec format error
1|801:/sdcard/Download # modprobe bt_drv.ko
modprobe: /etc/modprobe.conf: No such file or directory
modprobe: /etc/modprobe.d: No such file or directory
modprobe: chdir '/lib/modules/4.4.97'
this errors and i've only vendor image(binary files of modules) not module code.

Since you rebuilt the kernel, you need to rebuilt the module as well, otherwise modules cannot be loaded due to signature mismatch. Since you do not have module source code, you can try to disable CONFIG_MODULE_SIG in kernel configuration to bypass module verification.

Related

Checksum failed 'download/jpegsrc.v8b.tar.gz while installing SDL. How to resolve?

I am trying to install SDL but error with checksum occur:
Building Alien-SDL-1.446
Build option used:
Source code build
z(v1.2.5) jpeg(v8b) tiff(v3.9.1) png(v1.4.1) freetype(v2.3.12) SDL(v1.2.15) SDL_image(v1.2.11) ogg(v1.3.0) vorbis(v1.3.3) SDL_mixer(v1.2.12) SDL_ttf(v2.0.11) SDL_gfx(v2.0.25)
Building Alien-SDL
Fetching 'http://froggs.de/libz/zlib-1.2.5.tar.gz'...
Checking checksum for 'download/zlib-1.2.5.tar.gz'...
Fetching 'http://www.ijg.org/files/jpegsrc.v8b.tar.gz'...
###WARN## checksum for file download/jpegsrc.v8b.tar.gz is 033998fb47d66e1a5e16a51243424be7a172296b but we expect 15dc1939ea1a5b9d09baea11cceb13ca59e4f9df
###ERROR### Checksum failed 'download/jpegsrc.v8b.tar.gz' at inc/My/Builder.pm line 161.
Checking checksum for 'download/jpegsrc.v8b.tar.gz'...
-> FAIL Installing Alien::SDL failed. See /home/kes/.cpanm/work/1634308125.20978/build.log for details. Retry with --force to force install it.
Searching Tie::Simple on mirror index /home/kes/work/projects/SDL/test/local/cache/modules/02packages.details.txt ...
--> Working on Tie::Simple
Fetching http://cpan.metacpan.org/authors/id/H/HA/HANENKAMP/Tie-Simple-1.04.tar.gz
-> OK
How to install SDL?
_build/config_data has the wrong first source set for jpeg v8b. The second source passes the sha1sum, but the first doesn't. If the correct archive is downloaded, the system then hangs up when configuring SDL. SDL_image and SDL_mixer can be manually configured, but SDL_ttf cannot be configured successfully. One should not rely on cpan's sources here. Install all the binary SDL1.2 libraries in a binary distro, also install packages e.g. perl-Alien, libalien-sdl-perl libalien-sdl-dev-perl to have alien installed, and then when it runs the Build.PL for SDL, choose the option to use your own /usr/ libraries (you will see 3 options if it works, choose [1] instead of [2]). Cpan will then succeed with install SDL.
There should be extra instructions with this, that you need to use binary libraries here. Because the script install is super outdated as far as I can tell, if you are running linux that is.

Build a shared library on a Raspberry using Lazarus

I'm trying to build a shared library to use on a raspberry pi (model 3B) using lazarus. After some puzzling I found out that my original library didn't work properly so I switched to a very simple library using this example.
But even this simple library doesn't compile properly to be used. When I try to open the library in another lazarus project it gives me the error:
< libName >: cannot open shared object file: No such file or directory
After some research I found the following diagnostics I could run. The file and ldd command in the compile library:
$file ./libname.so gives:
./libname.so: ELF 32-bit LSB shared object, ARM, EABI5 verion 1 (SYSV), dynamically linked, not stripped
$ldd ./libname.so
not a dynamic executable
I have searched for similar cases and from found that others had this problem when they tried to use libraries compile for a different platform/architecture. I already set the project>project options>compiler options>target platform to OS:= linux and Target CPU family: arm.
The system I am using (using $uname -a):
Linux raspberrypi 4.4.13-V7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux
with distro: Raspbian GNU/linux 8.0 (jessie)
Lazarus version: 1.2.4+dfsg2-1
FPC version: 2.6.4 arm-linux-gtk2
At this point I am not sure what is wrong and why this library isn't working. I can find very little information on this problem (on the aspberry platform and using lazarus) Any suggestions what I could try to make it work, compile it different or do some more diagnostics?
Found the solution. As Marco proposed above: Add initc to the uses part. It seems that if you try to make a library it has to include initc, cmem or LCL to the uses section because the library has to do some memory management for which it needs one of these units.
However this resulted in another error when trying to load the library:
"Undefined symbol: TC_SYSTEM_ISLIBRARY"
This seems to be a raspberry specific problem, compilers on other systems do not give this error. More information can be found HERE.
Eventually solved this by install fpc 3.0.0 compiler on the raspberry pi, compiled it and the library can be loaded properly (but still needs one of the above units).

Building Swift on CentOS

I am building Swift compiler from source on CentOS 6, and am running into a library issue. After fighting with the build script for a while I have got where running ./utils/build-script eventually gives:
+ /home/src/cmake-3.4.1-Linux-x86_64/bin/cmake --build /home/src/swift/build/Ninja-DebugAssert/cmark-linux-x86_64 -- all
ninja: no work to do.
llvm: using standard linker
+ cd /home/src/swift/build/Ninja-DebugAssert/llvm-linux-x86_64
+ /home/src/cmake-3.4.1-Linux-x86_64/bin/cmake -G Ninja -DCMAKE_C_COMPILER:PATH=clang -DCMAKE_CXX_COMPILER:PATH=clang++ '-DCMAKE_C_FLAGS= ' '-DCMAKE_CXX_FLAGS= ' -DCMAKE_BUILD_TYPE:STRING=Debug -DLLVM_ENABLE_ASSERTIONS:BOOL=TRUE -DLLVM_TOOL_SWIFT_BUILD:BOOL=NO '-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64' -DLLVM_INCLUDE_TESTS:BOOL=TRUE -LLVM_INCLUDE_DOCS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINTERNAL_INSTALL_PREFIX=local /home/src/swift/llvm
CMake Error at cmake/modules/CheckAtomic.cmake:36 (message):
Host compiler appears to require libatomic, but cannot find it.
Call Stack (most recent call first):
cmake/config-ix.cmake:296 (include)
CMakeLists.txt:403 (include)
-- Configuring incomplete, errors occurred!
See also "/home/src/swift/build/Ninja-DebugAssert/llvm-linux-x86_64/CMakeFiles/CMakeOutput.log".
See also "/home/src/swift/build/Ninja-DebugAssert/llvm-linux-x86_64/CMakeFiles/CMakeError.log".
./utils/build-script: command terminated with a non-zero exit status 1, aborting
(gcc-4.8.2 was what I compiled llvm with)
libatomic is there:
$ locate libatomic
/opt/gcc-4.8.2/lib64/libatomic.a
/opt/gcc-4.8.2/lib64/libatomic.la
/opt/gcc-4.8.2/lib64/libatomic.so
/opt/gcc-4.8.2/lib64/libatomic.so.1
/opt/gcc-4.8.2/lib64/libatomic.so.1.0.0
I just don't know how to tell the build system where to look. I have tried the usual CMAKE_LIBRARY_PATH (exporting on the command line - I am not sure if cmake works like the way LD_LIBRARY_PATH, LIBRARY_PATH work) but it can't seem to find it.
I also don't have root on the machine.
I had not tried building from source on CentOS 6 until I saw this question, but I have been able to build Swift 2.2 on CentOS 7.1 and Ubuntu 14.04, with partial success. A few things to think about:
You will need numerous dependencies required to build Swift, and unless
they happen to be already on the system, you will need root access to
install them.
Use -R flag with the build-script to create a release build.
Building in DebugAssert (the default) will require a lot of memory. In my case even 14 GB was not sufficient. A release build
can be done with about 6 GB.
As for your specific problem, it is related to Clang's dependency on GCC-related packages for headers and libraries. See, for example, Fedora 21 with clang, without gcc.
Even if you installed GCC 4.8.2 and adjusted the path to use gcc and g++ from 4.8.2, Clang may still be looking in the old GCC directories for headers and libraries. CMake first tries to compile a C++ test file that includes the header atomic, which does not exist in the old GCC. So, it then tries to link a C test program that uses the library libatomic, which again doesn't exist in the old GCC. You can see this by looking at llvm/cmake/modules/CheckAtomic.cmake mentioned by usr1234567. CMakeError.log and CMakeOutput.log can also provide valuable insight. BTW, when I was building Swift on CentOS 7.1, I didn't run into this problem because GCC 4.8.2 was used by Clang for headers and libraries and the atomic header was found, so the C++ file got compiled. However, had the libatomic check been done, it would have failed, because libatomic.so in the repository-provided 4.8.2 has INPUT ( <name of some non-existent file> ), so trying to link with libatomic errors out.
I'm sure there are various ways of dealing with this issue, but what solved the problem for me was setting the following environment variables, please adjust to your specific setup:
export CPLUS_INCLUDE_PATH=/opt/gcc-4.8.2/include/c++/4.8.2:/opt/gcc-4.8.2/include/c++/4.8.2/x86_64-unknown-linux-gnu
export LIBRARY_PATH=/opt/gcc-4.8.2/lib64:/opt/gcc-4.8.2/lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Also make sure that your 4.8.2 version of libstdc++.so is available to the dynamic linker at runtime. Since you don't have root, do
export LD_LIBRARY_PATH=/opt/gcc-4.8.2/lib64
If you had root, you could use ldconfig.
Before you start building Swift, you may want to try building, using Clang, a simple C program linking it with libatomic (the code doesn't actually have to use any symbols from the lib) and a simple C++ program that includes the <atomic> header. When compiling the C++ program, use the -std=c++11 compiler flag. If the C++ program compiles successfully, then it is not necessary for the libatomic linking test to be successful.
Interestingly, the CMakeOutput.log file still did not report finding GCC 4.8.2 as a candidate GCC installation, but the configuration/build worked well past the error.
Hopefully this helps. Please let us know if you run into something else.
CheckAtomic.cmake seems to be part of LLVM. I found a file at Github and it tries to find '__atomic_fetch_add_4' from libatomic
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
This fails for you. Check CMakeFiles/CMakeError.log to get more details why this test failed. Or try this line in a new project.

How to compile zsh on/for an iPhone?

Background
I recently changed from bash to zsh as my default shell and have quickly gotten used to the awesomeness that's added by associated tools (prezto, zaw and zsh-dwim).
I wanted to have a similar setup on iPhone as well. However, only zsh v.4.3.10 is available from the default repos and that's not supported by prezto:
Would you know how I should go about compiling zsh from source for the iPhone? I attempted to use Theos to build something on my Win7 box, but am greeted with the following errors after doing the make package install:
/home/blah/projects/ashrocks/theos/makefiles/targets/Cygwin/iphone.mk:38: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Bootstrapping CydiaSubstrate...
Compiling iPhoneOS CydiaSubstrate stub... default target? failed, what?
cp: cannot stat `_out/*': No such file or directory
cp: cannot stat `libsubstrate.dylib': No such file or directory
Generating substrate.h header...
Making all for tweak ashrocks...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
/bin/sh: theos/toolchain/windows/iphone/bin/armv7-apple-darwin11-clang++: No such file or directory
/home/blah/projects/ashrocks/theos/makefiles/instance/rules.mk:144: recipe for target 'obj/Tweak.xm.666c9a3c.o' failed
make[2]: *** [obj/Tweak.xm.666c9a3c.o] Error 127
/home/blah/projects/ashrocks/theos/makefiles/instance/library.mk:19: recipe for target 'internal-library-all_' failed
make[1]: *** [internal-library-all_] Error 2
/home/blah/projects/ashrocks/theos/makefiles/master/rules.mk:54: recipe for target 'ashrocks.all.tweak.variables' failed
make: *** [ashrocks.all.tweak.variables] Error 2
Would you know how the command line tools availabe in Cydia were compiled ?
It's probably because you don't have the standard libraries compiled for the iPhone on your computer. Try setting up gcc on your iPhone by following these instructions. I have done this and have successfully compile various pieces of software.

Matlab: loading wmv video files

I am trying to load a wmv video in Matlab as follows:
vidObj = mmreader('video.wmv');
However, I receive the following error:
The file requires the following codec(s) to be installed on your system: video/x-ms-asf
I don't understand why I am receiving this error, since I am able to play wmv files on my system. I am running Matlab 7.10.0 (R2010a) on Ubuntu 11.04. How can I fix this problem?
it might be hard to impossible to get this working on a linux system. Alternatively, you could write your own wmv import function (if you know how to talk to the underlying libraries on your linux system, i.e. vlc).
I have received the same error message because of a version conflict for the standard c++ library.
I have started MATLAB in a console window and recognized that Gstreamer fails to load a plug-in.
(:26573): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstffmpeg.so':
/usr/local/MATLAB/2010b/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libdirac_encoder.so.0)
The problem is, MATLAB ships with libstdc++.so.6.0.10 and GStreamer complains that it should work with libstdc++.so.6.0.13
So you should replace the symbolic link in MATLAB dir with the one in your system.
$ rm /usr/local/MATLAB/2010b/sys/os/glnx86/libstdc++.so.6
$ ln -s /usr/lib/libstdc++.so.6 /usr/local/MATLAB/2010b/sys/os/glnx86/libstdc++.so.6