Android Kernel source/revision/config from kernel build number - android

I am working on my hello-android app, which involves using the VpnService class to inspect traffic from specific apps (if anyone knows a better method, please let me know). Doing so requires the TUN/TAP driver, which is not included in the Verizon Galaxy Nexus, emulated Galaxy Nexus, or Verizon Moto X, and is also not available via the Tun.ko installer app.
The android source appears to be a bit of a fragmented mess, and I'm trying to find a good resource for understanding things.
Specifically:
Google maintains 8 kernel source repositories and loosely maps some of the devices to those repositories. Does a more comprehensive mapping exist somewhere?
None of the real-world android devices/emulators I am currently using have a /proc/config.gz. Verizon customer support has encountered this issue before, and indicated that the manufacturer produces the image (Verizon sends their bloatware to them for inclusion). The settings page indicates that the kernel was compiled by a bot within Google proper. The kernel includes some default configs in arch//configs, but using that requires knowledge of the appropriate git branch and also the appropriate config from within that directory. There have been some indications that for a galaxy nexus, one should use tuna_defconfig (though that file is not always present for the arm architecture). Does anyone know of a robust process for determining the correct kernel config to use?
The kernel version (g9f818de in this case) does not appear anywhere in the git logs for kernel source repository (omap in this case, which is supposed to be used for the galaxy nexus). Does anyone know how to map kernel build numbers to a source repository/commit?
Once I find the correct source/version/config, I'll also need to be able to load the module on a non-rooted device. Attempts with test-modules yield either Function not Implemented, or EACCESS (don't recall the message).
edit: The build number -> tag mapping indicated in https://source.android.com/source/build-numbers.html does not appear to apply to the kernel sources (at least not the omap repository)
Any pointers to thorough and accurate documentation would be appreciated.
Edit - Partial resolution to original problem, but questions remain
I spoke with the guy who wrote the OpenVPN app, and he was kind enough to point out that:
Basically all 4.0+ should work out of the box with the VPNService API.
Also the Android 4.4 emulator is broken.

Related

How to determine which AOSP branch is compatible with which device from branch / build name?

I am trying to build AOSP for nexus devices.
The following page has a list of Source Code Tags and Builds:
https://source.android.com/source/build-numbers.html
You will notice that there are multiple builds / branches for the same device. What is the difference ? Is it because of hardware differences between different models of a nexus device (Eg: 16GB vs 32GB etc / Different LTE Bands) ?
How does one determine which branch will be compatible with a given device ? For example, if I synced MRA58K, and purchased a Nexus 5 D821, how will I determine that they are compatible ?
To understand what builds goes with what device you might be better off going to the Nexus Factory Images page. Each device has a 'code name' which as you guessed referred to particular models. For example the Galaxy Nexus had 4 versions due to a combination of radios and Google Wallet capability.
Once you know what device/devices you have for building from AOSP you'll need the proprietary drivers from Nexus Driver Binaries. Or extract them from a stock device.
It may also help to read: Android device configuration for AOSP
If you are trying to figure out what was the difference between branches i.e. between say 6.0.0_r1 and 6.0.0_r2 - 'git diff' is the tool. Unfortunately I'm not aware of any official summary of what goes into a branch.
On this page: https://source.android.com/source/build-numbers.html
You can choose any build, that supports your device. It is unclear what the difference between two branches is, but for example, I had no problem building MRA58K and flashing it to my nexus 5. Things seemed to work.
I also directly flashed the factory image for MRA58N on my device - again everything seemed to work.
I guess in general:
If the version number is different, then there are probably bug fixes, optimisations, etc.
If the version number is the same (but the build number is different), then it is unclear what the changes are, but you can probably flash both.
But since downloading a branch consumes a lot of bandwidth, in future I would just download the branch with a HIGHER build number, under there is a specific reason (you would know this if it mattered) to download the branch with a lower build number.

Linux or Android Driver for KR070PC7S LCD Display

