building a kernel with device driver - Android Software Development

Hi,
I am new to the android development and a bit confused from all this (root, no root etc).
Say I want to write a new kernel driver to handle keyboard input, and want it to run only on my phone. And my phone is not the developer phone, nor exploitable for root privilege escalation.
Can I download the source files and compile a new kernel with my driver? I guess I cannot use the Android sources, but need my phone specific branch. e.g if I own an HTC Hero I need to get the specific sources from HTC, and they don't publish kernel sources for all their models...
But if I found the source, add my sources and compiled it, It should be easy (and legit ) to load the new image to the consumer phone right ?
Thanks
Roee

More or less that is correct. The source code will contain the license terms, if it says GPL then you are golden. If you get the source from a questionable route and it's not necessarily "public" then it goes into a gray area. Generically speaking, if you get the Android source, and the source code for your keyboard, build an image with it, flash it to your phone, then you are perfectly fine. If you choose to redistribute that code that you mashed together, it's arguable you'd then also have to publish your mashed up code or at the very least the 2 sources you used to mash it together. Mash is the best word I can think of right now
-Chad

Thanks for the reply Chad.
If the software is GPL, and I don't intend to publish the code, I just want to play and check couple of things.
I wonder if i can only compile a new keyboard driver (for example), and just load the ko file somehow without flushing the whole kernel.
I don't have much experience in the linux world, but I would guess it will be something like :
get the branch from the android git
compile a new kernel object for the keyboard
use adb to load the ko file to the device
insmod the new device
somehow remove the current keyboard device and map a new device with the new kernel driver
is this the correct flow ? is there example of how to do it somewhere ?
Cheers
Roee

Ok, I think I have a little better understanding after I played with my G1 today...
So now I understand how to enumerate all the devices in the system, and find the proper devices (e.g using cat /proc/bus/input/devices , or in /devices/virtual/input/ ), but I fail to understand how to replace the proper lkm module. When I run lsmod, the only module loaded is the Wlan module.
How can I find which file is responsible for the keyboard and replace it with my driver? Or must I recompile the whole kernel in order to replace the driver with my modified driver?
I guess it became an easy linux questions.... (just not easy for me )

Related

Adding driver to Android

Hello, I found a driver online that I want to add to my Android phone. It is a DisplayLink device driver.
magoroku15/DisplayLink-driver-for-android (from github)
The part I am confused about is how to go about adding the driver to my phone. Do I need to download the Android source code, add the driver to that, and then build the whole thing? Or is it possible to just load the driver as a module?
I've searched Google but haven't found anything definitive. I'm not even sure if I'm using the right terms here, as I haven't ever played around with adding drivers to anything before.
Any help would be greatly appreciated!
yes. i would also like to know how this is done.. please share. thanks
me 3! tell usssss
you would need a dev environment setup to cross compile for that device (your phone) then compile the source as a module and load it from a command line. (insmod <module>). if you get a new line in the terminal without error, its loaded.
thanks! ill try this later..
nenn said:
you would need a dev environment setup to cross compile for that device (your phone) then compile the source as a module and load it from a command line. (insmod <module>). if you get a new line in the terminal without error, its loaded.
Click to expand...
Click to collapse
What if you don't (or don't want to) have root access on the phone?
well this guy in his thread is loading a lot of drivers *.ko i thing?
helpful?
*edit* forgot the link
http://sven.killig.de/android/N1/2.2/usb_host/
Any answers?
I'm looking for the same thing: I want to install a new driver on Android devices, but I can't Root the devices - I need to add the driver(s) to stock Android installations.
Just curious.. why do so many ppl seem to add driver to their system? :/
My task is similar to noted earlier.
I want to make "virtual driver". In other words, the device doesn't have specific hardware and I need to emulate it programmately.
Any hints and links would be useful.
Thanks.
jkoshi said:
What if you don't (or don't want to) have root access on the phone?
Click to expand...
Click to collapse
I think you would need root access on your device in order to load your kernel module: 'insmod your_module.ko' or whatever.
- jc
Hey i was looking to do this exact thing so i could connect a mimo monitor to my phone any progress or step by step instructions
Subscribed
you need to have right kernel module compiled on the same kernel version that you android is running on.
it is a may be not only *.ko file, but it may need also another firmware files.
if it is only one file, you are lucky, you need just that ko file with right kernel version and put to vendor directory with modules.
and if not automaticaly loaded, you must call insmod command from rc file on device boot or manually from terminal.
better solution is to compile kernel yourself with driver inside it.
for details see 'linux kernel modules'.
Note: for sure you need root access to such as system modify operations...
And here : https://hex.ro/wp/blog/compile-an-android-kernel-module-outside-the-kernel-source-tree/

Building the Kernel from Samsung's Open Source Site?

Has anyone successfully compiled the kernel and opensrc directories from the download from Samsung's Open Source site? I am running into compiler errors for things like xt_CONNMARK.c since the file doesn't exist in the source tree. Is the Galaxy i9000s download actually compilable, and is it actually compatible with the Captivate?
Thanks,
-Atin
Oh cool, I had no idea they had the source available. Samsung just got a lot more awesome in my book. I'll be looking into this when I get back to a computer, and hopefully devs can do something interesting with it.
From my understanding of previous Samsung phones and there source code its that the source code provided is not complete. Anything proprietary is not included which includes some drivers and some extra bit of code.
I don't know if they skipped stuff but I do see binary modules, so maybe they did put every thing out, just didn't open source every thing. Given that we can still link the binary modules, this shouldn't be a problem just like under linux. My problem is more simple, the danged code won't compile because either the config or the dump itself is incorrect (missing files like xt_CONNMARK.c which is gone in later versions of the kernel, but should still be present in what they dumped).
atinm said:
I don't know if they skipped stuff but I do see binary modules, so maybe they did put every thing out, just didn't open source every thing. Given that we can still link the binary modules, this shouldn't be a problem just like under linux. My problem is more simple, the danged code won't compile because either the config or the dump itself is incorrect (missing files like xt_CONNMARK.c which is gone in later versions of the kernel, but should still be present in what they dumped).
Click to expand...
Click to collapse
If they handled the Galaxy S like they do other phones then I believe Eugenes comments apply here
http://forum.androidspin.com/showpost.php?p=12840&postcount=13

