Adding driver to android devices kernel - android

I would like to use a PCAN with my device.
I have the program for it, and an otg cable, but i need to install the driver first.
And i found a linux driver on the manufacturers site.
I downloaded the kernel source, arm toolchain, and read a few sites about building and compiling but i havent find anything about adding driver.
So my question is, how can i add or install this driver on android?
The device is galaxy tab 10.1 P7510.
Thanks for your help.

Right, what you need to do is this:
Unzip the tarball source
Go into the respective directory of the source - cd peak-linux-driver-7.7/ as quoted by the above PDF
cd peak-linux-driver-x.y
make clean
make su -c “make install”
When the build completes, issue this command
/sbin/modprobe pcan
However, having stated this, I do not see any reference to building with Android, so it looks like a fair bit of messing around with the source to get this to actually work on Android.
From what I can ascertain, this is more orientated towards the desktop PC only...
As is mentioned in a later comment clarifying this answer; the kernel would need to be recompiled from source as an arm v7 or v8 target.
The part not mentioned was that it would also have to be statically linked to avoid requiring glibc in Android or bionic lib c in your computer.

Related

How to build for Qualcom Snapdragon 800 msm8974 chip on Samsung Note 3

Hi I have been working on compiling an android image for my Samsung Note 3. Basically I downloaded the source from Samsung, which directed me to download a version of Android Open Source Project code. I then followed the procedures in the readme files provided. But there are some discrepancies between the procedures and tools to be used from Samsung vs. Qualcomm's documents. My question is about finding the right procedure, and get a working image. I have followed the Samsung's procedures, and they have not resulted in a working image as of now. I tried to flash the boot.img file I created, and collected the recovery logs which are posted here I could be doing something wrong though; I am not saying the procedures are wrong. So here are the issues I am struggling with:
1- Samsung's readme file says to download arm-eabi-4.7, while Qualcomm says to used 4.8 with their compiler add on llvm. As of now, I plan to try llvm with 4.7 and 4.8 and see what happens. I have already tried 4.7 w/o llvm and it has not helped.
2 Samsung procedures state to update the CROSS_COMPILE statement with the path to above arm-eaby-4.7 executable, export ARCH=arm, then create a config file with the following statement:
make VARIANT_DEFCONFIG=msm8974_sec_hlte_spr_defconfig msm8974_sec_defconfig SELINUX_DEFCONFIG=selinux_
defconfig
and then run make. While Qualcomm's llvm readme file states to issue the following command:
ndk-build NDK_TOOLCHAIN_VERSION=snapdragonclang3.6 APP_ABI="armeabi-v7a"
-C <some_project>
I know I have to have a path to ndk-build script and I know where it is. What I do not know is
1- If Samsung's procedures run ndk-build also. I looked through the Makefile in the project's root directory and do not see any reference to it. Would the arm-eabi-4.7 run ndk-build perhaps?
2- What is the best way to get to a working image for me? I do not see the NDK_TOOLCHAIN_VERSION and APP_ABI variables in the Samsung's .config file. Can I set these as environment variables?
3- Samsung's procedures state to set an environment variable of ARCH=arm, while Qualcomm's configuration passed to the ndk-build is armeabi-v7a
4- Qualcomm's procedure calls for a project name. Is this something generic or would I find it somewhere in Samsung's files? I did a search in the .config and Makefile and did not see any reference to it.
5- Are there any tags I should add to this post to get the attention of right folks who know and deal with questions like mine stated above?
#jww - Thanks. I'll try the procedure, and I am going through the material you shared. I hope I can have my other questions above addressed also.
Update - Hey I noticed I did not get any reply about actual issue. Another question I wanted to ask is if it helps to build an image, which provides more information about what is wrong with my image? Do I do that via the config command?

Building cyanogenmod for grouper does not create the CM-*.zip

I followed the instructions in the cyanogenmod wiki page to build a custom ROM for grouper (Nexus 7 wifi only model). However, the CM-DATE-UNOFFICIAL.zip file is not created. I get this error message --
No private recovery resources for TARGET_DEVICE grouper.
I followed the answer in this link to add below line
TARGET_KERNEL_CONFIG := cyanogenmod_grouper_defconfig
to ~/android/system/device/asus/grouper/BoardConfig.mk and did "make modules" and "make grouper_defconfig", "make grouper" to no avail.
From further research, I found that I might be missing the kernel. I followed the android documentation on building the kernel. However, this also did not solve the issue (I might have not placed the kernel at the right location). Can someone tell me what I am missing?
I was able to generate the zip file. The main issue was that Ubuntu by default uses OpenJDK while Cyanogenmod needs Oracle JDK. Downloading and using Oracle JDK and following rest of the steps mention in this xda-developers forum thread generated the zip file. Also make sure that you have plenty of swap space (atleast as much as your ram or twice of that if possible)
Another thing that is not mentioned in the wiki for building Cyanogenmod is that the kernel has to be built first. I followed this link to build the Android kernel.

How to stress test ext3 partition on android?

