Cross compiling for the Nexus One on Linux - Nexus One Android Development

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

Related

[Q] Install firefox (.bin or .deb)?

hello, I was wondering, since Android is based on linux, if we can install a full version of Firefox (Linux version) on the tab. Does anyone know if this is possible?
I've never seen anyone run any linux apps in Android. That would surely be something we'd see if it were possible. I don't know the technical reasons why it isn't, but I'm pretty sure you can't.
You can't install desktop Firefox because much of the required software is missnig, all the UI stuff of regular Linux distro's aren't in Android, stuff like the X windows system, KDE or Gnome, and probably a bunch of other libraries.
The Linux portion of Android handles really low level stuff like file permissions, talking with the hardware, memory management but really nothing to do with the user experience.
you could just run ubuntu through chroot. it works okay.
Please use the Q&A Forum for questions Thanks
Moving to Q&A
Facegarden said:
I've never seen anyone run any linux apps in Android. That would surely be something we'd see if it were possible. I don't know the technical reasons why it isn't, but I'm pretty sure you can't.
Click to expand...
Click to collapse
Commandline stuff with few library dependencies can be ported fairly easily - busybox, bash, etc.
Graphical stuff - not nearly as easy as that depends on graphics toolkits not present in Android.
People forget that Linux is just the kernel. As you increase the number of abstraction layers used by software, Linux as implemented by Android and Linux as implemented by most desktop distros diverge more and more.

[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? ??

Pure Python On a Android Dev Board

I want to install python and run my python code and its libs on an Android dev board like PandaBoard. I do not need to access devices through my python code so I don't think I would need android-scripting. (Correct me if I am wrong please)
I want to compile and run my python code and its used libs (like twisted) on the android device as a daemons so can I just install regular python on my device? If yes how (as there is no apt-get) and if no, and I have to install android-scripting, why is that the case. why do I have to do it that way?
I am a little lost in the difference between my Linux experience on ubuntu and my Linux experience on Android so sorry if I am not making sense!
Bump...
iCode said:
I want to install python and run my python code and its libs on an Android dev board like PandaBoard. I do not need to access devices through my python code so I don't think I would need android-scripting. (Correct me if I am wrong please)
I want to compile and run my python code and its used libs (like twisted) on the android device as a daemons so can I just install regular python on my device? If yes how (as there is no apt-get) and if no, and I have to install android-scripting, why is that the case. why do I have to do it that way?
I am a little lost in the difference between my Linux experience on ubuntu and my Linux experience on Android so sorry if I am not making sense!
Click to expand...
Click to collapse
try QPython

[Q] Why Linux?!

I'm trying to get into development of custom ROM's and whatnot and am following CM's build guide, however I've read numerous people attest to using a distribution of Linux for all development.
I do a little Java and c++ development as I study Software Engineering and to be honest considering Mac is UNIX also, I've never found any difference between me using my MBP or running one of the many linux distro's i've experimented with.
I was just wondering if anyone can actually give some valid reasons and justifications for all the people who state that it's almost a -must- to develop on 64-bit linux installation.
I know this question has probably been asked before but I've been searching and can't find any non-flamey posts.
Cheers!
Developing on Linux isn't a MUST, but I highly recommend it. With Linux you can set up servers to test connectivity with ease, and there is a plethora of built in support for Linux on distributions like Ubuntu. Different distributions, such as Kali (formerly BackTrack) are good for hacking and stuff. Simply using 'sudo apt-get install' you can get amazing tools to help you out.
Blog: http//konvey.blogspot.com | Sent from the Nokia 3310
vyper91 said:
I'm trying to get into development of custom ROM's and whatnot and am following CM's build guide, however I've read numerous people attest to using a distribution of Linux for all development.
I do a little Java and c++ development as I study Software Engineering and to be honest considering Mac is UNIX also, I've never found any difference between me using my MBP or running one of the many linux distro's i've experimented with.
I was just wondering if anyone can actually give some valid reasons and justifications for all the people who state that it's almost a -must- to develop on 64-bit linux installation.
I know this question has probably been asked before but I've been searching and can't find any non-flamey posts.
Cheers!
Click to expand...
Click to collapse
the only reason is that as most android developers work from linux so they have built most tools for that platform, on other platforms you'll find only the most rudimentary tools.
so you can do the same on mac or windows or beos if you want but you'll have to create all the missing tools by yourself probably.

Emulate amd64 on aarch64

Hi there!
I would like to compile android apps and ROMs on my nexus 9, but to do so I would need to emulate a 64 bit system like amd64: I know I can use AIDE to create apps but I prefer using Android studio and I would also like to compile multirom for another device, and as far as I know there is no way to run an android build environment natively in android, so I was thinking of emulating an amd64 in my kali nethunter chroot using qemu. I installed qemu-user-static and executed the qemu-debootstrap command to create a basic ubuntu amd64 rootfs, but then the second stage gave me an error that basically meant that qemu couldn't emulate amd64.
Now my question is: does anybody know where can I find the qemu-system-amd64 binary for aarch64 (or how can I build it)?
Thanks in advance,
Daniil Gentili
The nexus 9 can't emulate AMD64
Well as far as I know
I believe there aren't any prebuilt binaries. AArch64 is relatively new in the Linux world.
It's possible, but will be really slow (I don't own a Nexus 9, using common sense and knowledge here)
Doing it won't be easy. You have two options:
- create a proper Linux chroot on your device, then install qemu in it
Previously I created a Gentoo armv7 chroot on a Tegra 3 device. It worked surprisingly well. Things compile, albeit very slowly.
- Compile QEMU directly on Android, however Android uses bionic libc, not glibc. You may need to port it yourself, AFAIK no one's done that.
Sent from my LG-H812 using Tapatalk

Categories

Resources