Wanted: Compile for Android ON THE DEVICE!

Way back when, I could run a c# compiler on my Windows Mobile phone and create apps. I think it would be fun to do on-device "compilation" on my Desire Z too.
I'm not asking for an IDE -- just something that can take Java source code and XML files, compile to bytecode for Dalvik and produce an .apk -- all on the device itself.
Is this possible?
OK -- we'd have to both a javac (java compiler) and a dx tool running on the device to do this. The first compiles the java source, the second takes that file and converts it to Dalvik bytecode.
Anyone else interested in this?
I'm very interested too. I tried sl4a but it's limited for now.
Sent from my Desire HD using XDA App
Dexify java compiler
I'm also very interested!
I develop in Java for the Eve VM on Windows Mobile: [www t-arn com/software.htm]
but for this I needed to install a JavaVM on the device.
But it should be possible to dexify the java compiler. I found following post:
[www ist-music eu/developer-zone/documentation/phoneme-and-osgi/music-on-android]
The porting of OSGi requires the dexification of the OSGi bundles. This is a process which makes any JAR file (compliant with Java VM) compatible with Dalvik VM. It basically consists on adding a new file, classes.dex, into the JAR file. To dexify each OSGi bundle, a two-step process is required by using the Android SDK tools. In windows, the process would be:
* Create the classes.dex file associated to the JAR file:
[ANDROID_SDK]\platforms\android-1.5\tools\dx.bat --dex --output=%CD%\classes.dex my_bundle.jar
* Incorporate the classes.dex file into the JAR file:
[ANDROID_SDK]\platforms\android-1.5\tools\aapt.exe add my_bundle.jar classes.dex
Now, the dexified bundles work on both VMs: Java VM and Dalvik VM.
Click to expand...
Click to collapse
I guess, we could do that for javac. If this does not work, we could try another Java compiler:
- EJC: [thecoderlounge blogspot com/2010/05/ecj-eclipse-java-compiler.html]
- kopisusu: [klomp org/KopiSusu/download.html]
I have no idea how to dexify the dx tool, though :-((
Hope to hear more from you guys
Tom
I have not yet gotten the Android SDK (nor a device...) but it seems that the dx tool itself is written in java. There is a dx.jar in the SKD. This one might already be dexified...or we could dexify with itself.
Tom
On-device development & compiler on a server...
Hi guys, I'm new to this Forum - just got my Archos 101 and now I'm searching for some more fun with it ;-)
So I really liked you guy's idea of having a compiler on the device itself - especially since the java compiler's really fast, so no doubt it can run on a smartphone...
I was really tempted by the open source "Open Blocks" library (education.mit.edu/openblocks) from some of these "Lifelong Kindergarden" people at the MIT... they're having this neat programming environment for teaching children programming, where you can drag/drop your source code like Lego...
Here you can have a look how the programming looks:
education.mit.edu/webdav/How%20to%20Create%20a%20Procedure/How_to_Create_a_Procedure.html
Now even google is using a similar thing, probably the same sources for their "App Inventor" (appinventor.googlelabs.com/about/), but you can only develop online at a real pc, then the .apk file is packaged on the server and downloaded to your android device...
So that's practically another way of having stuff compiled "on your device" - you could do the the development on a device and then have a server dedicated for a fast compiler and dx run...
Basically, I'd say that's the perfect system to write quick programs on a touchscreen device, especially when it's a bit larger tablet...
So if anyone wants to join in, I think I'm really keen on trying to port this OpenBlocks thing to the android screen ;-)
Cheers,
wowbag
Java IDE on Android
Hello everybody
I have just finished the latest version of taJavaIDE (0.3.0)
This APK is meant to become an Android development tool with which you can create native Android apps (APKs) ON the Android device itself.
What is working so far (on my Desire HD):
- Eclipse compiler for Java is integrated and working
- dx tool is integrated (not yet tested properly)
- BeanShell Interpreter is integrated and working.
You can write your own BeanShell script, store it on your SDCard and automate
the build process with it.
What is NOT yet working:
- aapt
- apkbuilder
- jarsigner
- zipalign
apkbuilder and jarsigner should not be a problem. I think, I can integrate those in the same way I integrated ecj.
As far as I know, zipalign is not absolutely needed (I might be wrong here, though).
My biggest problem is aapt which is not a Java application but a C++ application. To make it run on Android, you would need to port it to Java (looks like a REAL challenge!) or use the NDK to create a native library that you could then access from the APK.
I have no experience with the NDK and I also don't have the necessary build environment, so I would really appreciate if someone would help me out here!
Anybody interested in contributing?
Tom
Wow, thanks for getting this started, t-arn!
It's been forever since I did any C++, but I'll take a look at aapt and see what I can figure out.
Hopefully, a true C++ programmer will come along and set us straight
I'm very interested in this project and I would be willing to try to help out if you need it. I'm a second year software engineering student and I'm currently on a work term where all of my work is with android. I may not be of much help but at least I think I have some idea what I'm doing so let me know.
you are correct in saying that zipalign is not necessary. we only need it if we want to sign the apk in release mode(for publishing it to the market). We could just use debug mode and everything would be fine. I'm sure that if someone wanted to release an apk to the market, they could just copy the files over to their pc and zipalign it there. We would still be able to use the apk on the device without using zipalign.
t-arn said:
- jarsigner
Click to expand...
Click to collapse
Serison has an application on the market to sign APK's. Just thought I would let you know it is possible.
I would like this as well, as my phone has a physical keyboard and typing code isn't that bad on it - atleast not for minor edits/tweaks
JavaIDEdroid open source project
Hello everybody
I have created an open source project for JavaIDEdroid:
http://code.google.com/p/java-ide-droid/
Everybody is welcome to join the project (and hopefully contribute to it!)
As soon as I have cleaned up the code a little bit, I'll upload the source and the current APK.
For further questions and discussions, please join the java-ide-droid group. You'll find the link on the project's home page.
See you there!
Tom
Sounds pretty promising,looking forward to give it a try!
Sent from my Dell Streak using XDA App
Sounds possible, if you have the right components. I would love this. Would definitely donate to whoever got it working easily and 100%.
Very interesting project
Look nice. Downloading now.
I have wanted this since I first got an android phone.
I ended up using a virtual debain command line running OpenJava to compile and run the stuff. But if i can do it without that hastle in one app, I will LOVE you.
Edit: I tried it out. Mind explaining how to make a beanShell script? on the ECJ it always gives me a security exception even with just -help.
Code:
java.lang.SecurityException
at java.lang.System.setSecurityManager(System.java:610)
at com.t_arn.JavaIDEdroid,.DE.fnCompile(IDE.java:44)
at com.t_arn.JavaIDEdroid.MainActivity.fnCompile(MainActivty.java:167)
at com.t_arn.JavaIDEdroid.MainActivity.tabCompile_btnCompile(MainActivity.java:137)
......
Done in 1305348377 sec.
Please join the JavaIDEdroid support group at http://groups.google.com/group/java-ide-droid and re-post your question there.
I'd like to keep discussions there.
Thanks
Tom
very interesting, ill join the group, i can make the native lib for the aapt.
I would say get gcc working on the device then you can compile anything. You can compile a javavm. A native binary. Etc. If gcc can be compiled and work then all programs most likely can be compiled on the device assuming the proper libs are there to compile against.
Sent from my Incredible using Tapatalk

I want to use the A101 as a BeagleBoard-like

Hello! I've been just a reader for some months, my questions have been always already answered here for basic things (rooting, performance tips etc) but now it's the time to register and start participating I am a professional programmer, just have been "out" of the development world for the last 1+ year, so I'm a bit untrained now...
I was thinking on buying a BeagleBoard for trying some programming in it, just wanted to see what's the power of that board when doing image processing stuff (namely playing with OpenCV). But, before spending those $130 in one, I realised that my Archos A101IT has almost the same board (SoC), well actually even a bit faster (BeagleBoard comes with OMAP3530 while A101IT comes with OMAP3630).
The BeagleBoard works with a linux Kernel for the OMAP architecture, so what would be the closest to bare-bones thing I could get for the A101? If this was Desktop, I'd answer "Debian with the lightest Desktop setup and OpenCV libraries installed", but in this architecture I'm lost.
I see a lot of "custom kernel for you", "Ubuntu over Android" and stuff like that, but I don't get if that's what I'm looking for or just that people here are building replacements to the underlying Android kernel. As you see I'm not interested at all on the Android part of the A101.
Hope you can give me some orientation...
juannm said:
Hello! I've been just a reader for some months, my questions have been always already answered here for basic things (rooting, performance tips etc) but now it's the time to register and start participating I am a professional programmer, just have been "out" of the development world for the last 1+ year, so I'm a bit untrained now...
I was thinking on buying a BeagleBoard for trying some programming in it, just wanted to see what's the power of that board when doing image processing stuff (namely playing with OpenCV). But, before spending those $130 in one, I realised that my Archos A101IT has almost the same board (SoC), well actually even a bit faster (BeagleBoard comes with OMAP3530 while A101IT comes with OMAP3630).
The BeagleBoard works with a linux Kernel for the OMAP architecture, so what would be the closest to bare-bones thing I could get for the A101? If this was Desktop, I'd answer "Debian with the lightest Desktop setup and OpenCV libraries installed", but in this architecture I'm lost.
I see a lot of "custom kernel for you", "Ubuntu over Android" and stuff like that, but I don't get if that's what I'm looking for or just that people here are building replacements to the underlying Android kernel. As you see I'm not interested at all on the Android part of the A101.
Hope you can give me some orientation...
Click to expand...
Click to collapse
That isn't anything particaly solid but the best you can do is either install one of the os from here http://forum.xda-developers.com/showthread.php?t=1198389
or look at archos sde http://www.archos.com/support/support_tech/updates_dev.html?country=gb&lang=en
juannm said:
The BeagleBoard works with a linux Kernel for the OMAP architecture, so what would be the closest to bare-bones thing I could get for the A101? If this was Desktop, I'd answer "Debian with the lightest Desktop setup and OpenCV libraries installed", but in this architecture I'm lost.
I see a lot of "custom kernel for you", "Ubuntu over Android" and stuff like that, but I don't get if that's what I'm looking for or just that people here are building replacements to the underlying Android kernel. As you see I'm not interested at all on the Android part of the A101.
Click to expand...
Click to collapse
I'm not sure about what really you want to know, but would note the following:
It's possible to run a Linux kernel on Archos, and Ubuntu on it will be "Ubuntu over Linux kernel". The problem is that Archos needs an Archos-friendly kernel, and it's so tweaked that I don't know at what point Linux ends there and Android starts. So here is another problem: it seems rather hard to make the mainline kernel running on Archos. This means that you'll stay with 2.6.29 till the end of your Archos' days... But if you're happy with custom-made GPL'ed 2.6.29 by Archos -- installing "Debian with the lightest Desktop" on it should be no problem. On Archos-Debian.org they've already made a few rootfs images.
Question: justo out of curiosity, do you know if the Debian compilation from (www .debian-archos.com) is made by following this (dev. openaos.org/wiki/Debian%20gen8) ??
In the other hand, I have just installed Urukdroid 1.6 over my previous system (letting the installer to wipe my previous partitions and creating new ones), and now I'm going to try the Angstrom "rootfs.img" option (that I copied somewhere before installing Urukdroid) and also the Debian beta2 one (altough its a wooping 3,8 GB file... I wonder what did this people install in it? KDE? hahah).
Then for cross-compiling from my desktop computer, I guess all I need is the ARM Gcc version, right? I'm in Kubuntu 11.10 so that would be the g++-4.6-arm-linux-gnueabi package (just tell me if this is not the right direction...)
I guess compiling and copying some "hello world" binary file to the Debian or Angstrom in the tablet would be enough for running it, am I right?
Probably, it's better to send an email to OpenAOS people about how they made their package. Also I think it's not a "compilation", but an "installation": standard Debian binaries installed over Archos-specific 2.6.29 kernel. I don't think they recompiled the kernel or built Debian from stratch. The way shown at http://dev.openaos.org/wiki/Debian gen8 is a working one (at least, in general: I don't know about the goodies like wifi, I didn't get that far).
3.8Gb -- it includes free space too: rootfs.img is like a virtual HDD, it contains the system, user data, and free space.
For cross-compilation you need a toolchain: a cross-compiler plus some other tools. Look for Mentor (Codesourcery), Emdebian, OpenEmbedded, Buildroot, etc. Here is a ready-made custom built one: http://forum.xda-developers.com/showthread.php?t=1328027 . Maybe Kubuntu has their own build-in toolchain too, I don't know. Which one is better for you, and how to install and use it -- it depends on many things, actually. Generally: yes, g++-arm-linux-gnueabi looks like a cross-compiler for ARM. And yes, if you cross-compile a "Hello, world!" correctly -- it will run on Archos.
Hi juannm,
welcome to XDA-Developers
juannm said:
I was thinking on buying a BeagleBoard for trying some programming in it, just wanted to see what's the power of that board when doing image processing stuff (namely playing with OpenCV). But, before spending those $130 in one, I realised that my Archos A101IT has almost the same board (SoC), well actually even a bit faster (BeagleBoard comes with OMAP3530 while A101IT comes with OMAP3630).
Click to expand...
Click to collapse
I was able to buy an A101it with was a brick few weeks ago and merely had the same intent. Thought of getting an OMAP3 platform to fiddle around with.
I started to collect some information of the hardware in use.
Luckily i was able to repair it.
For information about that look here:
http://forum.xda-developers.com/showthread.php?t=1199450
The design of the board is pretty clean and apart form running Android OS, Archos offers the SDE as people already pointed out.
You might also start from scratch and build up Ubuntu or Debian images for this device.
In fact i consider it nearly perfect for such experiments.
juannm said:
The BeagleBoard works with a linux Kernel for the OMAP architecture, so what would be the closest to bare-bones thing I could get for the A101? If this was Desktop, I'd answer "Debian with the lightest Desktop setup and OpenCV libraries installed", but in this architecture I'm lost.
Click to expand...
Click to collapse
What exactly do you mean?
It's too much to built up rootfs from scratch...
Need a starting point?
So basically you'll need to know how the boot process works on these devices, how rootfs is stored and how the rootfs gets mounted during boot up.
First i recommend to install SDE from Archos to get the alternate bootloader installed.
This way you might use bootmenu to load custom kernels and install your own rootfs on top of this.
It's too much to explain it all, so look around and read first.
Just in short:
Stock OS uses squashfs images as rootfs, which are mounted ro if you don't tweak anything.
SDE uses uncompressed EXT2 image, as far as i remember.
It might be a good idea to install UrukDroid (this will wipe out SDE, but leaves Stock OS untouched).
Afterwards you got true EXT4 filesystem, which is still Android but offers a lot of useful tools.
You'll need some background of course and it might be useful to tweak the bootloader to accept the first kernel to be unsigned as well.
http://forum.xda-developers.com/showthread.php?t=1018260
juannm said:
I see a lot of "custom kernel for you", "Ubuntu over Android" and stuff like that, but I don't get if that's what I'm looking for or just that people here are building replacements to the underlying Android kernel. As you see I'm not interested at all on the Android part of the A101.
Click to expand...
Click to collapse
As already pointed out the kernel needs hardware specific tweaks to run on the Archos devices.
So does the Beagleboard kernel.
The vanilla kernel won't do it on these platforms.
Anyway there are some projects which use standard ARM distributions (e.g. Ubuntu, Debian) to get a working Linux on top of a custom kernel, which is based on stock kernel sources (2.6.29-omap1).
If you intent to change to a newer kernel version, there's more work to do.
There'd been some progress for 2.6.35 recently.
It really depends on what you expect to have working on the device.
I might even write more on this, but i guess you'll need to get a better overview yourself.
All i might say is, that Archos give good support for the open development (at least compared to other manufacturers).
They keep their git repo up to date and try to fix bugs as well.
So start hacking and have fun!!
scholbert
Hi there,
Just wanted to add few tidbits on top of what Scholbert said which I agree with 100%:
If you want to tweak the bootloader like Scholbert said to have three different bootable kernels (main android, sde, recovery), contact me first, I have few resources that could help you and add extra safety.
However, I believe that it's not needed at first and safer to get a hold on the platform to go sde route first.
Compared to beagleboard, you won't loose much with the a101, the thing I miss the most is a serial port to help with kernel dev, but even this is possible if you're comfortable with opening the a101 and soldering.

[R&D]Android 4.4.4

Hi Folks
I've been working on porting Android 4.4.4 ( CM11 ) to the RaspberryPI .
Using the androidarmv6 project as I base I've created a device tree and made the modification required to get the thing built and booting into a console on the PI the thing that is currently missing is the Graphics Stack implementation which includes the Gralloc, HWComposer and OpenGLES libraries.
If you have an experience/knowledge of how the Android Graphics Stack works especially wrt Surfaceflinger internals how to Implement OpenGLES at the platform level or any of that fun stuff and also have a RaspberryPI to hand then feel free to start hacking on this.
To get started follow the README @ https://github.com/trevd/android_vendor_broadcom_rpi .
Just to be clear. This is not so much a call for help as it is an invitation to anyone who fancies the challenge as I'm pro-actively working on the Graphics stuff myself. I'm coming at this one cold however as upto until 6 weeks ago I had never done any Graphics driver development. I figured this a great opportunity to learn.
DEVELOPERS
If like me you have no experience with Graphics but want to have a go anyway then again feel free. I'll happily answer questions wrt to specifics of the development. I'll caution however that this involves a fair bit of research and the learning curve is fairly steep (IMHO). If you have no experience porting android to devices and thing like debugging device bring-up over adb then this is definitely not the place to start.
OTHER INTERESTED PARTIES
This is going to sound harsh to some folks but here goes. I'd really like to manage expectations by saying expect nothing! I will also report and have removed any non development related posts, Even nice ones! If you feel compelled to offer some encouragement just click the thanks button. It really should also go without saying but for the love of <insert favourite deity> Don't ask for an ETA.
CREDITS
My work is definitely standing on the shoulders of giants here and this wouldn't even be a thing without the fine work of the androidarmv6 project and their efforts to keep Android alive on older hardware. Also the Razdroid folks who prior work in this area has been extremely useful.
Obviously CM, Google et al and lets not forget those 1000's of linux kernel developers too.
I hope this project will come alive, cause I want any form of working Android on my Raspberry, but couldn't get an answer...
Android on that little machine would be great!
Hello everyone,
Thread cleaned.
As you all may or may not know, things had gotten off-topic on this thread. Usually it takes quite a bit of time for that to happen but somehow it began almost out of the gate.
Tempers were getting hot about whether Android is Linux or not. I'm not sure why this debate was going on but it doesn't belong here. Please stick to the topic as it pertains to this thread.
Also, please show one another a little respect. Just because you may have a difference of opinion, there's no need to start insulting one another by name-calling.
Regards
What's new?
I have read that on this site http://www.mesa3d.org/relnotes/10.3.html new gpu drives for the raspberry pi are
V 10.3 is the First one
But i am not sure
Little Bit of an update
Hi Folks OP! here.
Bit of an update. https://www.youtube.com/watch?v=GO10mkZWeA8 ....
This basically shows the PI booting to the Launcher then the whole thing goes a bit mental and fails somewhere around a dequeuing buffer attempt.
A Couple of Technical Details
This is booting without the HWComposer library ( apparently that's a thing ) big thanks @psyke83 on the armv6 who pointed me in the right direction.
The Gralloc in it's current state is pretty standard and I'm trying to get my head wrapped around how the RaspberryPI dispmanx tie's in without allocating and lock graphics buffers. There seems to be at least 3 ways of accessing the Graphics Memory via various kernel drivers.
I added blanking support to the raspberrypi kernel framebuffer driver , which was absent. I did this upstream as I'm too lazy to maintain a separate patch set This seems to have prompted ( who I think ) is the RPi kernel maintainer to extended the Videocore closed source graphics firmware to enabled HDMI power down and also add the FB_WAITFORVYNC which is something Android makes use of in many HWComposer implementations.
As we are using a close to mainline kernel which means we're not constrained to compatibility hacks wrt to the surfaceflinger service layer. at the moment that is about has much as I know. Currently the AOSP Display Stack is a moving target and there's discussions going on with regard to Dma-buf fences vs Android sync driver. https://www.youtube.com/watch?v=rhNRItGn4-M&list=UUIxsmRWj3-795FMlrsikd3A .
As you may gather there's alot of information to soak up ....
Meanwhile over at the RPI Foundation. Fromer Intel GPU driver development Eric Anholt has been working on making a kernel driver for the videocore. http://www.phoronix.com/scan.php?page=news_item&px=MTc3NjQ . I initially thought we could maybe use the A KMS Hwcomposer, Mesa GLES implementation and a DRM ( Display Render Manager ) based gralloc. All these are things today and would just have to be extended to support the vc4 implementation. Eric was working with Mesa as part of his implementation which would leave the gralloc which is available in the android-x86 and libdrm .... libdrm looked like a tricky proposition for someone with my skills and Eric said he had no ( concrete ) plans to do libdrm . However looking at his current codebase I noticed that the videocore driver now supports dma_buf. Arm have made their Mali Gralloc opensource this also supports the use dma_buf and the nature of the beast is to provide a Generic way of accessing the Graphics buffer access many GPU's ( I think ) .
The Current Plan
=============
Merge the vc4 GPU kernel changes into my kernel branch
Port the Mali Gralloc to handle any difference between mali and vc4 ioctl etc
?????
?????
?????
?????
?????
Potentially Profit!
Thanks
trevd
trevd,
As a temporary measure, you could try to disable the opengl renderer by setting USE_OPENGL_RENDERER := false. That may allow you to boot into the home app and do some further debugging. With hwui and hwcomposer both disabled, the UI will be very slow, but it has a better chance of working if your problem is specifically due to an incompatibility with the EGL drivers.
Have you tried running with the full brcm_usrlib driver? As far as I can see, there have been successful cases in which the driver was demonstrated to run on RPi (though not specifically on Android). See here: http://www.raspberrypi.org/quake-iii-bounty-we-have-a-winner/
You mentioned an error with dequeueing buffers; you may have the same issue that I had with the original brcm_usrlib source that was solved by this commit.
BTW, I'd appreciate if you could post a logcat captured during boot (failing or otherwise). I'm curious...
Android Wear on Raspberry Pi?
Hi there!
Nice project. Is there any existing solution to run Android Wear on Raspberry Pi? A prototypical port would be sufficient for my case.
Many thanks in advance!
psyke83 said:
trevd,
As a temporary measure, you could try to disable the opengl renderer by setting USE_OPENGL_RENDERER := false. That may allow you to boot into the home app and do some further debugging. With hwui and hwcomposer both disabled, the UI will be very slow, but it has a better chance of working if your problem is specifically due to an incompatibility with the EGL drivers.
Have you tried running with the full brcm_usrlib driver? As far as I can see, there have been successful cases in which the driver was demonstrated to run on RPi (though not specifically on Android). See here: http://www.raspberrypi.org/quake-iii-bounty-we-have-a-winner/
You mentioned an error with dequeueing buffers; you may have the same issue that I had with the original brcm_usrlib source that was solved by this commit.
BTW, I'd appreciate if you could post a logcat captured during boot (failing or otherwise). I'm curious...
Click to expand...
Click to collapse
@psyke83 Thanks for the tip .wrt USE_OPENGL_RENDERER . It's a good idea but not where I'm at in the process . I know what I need to do it's just a case of doing it lol , i've been lazy the last few weeks and sometimes time is a great leveller in these things . There's smarter people than me doing work in the same area which is presenting some interesting options as I noted .
I did see your dequeue and wait patch and have I think it's something I need to do ... Am I correct in thinking that this is the same as what later Android Graphics Stack implementations are doing in the way sync fencing?
Tbh It was the original broadcom source release that got me going on this and I was quite excited to see the PI "Port" ... After some investigation I thought using that approach was way beyond my level of understanding , Put simply I didn't have the skills or knowledge or the patience to even attempt implementing it ..... That was 6ish months ago ( I think ) so revisiting it is also an options ... again time is the leveller and smarter people ( you and the armv6 team in this case ) have done alot of the hard work and my knowledge is dramatically increased in the area of porting missing Broadcom functionality into the RPI Kernel
The PI's kernel is also virtually mainline which presents more options still as the current state of the art on the Android Graphics Stack is to use the Atomic Display Framework and the AOSP has libraries to work with that [ https://android.googlesource.com/platform/system/core/+/master/adf ] . As a test/hack I compiled/backported the AOSP master surfaceflinger hwui to the androidarmv6 code base so that is ultimately where I'd like to go with this madness ..
I think It's going to be a mix of everything , the full broadcom EGL/GLES library with a dma_buf based gralloc and hwcomposer to suit .
I'd say I've got an embarrassment of riches atm .
Ahh the curious mind of the developer , lol . You know where curiosity gets you? Reading logcats of devices you don't have access to for entertainment on a saturday night but yeah I'll drop a logcat etc when I next power the thing up ... :good:
@Verses There's no Android Anything on the PI and without wanting too sound harsh. If you want it , you have to build it.
If you want to do something with Android Wear today than the PI isn't the device you need. There's better, more powerful SBC's available for not much additional cost. Also there's really no sane reason the latest versions of Android should run on the PI the CPU is legacy by 2 generations the available source code made no provision for Android what so ever and the RPI Foundation decided that Android was not an OS that fulfilled their primary mission of improving (real) computer literacy in the British yoof! But I really like Android and had a spare PI and making the latest version of Android work on "weird" machines is sort of how I get my kicks, hence this!
trevd said:
@psyke83 Thanks for the tip .wrt USE_OPENGL_RENDERER . It's a good idea but not where I'm at in the process . I know what I need to do it's just a case of doing it lol , i've been lazy the last few weeks and sometimes time is a great leveller in these things . There's smarter people than me doing work in the same area which is presenting some interesting options as I noted .
I did see your dequeue and wait patch and have I think it's something I need to do ... Am I correct in thinking that this is the same as what later Android Graphics Stack implementations are doing in the way sync fencing?
Tbh It was the original broadcom source release that got me going on this and I was quite excited to see the PI "Port" ... After some investigation I thought using that approach was way beyond my level of understanding , Put simply I didn't have the skills or knowledge or the patience to even attempt implementing it ..... That was 6ish months ago ( I think ) so revisiting it is also an options ... again time is the leveller and smarter people ( you and the armv6 team in this case ) have done alot of the hard work and my knowledge is dramatically increased in the area of porting missing Broadcom functionality into the RPI Kernel
The PI's kernel is also virtually mainline which presents more options still as the current state of the art on the Android Graphics Stack is to use the Atomic Display Framework and the AOSP has libraries to work with that [ https://android.googlesource.com/platform/system/core/+/master/adf ] . As a test/hack I compiled/backported the AOSP master surfaceflinger hwui to the androidarmv6 code base so that is ultimately where I'd like to go with this madness ..
I think It's going to be a mix of everything , the full broadcom EGL/GLES library with a dma_buf based gralloc and hwcomposer to suit .
I'd say I've got an embarrassment of riches atm .
Ahh the curious mind of the developer , lol . You know where curiosity gets you? Reading logcats of devices you don't have access to for entertainment on a saturday night but yeah I'll drop a logcat etc when I next power the thing up ... :good:
@Verses There's no Android Anything on the PI and without wanting too sound harsh. If you want it , you have to build it.
If you want to do something with Android Wear today than the PI isn't the device you need. There's better, more powerful SBC's available for not much additional cost. Also there's really no sane reason the latest versions of Android should run on the PI the CPU is legacy by 2 generations the available source code made no provision for Android what so ever and the RPI Foundation decided that Android was not an OS that fulfilled their primary mission of improving (real) computer literacy in the British yoof! But I really like Android and had a spare PI and making the latest version of Android work on "weird" machines is sort of how I get my kicks, hence this!
Click to expand...
Click to collapse
We can't give up now
@psyke83 For your viewing pleasure lol ... This is before I've switch the Gralloc over to Arm's DMA Buf based one .
At least the kernel booted with the DMA additions . ... Anywho To Work!! I might get this done before christmas. :good:
@trevd, I'd like to know something. I already build some ROMs for different devices and the output was always a custom recovery flashable zip, some images, ramdisk, kernel etc.
My answer is: How you "flash" this on RPi?
Thanks.
GeekyDroid said:
@trevd, I'd like to know something. I already build some ROMs for different devices and the output was always a custom recovery flashable zip, some images, ramdisk, kernel etc.
My answer is: How you "flash" this on RPi?
Thanks.
Click to expand...
Click to collapse
You can take the files like Kernel and system and so on direct on the SD-card! The whole OS is on the SD by default... You don't have to flash anything! Only put the SD into your PC, copy the files on it and put the SD into to Raspberry... That's the magic... [emoji6]
ph87 said:
You can take the files like Kernel and system and so on direct on the SD-card! The whole OS is on the SD by default... You don't have to flash anything! Only put the SD into your PC, copy the files on it and put the SD into to Raspberry... That's the magic... [emoji6]
Click to expand...
Click to collapse
Well, thanks for the answer. But I was actually asking for the structure how you put it on the SD card. I guess you can't just put system folder and boot.img on the SD card. An Android device has much other folders which are in root directory. Like /proc, /dev, /config and so on. It would be interesting to know this
GeekyDroid said:
Well, thanks for the answer. But I was actually asking for the structure how you put it on the SD card. I guess you can't just put system folder and boot.img on the SD card. An Android device has much other folders which are in root directory. Like /proc, /dev, /config and so on. It would be interesting to know this
Click to expand...
Click to collapse
@GeekyDroid Hi ... Should have mentioned that I threw together an HACKING document in the vendor repo
But Basically I've gone with on an 8GB sd
Code:
Number Name Start End Size Type File system Flags
1 boot 512B 80.0MB 80.0MB primary fat16 lba
2 system 80.7MB 1000MB 920MB primary ext4
3 data 1000MB 7000MB 6000MB primary ext4
4 cache 7000MB 8000MB 999MB primary ext4
The sizes you can pick yourself boot is about 12MB at the moment. The system.img create by the build is and unsparsed ext4 image which is 512MB as specified in the device/broadcom/rpi/BoardConfig.mk . The actual system directory is ~215MB
My basic workflow for sdcard creation is to use a SDCard USB Adaptor. setup the partitions using parted and mount the boot partition. copy out/target/product/rpi/kernel out/target/product/rpi/ramdisk.img and the contents of out/target/product/rpi/bootloader to the mounted directory
then I used make_ext4 on the data and cache device nodes and then I just cat the out/target/product/rpi/kernel out/target/product/system.img to the system parted.
The hacking document explains it way better than I just have ... but I've typed it now so sod it :silly:
Obviously this method leaves gaps between the system and data partitions but for now I ain't to bothered. Recovery does work and there's a switch you can pass to the raspberry reboot which "tells" it to boot recovery ... i believe that's how their ( RPI Official ) noobs installer and like works. I've not got round to creating a updater-script for it yet
Once the system.img is "flashed" onto the sdcard and because of the nature of the task then you don't really need to create another one, I give mine a refresh every now and again just because I've been at it a couple of months now.
Once the PI is Booted as there is no OTG it brings up eth0 and runs netcfg eth0 dhcp as a late_start service and prints the ip address to the console. In my case the PI is connected to my home network so I then use adb over tcp for debugging fun! .. The bootanimation gets in the way of the printip now .. I should fix that .. obviously you can use a static one or whatever you like** The aforementioned services are specified in device/broadcom/rpi/init.bcm2708.rc
You can use mmp from within source directories to make and push whatever module your working on then adb restart to "hot restart" the framework.
you can also quickly replace the ramdisk.img kernel config.txt which has the resolution and kernel command line args by mounting using adb to mount /dev/block/mmcblk0p1 somewhere and just dropping in your replacements and rebooting .... saves constant pulling of the sdcard ; I read in various places that the sdcard slot isn't so robust but that's what you get for £30!
Hopefully that makes a little bit of sense ... I've only just picked the PI development backup after a month "off" ... I'm still a bit confused about GPU/GFX development in general and the fact that there's at least 3 maybe even 5 ways of allocating/locking/mapping the gpu memory and whether it even has to be mapped or whether "we" can just smash it using DMA isn't aiding in my rapid understanding of it .... I'll get there though.
Thanks
trevd
** I think eric anholt who is working on the vc4 drm/kms drivers and actually knows what he's doing wrt all the gfx fun is booting over NFS so is always an option see : http://anholt.livejournal.com/ for that work
trevd said:
@GeekyDroid Hi ... Should have mentioned that I threw together an HACKING document in the vendor repo
But Basically I've gone with on an 8GB sd
Code:
Number Name Start End Size Type File system Flags
1 boot 512B 80.0MB 80.0MB primary fat16 lba
2 system 80.7MB 1000MB 920MB primary ext4
3 data 1000MB 7000MB 6000MB primary ext4
4 cache 7000MB 8000MB 999MB primary ext4
The sizes you can pick yourself boot is about 12MB at the moment. The system.img create by the build is and unsparsed ext4 image which is 512MB as specified in the device/broadcom/rpi/BoardConfig.mk . The actual system directory is ~215MB
My basic workflow for sdcard creation is to use a SDCard USB Adaptor. setup the partitions using parted and mount the boot partition. copy out/target/product/rpi/kernel out/target/product/rpi/ramdisk.img and the contents of out/target/product/rpi/bootloader to the mounted directory
then I used make_ext4 on the data and cache device nodes and then I just cat the out/target/product/rpi/kernel out/target/product/system.img to the system parted.
The hacking document explains it way better than I just have ... but I've typed it now so sod it :silly:
Obviously this method leaves gaps between the system and data partitions but for now I ain't to bothered. Recovery does work and there's a switch you can pass to the raspberry reboot which "tells" it to boot recovery ... i believe that's how their ( RPI Official ) noobs installer and like works. I've not got round to creating a updater-script for it yet
Once the system.img is "flashed" onto the sdcard and because of the nature of the task then you don't really need to create another one, I give mine a refresh every now and again just because I've been at it a couple of months now.
Once the PI is Booted as there is no OTG it brings up eth0 and runs netcfg eth0 dhcp as a late_start service and prints the ip address to the console. In my case the PI is connected to my home network so I then use adb over tcp for debugging fun! .. The bootanimation gets in the way of the printip now .. I should fix that .. obviously you can use a static one or whatever you like** The aforementioned services are specified in device/broadcom/rpi/init.bcm2708.rc
You can use mmp from within source directories to make and push whatever module your working on then adb restart to "hot restart" the framework.
you can also quickly replace the ramdisk.img kernel config.txt which has the resolution and kernel command line args by mounting using adb to mount /dev/block/mmcblk0p1 somewhere and just dropping in your replacements and rebooting .... saves constant pulling of the sdcard ; I read in various places that the sdcard slot isn't so robust but that's what you get for £30!
Hopefully that makes a little bit of sense ... I've only just picked the PI development backup after a month "off" ... I'm still a bit confused about GPU/GFX development in general and the fact that there's at least 3 maybe even 5 ways of allocating/locking/mapping the gpu memory and whether it even has to be mapped or whether "we" can just smash it using DMA isn't aiding in my rapid understanding of it .... I'll get there though.
Thanks
trevd
** I think eric anholt who is working on the vc4 drm/kms drivers and actually knows what he's doing wrt all the gfx fun is booting over NFS so is always an option see : http://anholt.livejournal.com/ for that work
Click to expand...
Click to collapse
Thanks you so much for explaining it to me! It really makes sense now for me! Thanks for doing this project I really appreaciate it, that someone works on it! :victory:
I'm not a developer neither a pro, I just now some source building, however I'd like to help you. But as I said I can't, because of the lack of the knowledge. Anyways keep going and all the best! :good:
With the new quad core raspberry pi that just came out, would this port work with it?
Chrisw_2003 said:
With the new quad core raspberry pi that just came out, would this port work with it?
Click to expand...
Click to collapse
With the work that eric anholt has done on the videocore mesa kms driver ... someone just needs to write a simple pass through gralloc ( in theory ) This port doesn't need to work on it as you'll be able to compile the AOSP master branch without too much trouble.
@trevd I think that you should not use Mesa, but trying every AndroidARMv6 fix instead. (until the DRM driver is merged in the raspberrypi/linux tree as Anholt's tree DOES NOT support the Pi2B)
That dequeue patch is a good thing to try.(it fixed that particular error on another device)
Currently your tree DOES NOT build, it stalls at repo sync:
Code:
21 689k 21 151k 0 0 12202 0 0:00:57 0:00:12 0:00:45 21103Fetching project CyanogenMod/android_bootable_recovery-cm
23 689k 23 164k 0 0 12273 0 0:00:57 0:00:13 0:00:44 23933error: Cannot fetch trevd/android_external_busybox
Fetching project CyanogenMod/android_external_grub
100 689k 100 689k 0 0 12014 0 0:00:58 0:00:58 --:--:-- 17929
Fetching projects: 67% (313/467)
Is anyone still working on this for the gfx port?

Categories

Resources