I've had several errors in kernel logs on device boot after all partitions were mounted.
ext3_free_blocks_sb: bit already cleared for block ######
After searching I've discovered that a bugfix for the same issue was already integrated in the kernel.
Then I've searched for similar commits on repository and didn't find anything so it seems like the bug was fixed on the mainstream and the issue is Android-related.
From the discussion on RedHat bugtracker about the bug I discovered that it can be reproduced with stress-test utility. Unfortunately, I don't know any of these for ext3 on Android.
The main difficulty with porting such diagnostic tools to Android is it's reduced kernel functionallity. In this case there is a bunch of filesystem stress utilities for regular linux:
Bonnie++
dbench
fsstress and other tools included in LTP
etc.
Most of them require specific headers or BASH script features which are missing in Android.
After rewiewing available set of tools in filesystem test case of LTP I came up with the following approach:
Find a tool with minimal subset of scripts, headers and syscalls.
Compile it using Android NDK.
Install BASH for Android to run required scripts.
Replace missing commands with their' Busybox equivalents.

How can I compile Dalvik to run it locally on Linux?

What are the minimal steps necessary (including retrieving the source code) to compile and run just the Dalvik virtual machine on Linux?
Actually , I got Dalvik working on my elementary OS installation.
First download the Android AOSP source tree using https://source.android.com/source/downloading.html. Wait for it to download (2 hours for me cloning only the current commits and Marshmallow branch)
After running build/envsetup.sh while in the source tree run lunch full_x86-eng. Then type make -jN (replace N with number of cores).
WAIT. This took me about 1 hour on an AMD-4500M laptop. Newer ccomputers may be as low as half and hour and older ones might take half a day.
Change directory to !!AOSP-PATH!!/out/host/linux-x86/bin/ and run export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/obj/lib/ or
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib
or export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib64
TRY ALL OF THESE
and then
./dalvikvm --32. If you try to run without the --32 option it will crash (don't know why)
Working Marshmallow Dalvik. To get the GUI apps working you will need to do some more porting and coding which is another project which I am working on.
Took me half a day to figure this out.
References
http://milk.com/kodebase/dalvik-docs-mirror/docs/hello-world.html
Use sabayon Linux. This is a distro that can natively run Android programs and all Linux ones too.
Actually, that's rather android running on Dalvik and the underlying system is already linux.
I guess running a bare Dalvik VM on a desktop linux box is just a matter of getting the sources and compile it.
The GUI stuff is something else.
You are not the only one with this idea, and that is great in internet society terms.
This is probably what you are looking for: http://www.android-x86.org/.
Those guys ported android over to x86.
It still works as an OS, so I'm not sure if you can run Linux and Android(Linux) together without using VirtualBox.
Dalvik runs on Android. The authors of Dalvik are only worrying about it running on Android, as far as we are aware.
Various groups have indicated they are working on getting Dalvik outside of Android. You are probably best off finding and talking to them.
In other words, there are no official instructions of the type you seek.
Sorry!
Getting apps designed for Android to run on Linux is going to be tricky. However, it is possible to run a Dalvik VM on Linux. In fact, this GitHub project has a pre-compiled binary of Dalvik VM for Linux, ready to use! Check the associated blog post for information about how the binary was compiled and how to use it.
Learn to program Java \ C \ C++ and other frameworks
Modify the Android source (I think app_process or something) so it shows a windows on the Linux desktop (learn X11 / Wayland APIs)
Below is a simpile base for you to start with
www.android-x86.org/getsourcecode
Getting Android-x86 source code
First, follow this page to configure your build environment. Then
mkdir android-x86
cd android-x86
repo init -u git.android-x86.org/manifest -b $branch
repo sync
Where $branch is any branch name described in the previous section. This will point the projects created or modified by android-x86 to our git server. All the other projects still point to AOSP.
We also have a git mirror server on SourceForge.net. To use it, you only need to change the repo init command to
repo init -u git.code.sf.net/p/android-x86/manifest -b $branch

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error:
/c/Users/Andrew Rabon/bin/repo: line
23: exec: python: not found
I've downloaded repo and put it in ~/bin like it says, and I've installed Python. I wonder what the issue could be.
For reference, I'm using msysgit on Windows Vista, I understand msysgit is limited, but I hope it can at least pull the android source.
I ended up creating a VirtualBox vm with Ubuntu installed. Followed the directions on the source code site and then zipped up the source and copied it over via file share to my windows machine. It's a bulky solution but it's the most straightforward as you don't have to deal with cryptic scripting issues.
I imagine that you could make msysgit and repo work with some tweaking,
In particular, I think there is an advantage in using Cygwin. It seems to have superior handling of case sensistive file names. This might be irrelevant for the main Android code base, but I know for a fact that it is necessary for the Linux kernel.
You cannot build Android on Windows. However, you should be able to use repo to pull the source code. I've done this. I imagine you must be using Cygwin. You'll need Python 2.4 (according to Get Source) and make sure you don't have any other Python installations on Windows or Cygwin that are overriding it. Check your version using the python interactive shell.

Categories

Resources