I'm trying to build an android linux kernel for an amlogic meson3 processor. Specifically the current running Linux shows the display configuration is
CONFIG_AML_TCON_KR070PC7S
When searching on google, it turns out to be a "60P LCD screen KR070PC7S". However, it seems google does not search the source code repositories around the web to give an answer.
Thus the questions:
Where you can find the driver in source code? Or in pre-built obj binary?
Where you can find the datasheet of the LCD if the driver is not available?
Which other devices (model, brand) use the same display?
Is 60P LCD a standard interface? Where is the spec?
Thank you in advance for any answers or hints.
Google does normally index CONFIG_xxx in parts of the Linux mainline kernel OK. I suspect you're running a custom kernel where they haven't merged it back into the mainline and haven't placed the source in a publically indexable area.
There is nothing wrong with the latter under the terms of the GPL as far as I know, but the original hardware vendor should make the modified kernel source available to customers upon request assuming they have based the driver on GPL code. Otherwise they have no obligation to provide datasheets / code etc.

Guidance regarding Android Kernel Porting from one device to other

I own a Samsung Galaxy 3 and want to port kernels available for other Android Devices. I have all building environment ready. I have C knowledge also. What exactly I dont understand is how and what all things porting involves, which codes should be modified in what way?
If someone could help me. It would be great.
Thanks in advance.
Ok I got it. But the real problem is I dont understand one thing.
What needs to be changed in the source code so that to make it compatible in other device? Can someone explain me that?
Idolon gives a good suggestion. In theory what is written there is true. In practice, it's a little more involving. I've been porting Android Kernel for months now. My goal was to have a custom S5PV210 processor module on my custom board with my custom I/O. I have the source code for Samsung's galaxy tab and several Samsung's android smartphone as well as a few versions (Froyo, Gingerbread) for the Samsung's Evaluation board (SMDKV210 for S5PV210 CPU). FYI, S5PC110 is a close derivative. Here is what I found out.
Eventhough all the device drivers are supposed to be built in a very modular way and independent from each other and you should be able to replace them with similar devices, the way Samsung did it is not exactly that. To give you one example is about power management. In many low level drivers dealing with hardware devices, it calls some specific routine for other hardware devices like power management chip. So, When you change the choice of drivers in the "make xconfig" or "make menuconfig" it will remove the source code of what you don't want and add the one you want but, there are still other modules that are calling the low level function you removed. When building, you will get tons of unresolved external because you removed a power management chip that your hardware doesn't have but is used in the source you started with. I looked through several Samsung's device source code and they have branched very early on. They have been adapted by different teams and it would be a major amount of work to go from one device to the other from one source kit.
Here is how I succeeded: I bought an S5PV210 evaluation board with an already ported Android Kernel (Gingerbread). All the power management and inter dependant issues where already cleaned-up. Then, form a working kit, I could change the device I needed (the one you can't buy without a 100K unit/yr commitment) without getting stuck with the interdependancy. Then I could even change LCD resolution (from 800x480 to 1024x768), touchscreen, Cell modem etc etc. The whole thing takes about a month worth of work with only one guy (me).
Starting with a Galaxytab or other commercial device made me waste months of headakes with no useful results but the thing I've learned.
There is one requirement to succeed on my approach. You have to know the hardware you are working on. As an example, you need to know what touch screen your hardware has (chipset) to select the driver and were is it connected to hook it up to the right device (USB, Serial etc). That the same thing for all other devices (power managemnt chip, keypad, backlight, LCD etc etc)
Hope that is useful to give you an idea of the work involved and how you can do it.
You should take a look at the cached copy of Android Platform Developer's Guide and at android-porting google group.
There is also an old but useful article about porting Android to Nokia N810, which will give you some hints about Android Linux kernel porting.
I am also into android porting stuff for quite some time I suggest the following route :
Read
You need to have basic knowledge of android porting and AOSP source code, directory stucture hierarchy.
I suggest you to start reading https://books.google.co.in/books/about/Embedded_Android.html?id=plHsngEACAAJ&hl=en
and also refer https://source.android.com/devices/index.html as good guys pointed out you can also google android porting related groups and become a member there, if you are stuck on a issue there are chances similar issue might have been faced by someone else previously.
Observe
AOSP code :
Parallely you need to dive in to the android source e.g from links like https://android.googlesource.com/ observe which components are placed where in the source code, what are the updates from previous android release (like ART replaced dalvik in LL), at top level there would be generic code, code specific to your hardware called HAL in hardware/ and device/ folder.
Kernel code :
In the kernel also you need to observe the directory structure and know which things lie where like SoC specific code will be in arch/ directory defconfigs (used for selecting kernel configuration) will be arch//configs/ directory.
Also there are good books available for linux kernel, you can google them and start reading them also.
While porting kernel you need to take care of following
1.If in the new kernel there is already support of SoC which is used in hardware to be ported then you need to add only device specific changes like suppose you want to port new kernel version to samsung galaxy s3, you can take a reference android kernel having exynos support and then you need to make changes only for adding support for samsung galaxy s3.
For that you need to have reference of some old kernel having support of s3, from there you can study patches which have been added to add support for s3 and port those patches to newer kernel.
Experiment
First you can only port the bare minimum changes required to up the platform, compile and flash it on your platform, then observe the output, if everything looks fine than go on for next changes otherwise try to solve the issue.
Thanks,
Devarsh

Openess of source code/drivers android phones

How open is the source code of android phones? I cannot think of a way that manufacturers can close their drivers, because they have to conform to the GPLv2 as the License of the Linux kernel states. Or do they use write a large part in user space code, where they can choose their own licence?
The information I'm trying to get here is: How difficult is it to get a "cheap" smartphone (htc wildfire-s) and run Linux on top of it full featured. What I mean is every hardware feature is easily accesible without having to implement your own drivers and reverse engineer the device (assuming that the device is rooted).
HTC has the developers area:
http://htcdev.com/devcenter
The kernel sources for the HTC wildfire you can also download there:
http://htcdev.com/devcenter/downloads
Note that not all the functionality is included in the kernel. To add functionality to your system you also have to install basic programs like a shell.
The Android system image already contains all necesary programs to run your system and som Android stuff which is not needed for a Linux-only system.
As an alternative you can have a look in the android source and remove all the unwanted programs from your custom android build.
http://source.android.com/source/initializing.html
I think I found my answer at last. A lot of firmware of a lot of android phones is delivered binary only. Which makes it less open. If I want to run GNU/Linux on top of a stock phone I run in a lot of those issues. See Richard Stallmans article on how free android is:
Is Android really free software?
There is also a project Replicant which tries to create a free (FSF definition of free) android based stack.

Build android system from source

I've recently purchased Samsung Galaxy Android phone after using Openmoko phone for 2 years.
One of the reasons for choosing Android was is that it's open sourced.
I don't want to depend on phone maker to provide updates for my phone. I'd like to do it myself.
Right now I'm in research stage if it's worth the time or not. So here are the questions:
I found some tutorials for building ROM images from source. They tell that Android build script will ask for make of the phone before building kernel. Does it mean that all the phone specific stuff is handled by the script or I will have to do some voodoo before I can flash it onto my phone?
Drivers. How are they handled? Are they included in the source as binaries and added automatically (question 1) or will I have to dissect old firmware to get them and put in my build? I realize that would mean some problems with module/kernel versions compatibility.
Is there is something I'm not aware of that would prevent me from building my custom firmware or make it very time-consuming?
I'm not afraid of installing SDK's and toolchains, after all I'm an Openmoko owner.
It's gonna be a little more complicated than that.
On any consumer Android phones I've seen, the user doesn't have root access to the OS. So step one, would be finding an exploit to get root.
Even after you get root, all consumer Android phones "lock" the bootloader to prevent unauthorized OS images from being booted.
The Android OpenSource project only contains device drivers for a small number of phones (Google dev phones, possibly the Nexus One?). For other phones, the drivers are proprietary binaries that the manufacturer loads on the phone. They generally aren't available separately.
Even with all of those obstacles, some enterprising smart guys have managed to create custom "ROM's" that blend the OpenSource release with drivers ripped OEM install on the phone, etc. CyanogenMod is one of the best known and is available for several different Android devices, but unfortunately the Samsung Galaxy does not currently appear to be one of the device supported by Cyanogen.
I found an old link here to a guide to getting root on the Galaxy and loading a custom ROM on it, but unfortunately the ROM they link to doesn't seem to be actively maintained anymore. It might be worth doing some more exhaustive google searches to see if you can find anyone doing active development on the Galaxy.

Categories

Resources