[Q] Android kernel development environment setup? - Android Q&A, Help & Troubleshooting

Hallo i am trying to look into android goldfish code and probably make some changes in it. As it is a long way to go for me i am actually unable to decide the tools that i need to set up. I come from an IDE based programming experience so am always trying to find a walk through tutorial to get goldfish kernel code in eclipse CDT to browse and code but no luck.I have followed the post source.android.com/source/building-kernels.html and built the kernel accordingly. i know that its a basic linux kernel and so tried it along the lines of this post wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source but am still not confident of my setup. can some one please guide me through my new venture into this wild, vast and crazy field ?

crouchtiger said:
Hallo i am trying to look into android goldfish code and probably make some changes in it. As it is a long way to go for me i am actually unable to decide the tools that i need to set up. I come from an IDE based programming experience so am always trying to find a walk through tutorial to get goldfish kernel code in eclipse CDT to browse and code but no luck.I have followed the post source.android.com/source/building-kernels.html and built the kernel accordingly. i know that its a basic linux kernel and so tried it along the lines of this post wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source but am still not confident of my setup. can some one please guide me through my new venture into this wild, vast and crazy field ?
Click to expand...
Click to collapse
Yes, you'll need a Linux environment, mostly 64-bit based, compiler toolchain and some additional packages/libs.
For more info: http://forum.xda-developers.com/showthread.php?t=1748297

Related

Cross compiling for the Nexus One on Linux

