Android的交叉编译,NDK,工具链 [英] android cross compile,ndk,toolchain

查看:399
本文介绍了Android的交叉编译,NDK,工具链的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建立Android内核模块。
我知道我使用交叉compile.Inside内核,我想我可以使用一些一般的交叉编译,如arm-none-linux-gnueabi-gcc.Is我的想法正确吗?或任何其他的交叉编译的Andr​​oid,u能提示我?以及如何在Ubuntu的交叉编译构建环境中的任何artile?
其次,每当我编译模块,我怎样才能将其加载到内核模块?
最后,谁能解释NDK之间的关系,交叉编译工具链和?
THX

I want to build a kernel module for android. And i know i use the cross compile.Inside the kernel,i think i can use some general cross compile,such as arm-none-linux-gnueabi-gcc.Is my idea correct?Or any other cross compile for android,u can prompt to me?And any artile about how to build the environment in the ubuntu for the cross compile? Secondly,whenever i compile the module,how can i load it into the kernel as the module? At last,anyone explain the relationship among NDK,cross compile and toolchain? thx

推荐答案

那么,这是怎样的一个大问题,但我会尽量回答什么,我至少知道。我相信一个特定的硬件制造商将拥有Android捆绑,这将包含一套完整的工作软件。这将包括工具链,Linux内核源代码,u-boot的足球运动员,整个Android系统。就我而言,飞思卡尔他们提供特定的处理器和评估板提供了Android包。

Well, this is kind of a big question, but I will try and answer what I know at least. I believe a particular hardware manufacturer will have an Android "Bundle" which will contain a complete set of working software. This will include the toolchain, Linux kernel source, u-boot booter, and the whole Android system. In my case, Freescale provided the Android bundle for the particular processor and evaluation boards they provide.

至于术语所说,交叉编译器将被列入工具链。术语工具链包括交叉编译,跨库和这样的整体。每个工具链,是为一个主机(即Linux的,cygwin的等),目标处理器(ARM,MIPS和PowerPC等)。

As far as terminology goes, "cross compiler" would be included in the "toolchain". The term "toolchain" encompasses the entirety of cross compiler, cross libraries and such. Each toolchain is built for a host (ie. Linux, cygwin, etc) and target processor (arm, mips, PowerPC etc).

构建Linux为Android真的是没有什么不同,只是构建Linux。这将是最好使用相同的工具链构建的Linux被用来构建Android系统的其余部分。要构建Linux,请设置ARCH =手臂和CROSS_COMPILE =臂无-Linux的gnueabi-(或preFIX您正在使用实际的交叉编译器)的环境变量。注意结局 - 这是在交叉编译preFIX重要

Building Linux for Android is really no different that just building Linux. It would be advisable to use the same toolchain to build Linux that was used to build the rest of the Android system. To build Linux, set the environment variables of "ARCH=arm" and "CROSS_COMPILE=arm-none-linux-gnueabi-" (or the prefix to the actual cross compiler you are using). Note the ending "-" it is important in the cross compile prefix.

下面的链接中介绍了如何设置开发环境。

The following link goes over how to set up the development environment.

Android开发环境设置。

请注意,Ubuntu的10.04至11.04效果很好。最好是保持这些版本之一中。

Note, Ubuntu 10.04 to 11.04 works well. It is advisable to stay within one of these versions.

把Linux内核到目标上是完全依赖于目标。对于我使用的是飞思卡尔,它希望找到偏移量为0x800块SD卡上的Linux内核(每块在SD卡上的512字节)。我用下面的写入SD卡生:

Putting the Linux kernel onto the target is completely target dependent. For the Freescale that I am using, it expects to find Linux kernel on the SD card at offset 0x800 blocks (each block is 512 bytes on the SD card). I use the following to write to the SD card raw:

须藤DD如果= =的/ dev / sdb的BS = 1M的的uImage寻求= 1;同步

sudo dd if=uImage of=/dev/sdb bs=1M seek=1; sync

至于那张NDK,我没有在所有与它的经验。我对它的理解,这是Android的Java接口应用程序向呼出到'C'和'CPP'code时序关键功能。我不知道的是利用这个拥有JNI接口,并且它是如何JNI接口不同。

As far as the NDK goes, I don't have experience with it at all. My understanding of it, it is an interface for Android Java apps to call-out to 'C' and 'CPP' code for timing critical functions. What I don't know is the advantage this has over the JNI interface, and how it is different to the JNI interface.

我希望你能找到这个有用和有益的。

I hope you find this useful and helpful.

这篇关于Android的交叉编译,NDK,工具链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