Hey All,
I'm curious about compiling a native Linux app for the Nexus One, and wondering what the best way is to go about it in Ubuntu. I found this link for the G1:
http://android-dls.com/wiki/index.php?title=Compiling_for_Android
Since the Snapdragon is also ARM I'm assuming this will work, but is there a decent way to do this on Ubuntu or is my best bet to install Debian in Virtualbox and compile it there?
Thanks,
-Dan
overridex said:
Hey All,
I'm curious about compiling a native Linux app for the Nexus One, and wondering what the best way is to go about it in Ubuntu. I found this link for the G1:
http://android-dls.com/wiki/index.php?title=Compiling_for_Android
Since the Snapdragon is also ARM I'm assuming this will work, but is there a decent way to do this on Ubuntu or is my best bet to install Debian in Virtualbox and compile it there?
Thanks,
-Dan
Click to expand...
Click to collapse
There's a certain amount of vagueness associated with your generalized request.
That said ... ubuntu is sooo very very closely related to debian in the linux fam!
Almost all things described in the link your reference will carry-over/hold-true in ubuntu as they are stated in debian.
But ... the real kicker is the specific app you're trying to compile.
Depending on what the app you want to build depends on ... will determine your overall success. While the reference posted link is insightful, you must understand the need to link against libraries being used. Many of these libraries (at least the basic 'c' ones) you'll find in the AOSP code in android's git repo.
I would suggest taking a look at the "external" projects found in the AOSP code to see how they utilize the makefile setup and build-environment and how they leverage bionic and others to build against.
The way those projects build out, would be essentially what you're looking for .. (I assume) again, I state this without knowing the specific app you have in mind.
Hope that helps.
~enom~
How well would a linux disto made for desktop PCs work with touch screen mouse inputs and no keboard support? (im assuming the Android VK doesnt work when you press on a textbox in a Linux Emulator)
enomther said:
There's a certain amount of vagueness associated with your generalized request.
Click to expand...
Click to collapse
Sorry, I should have been more specific - by Linux native I didn't mean any app in particular, I just meant not a java Android app. I'm really just looking to compile a HelloWorld in C and run it at the shell on the Nexus at this point.
My main concern with the link I posted is that although Ubuntu is based on Debian, Ubuntu does not maintain an ARM version, and the package mentioned in that tutorial is not included in Ubuntu because of this.
So I'm just wondering if anyone has come up with a good solution for compiling for the Nexus in Ubuntu, or if I'm better off installing Debian in a virtual machine.
Thanks,
-Dan
http://android-tricks.blogspot.com/2009/02/hello-world-c-program-on-using-android.html
I think this is more of what I was looking for, I'll build AOSP and try out the agcc script.
-Dan
Another idea: find the Android source wherever Google hides it, I have forgotten, sorry! But they give instructions for setting up a whole ARM cross-compiling environment on x86/x64 Ubuntu, and as I recall, it was really easy, quick and automatic! (so easy, I did it just so I could compile some ARM apps myself, I really didn't need to compile Android, I don't build phones! )
After that, you too should be able to compile your own apps into native ARM binaries.
overridex said:
Sorry, I should have been more specific - by Linux native I didn't mean any app in particular, I just meant not a java Android app. I'm really just looking to compile a HelloWorld in C and run it at the shell on the Nexus at this point.
Click to expand...
Click to collapse
To do this, you need a version of the ARM tools appropriate for your platform and then use them for building a static binary for Linux. You can find such tools at CodeSourcery (http://www.codesourcery.com/sgpp/lite/arm). Given that you sound like you have Ubuntu, then the Linux version from this page, http://www.codesourcery.com/sgpp/lite/arm/portal/[email protected]=lite, would be what you want. The key is to use the --static parm when you build the binary.
From there, just get your binary over onto the target and run it from the command shell.
Remember that static binaries are HUGE. They have to include all library functions linked in.
If you are looking for tiny binaries, look into the NDK and use the BUILD_EXECUTABLE rule for Android.mk.
A few more useful links, but not much that hasn't already been stated in previously referenced links:
http://benno.id.au/blog/2007/11/13/android-native-apps
http://honeypod.blogspot.com/2007/12/dynamically-linked-hello-world-for.html
http://honeypod.blogspot.com/2007/12/initialize-libc-for-android.html

[Q] Using google's NDK for compiling kernels?

I would like to post a general question about kernel development!
Background:
I've started to look into what it take so to develop a kernel of my own, and I'm guessing its no small undertaking even though everything is linux based... which means all the source exists already. I'm learning linux is awesome in that respect.
Question:
Any reason I can't use google's NDK to do development? I've learned it has the necessary cross compiler for the arm... or at least I think it does.
Ok, let me re-word the question.
I downloaded the kernel source from htc for the thunderbolt. The first thing I did was attempt to compile the source on my Ubuntu computer. After setting up the .config file for the thunderbolt, I soon found I needed an arm cross compiler. I also found NDK includes an arm cross compiler.
I downloaded it, modified the Makefile (I know... there are better ways instead of modifying the Makefile) to point to the NDK cross compiler and it compiled.
My question is... is there any reason I can't use the files that resulted (zImage --> boot.img) on my thunderbolt? Just trying to learn. Should I post this somewhere else?
toymachine115 said:
Ok, let me re-word the question.
I downloaded the kernel source from htc for the thunderbolt. The first thing I did was attempt to compile the source on my Ubuntu computer. After setting up the .config file for the thunderbolt, I soon found I needed an arm cross compiler. I also found NDK includes an arm cross compiler.
I downloaded it, modified the Makefile (I know... there are better ways instead of modifying the Makefile) to point to the NDK cross compiler and it compiled.
My question is... is there any reason I can't use the files that resulted (zImage --> boot.img) on my thunderbolt? Just trying to learn. Should I post this somewhere else?
Click to expand...
Click to collapse
Any ARM toolchain should work, though the android NDK is not always the easiest one to use. Best way to see if you compiled it correctly is to test it of course. Back up your current phone state first of course.
Thanks! I'll attempt it.
Main thing I was going for was to avoid the NO do not use the NDK cross-compiler... so looks like it is ok.

[Q] Making a custom Kernel?

I've had a search and a look around but can't see anything specific enough to answer this.
I have read that the SGS2 uses the new BCM4330 chipset for it's WiFi-N support.
It looks to me that for existing kernels they are using either the existing kernel support or possibly the b43 driver.
I need to find out, and while I have compiled custom kernels in nix in the past, I have never done so in Android, so I'm a little out of my comfort zone here.
I want to compile a kernel where the WiFI driver will support monitor mode, ideally it would be the CM7 kernel with just this extra functionality added, however a number of the tools that I would use to identify the existing configuration do not seem to be available in the standard CM7 build (lspci being one).
I don't want to frack around too much without having read up first so could anyone point me at a good guide for creating my own Android Kernel, even better if the guide was specific to the CM7 version.
Lastly I mostly run a Fedora environment, however the bits I have read seem to suggest a number of tools are only available in a Ubuntu guise (heimdall springs to mind and while I'm sure it's possible to recreate it for Fedora I'm trying to reduce the number of dependencies I'll have to recreate as much as possible). Therefore can I get some advice regarding the least complicated way to generate an Android build environment in Linux.
Thanks
For kernel compilation on android, you can check the several repositories there are for the several kernels. Depending on each kernel/repository/user, you can find a predefined .config inside them, so you can get the basic configuration to compile the kernel, don't know if CM7 has it in its repository...
As for the enviorment, I haven't tried compiling a kernel, but I did compile some ROM on Gentoo Linux, so I suppose it could also be done in Fedora without many problems. The main thing about using Ubuntu is that is very extended, so they're using it as main Linux base, but that doesn't mean it can't be done in other linux distros. You can check CM7 wiki for building from source to install the required packages for your enviorment. In my case I cross checked the Ubuntu packages with Gentoo to install gentoo's version of that packages/tools to be able to compile without problems.
Also in the case of building kernels, you need a toolchain to be able to compile, but there are several webs/tutorials with info on how to use that.
EDIT: You have a complete tutorial for CM7 in their wiki with the needed packages for both Debian and Red Hat based distributions...
Very useful, thanks for the info.
Very useful info.
Hi,
I'm interested in compiling a custom kernel to support wifi monitor mode, but I read in a previous post that it can be a hardware limitation which makes it impossible to use monitor mode. Can anyone confirm that? Maybe a statement/answer from Broadcom?
I'm just asking it because I don't want to start playing with kernel compilation and driver hacking if it can't be done because of some missing code on the chipset or something.
Thanks.
kepten said:
Can anyone confirm that? Maybe a statement/answer from Broadcom?
Click to expand...
Click to collapse
I doubt Broadcom will answer that, but you can try to search the chipset info in Broadcom's web and see if its supported. Also you can check kernel modules if they can compile against that version.
AzureusPT said:
I doubt Broadcom will answer that, but you can try to search the chipset info in Broadcom's web and see if its supported. Also you can check kernel modules if they can compile against that version.
Click to expand...
Click to collapse
Well, Broadcom's website says nothing about monitor mode but I've found a driver (https:// github.com/cyanogen/galaxy-2636/blob/ics/drivers/net/wireless/bcm4330/src/include/wlioctl.h#L1153) which at least mentions it. This is for Galaxy Tab 10.1 which has the same chipset so maybe someone with a Tab 10.1 could verify if monitor mode works with that kernel/driver? ??

Attempting to start developing

Im going to try and start to develop for the Rezound. Iv decided that I would to take on JB head on, i know its very unlikely that I will make a stable JB rom but i want to try at least, I have the SDK and jb source already i just dont know where to start with JB, if anyone could help that would be great thanks.
I think Joel has JB booting.
The best place to start is modifying other ROMs with the android kitchen. Gives you a feel for how things work.
GrayTheWolf said:
I think Joel has JB booting.
The best place to start is modifying other ROMs with the android kitchen. Gives you a feel for how things work.
Click to expand...
Click to collapse
Nope. jonman www.github.com/JB1tz
I knew it was jo-something.
Good luck! Glad to see you're getting your feet wet.
Looking forward to your JB ROMs in the near future.
The Beeb
Building from source is a lot different than building a kitchen ROM but as Wolf said you might want to start there to at least learn a few things and the program is pretty easy to learn. The kitchen requires a functioning ROM to build from so not sure you could do JB. The AOSP website has a lot of information about building from source but you'll find the directions they give are for building for the nexus devices. AOSP is strictly for Linux or MAC (maybe windows under a virtual machine) and is pretty straight forward for getting it setup, I used Ubuntu 12 but getting a Linux box setup is as far as I took it as I got bored of it all. One of the devs here should have a github repository for JB and maybe you can join in on that or find some instructions on how to use the JB source you have to build for the Rezound. I would contact wildstang83 he's a pretty friendly guy who likes to help. Also get on IRC and start asking questions.
AOSP for setting up a build environment:
http://source.android.com/source/initializing.html
Android Kitchen:
http://forum.xda-developers.com/showthread.php?t=633246
kzoodroid said:
Building from source is a lot different than building a kitchen ROM but as Wolf said you might want to start there to at least learn a few things and the program is pretty easy to learn. The kitchen requires a functioning ROM to build from so not sure you could do JB. The AOSP website has a lot of information about building from source but you'll find the directions they give are for building for the nexus devices. AOSP is strictly for Linux or MAC (maybe windows under a virtual machine) and is pretty straight forward for getting it setup, I used Ubuntu 12 but getting a Linux box setup is as far as I took it as I got bored of it all. One of the devs here should have a github repository for JB and maybe you can join in on that or find some instructions on how to use the JB source you have to build for the Rezound. I would contact wildstang83 he's a pretty friendly guy who likes to help. Also get on IRC and start asking questions.
AOSP for setting up a build environment:
http://source.android.com/source/initializing.html
Android Kitchen:
http://forum.xda-developers.com/showthread.php?t=633246
Click to expand...
Click to collapse
Thanks for all the info, I have linux mint and as far as i can tell everything is set up
gearlo said:
Thanks for all the info, I have linux mint and as far as i can tell everything is set up
Click to expand...
Click to collapse
Then you're pretty much at were I left off setting up my linux box. I was going to try building for the GTab 7+ and there is a github repository for it for CM9 and CM10. Was just starting to learn how to connect to it when I lost interest. There is supposed to be some type of tutorial on the github site but I couldn't find it. I am also not sure if you need eclipse installed or not to use it. This is where you would need the help of a dev or someone else who's set up a linux box. I also didn't see a github for JB for the rezound but I also didn't look all that well just did a quick search.
wildstang, joel, newtoroot, nilsp I know build from source, or at least they did for the incredible, so they would be good sources of information and I know they've helped others in the past so don't mind pm's.
https://github.com/
Here's a tutorial I found on building from source might be some useful info there:
http://www.xda-developers.com/android/compiling-from-source-the-easy-way/
Here's a tutorial for AOKP:
http://forum.xda-developers.com/showthread.php?t=1810297
Maybe antp or wolf would help you setup too as I noticed their posts in the AOKP build forum?

Atempting to build an AOSP-based rom - and I've got a question.

Hey guys...hoping someone here who is wiser than I can offer some information on how I might complete the task I am after. I've got limited knowledge in the rom-building department, but would really like to learn at least enough to "get my feet wet" so to speak, and so I'm trying hard to do just that. I would like to build a version of SlimKat based on the latest code available, and have it be compatible with our device (the VS985). I've gotten so far as to set up the Ubuntu build environment and everything, installing repo and initializing the directory with the SlimKat 4.4.4 caf (by doing repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4-caf), and finally repo sync'ing the whole thing.
I'm pretty sure that I need to eventually use the ". build/envsetup.sh" and then "brunch vs985" commands to begin the actual build process itself, but my main question now even after all the tutorials I've read is whether or not there are additional "device-specific" commands I need to run or things need to do or sync in order to make the final product compatible with our VS985. I found a tutorial on building CM11 for our device, and it talked about having to create a local_manifest.xml file and then repo sync'ing again, but this is pretty much where I got lost and where I'm still quite confused. Can anyone with prior AOSP building experience help me out with some idiot-friendly () pointers/instructions and explanations on where to go after repo sync'ing? I would seriously appreciate any help anyone can offer. Thanks!!
ohlin5 said:
Hey guys...hoping someone here who is wiser than I can offer some information on how I might complete the task I am after. I've got limited knowledge in the rom-building department, but would really like to learn at least enough to "get my feet wet" so to speak, and so I'm trying hard to do just that. I would like to build a version of SlimKat based on the latest code available, and have it be compatible with our device (the VS985). I've gotten so far as to set up the Ubuntu build environment and everything, installing repo and initializing the directory with the SlimKat 4.4.4 caf (by doing repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4-caf), and finally repo sync'ing the whole thing.
I'm pretty sure that I need to eventually use the ". build/envsetup.sh" and then "brunch vs985" commands to begin the actual build process itself, but my main question now even after all the tutorials I've read is whether or not there are additional "device-specific" commands I need to run or things need to do or sync in order to make the final product compatible with our VS985. I found a tutorial on building CM11 for our device, and it talked about having to create a local_manifest.xml file and then repo sync'ing again, but this is pretty much where I got lost and where I'm still quite confused. Can anyone with prior AOSP building experience help me out with some idiot-friendly () pointers/instructions and explanations on where to go after repo sync'ing? I would seriously appreciate any help anyone can offer. Thanks!!
Click to expand...
Click to collapse
It all depends. If the source you grabbed does not have anything specific for the vs985, then the build command itself won't work. The build scripts and configuration has to be modified to add that build command and even then, it means going into the source and making whatever changes you need to make it specific to the VS985.
Since it's AOSP, it should work no matter what, but that means anything that requires vs985 specific calls to make it work aren't there.
It's not just a magic command that makes it work. You have to go in and figure out what isn't and is working and make the necessary changes.
I'm assuming you are a programmer? If not, better learn.
iBolski said:
It all depends. If the source you grabbed does not have anything specific for the vs985, then the build command itself won't work. The build scripts and configuration has to be modified to add that build command and even then, it means going into the source and making whatever changes you need to make it specific to the VS985.
Since it's AOSP, it should work no matter what, but that means anything that requires vs985 specific calls to make it work aren't there.
It's not just a magic command that makes it work. You have to go in and figure out what isn't and is working and make the necessary changes.
I'm assuming you are a programmer? If not, better learn.
Click to expand...
Click to collapse
I see. I have had some very basic programming exposure, but I wouldn't consider myself anywhere near skilled and it's been a while haha. Well I do appreciate the info and I'll probably be best off leaving this to those much smarter than I Thanks!
ohlin5 said:
I see. I have had some very basic programming exposure, but I wouldn't consider myself anywhere near skilled and it's been a while haha. Well I do appreciate the info and I'll probably be best off leaving this to those much smarter than I Thanks!
Click to expand...
Click to collapse
I don't want to scare you off. If you feel like you want to learn something new, then don't hold back. I just wanted to let you know that it's not just a simple "grab the source from another phone and compile it for the G3". That's why you'll see different ROMs for each of the different phones. But, in the case of this phone, you all have to add the bump to the ROM in order for it to work and that is specific to each version of the G3. You can't take a bumped D850 (AT&T) ROM and just flash it onto a Verizon G3 (VS985). It won't work.
Now, bumping is not that hard as one of the posts on how to compile a ROM for the G3 gives you the instructions to "bump" your ROM, which is done after you've compiled it. Where it gets more difficult and requires some more tech savy and programming knowledge, is how to modify the ROM to take advantage of the hardware specific to the G3. The AOSP code pulled down for say CM11/CM2 is just that - AOSP. What you were doing was taking a completely different ROM's base source and trying to make that work on the G3. Not impossible by any means, but would require more than just a basic understanding of programming. You also need to understand how the Android OS works, etc. Again, not a trivial task by any means, but also, could end up being something that challenges you to learn more and eventually become a contributor to the G3 dev forums.
I myself am a programmer. I've been learning Android app development but I also wanted to delve into ROM building and was grateful to see the post on how to do so, so I'll be looking into that when I can, but I know it's not an trivial thing to master, but I'm a persistent person and most of my computer programming I learned was self taught when I was in high school on an Apple ][+ and //e. Those were the days when Apple wasn't so closed. Woz had a hand in wanting to keep it open - Jobs didn't. We all know who won on that count.
Any ways, if you are up to a challenge and like solving problems, programming is definitely the way to go.
I've been trying to build my own just for fun as well, but after I brunch, it doesn't create a zip.
I've been following this guide: http://forum.xda-developers.com/lg-g3/general/guide-how-to-build-cyanogenmod-11-d850-t2971538
I feel like it has something to do with my local_manifest.xml, but it's probably because I tried building CM12 and it's not as easy as just changing the branch...
Probably just going to start over from scratch with CM11 and see how it goes.

Categories

Resources