如何在android源文件中进行更改后重建android源代码

Jos*_*ine 7 android android-source

我的系统中有android源代码,工作正常.但是当我在android源文件中进行一些更改并运行"make"时它不会生成/更新任何文件如果我错了请纠正我,

i)如果对源代码进行了更改,系统应生成新的system.img文件

ii)即使我们对源代码进行任何更改,android内核文件-zImage文件也不会随着任何更改而改变

另一个问题是,如果我在/ libcore中创建一个新的库文件夹,它会在编译时自动获取.为了在/ libcore之外创建一个新的库文件夹,我在/build/core/main.mk和.classpath文件中添加了它的路径.在编译过程中仍然没有得到它.有人可以确认在/ libcore之外添加新库文件我们需要做些什么更改

此致,Yogesh

Vla*_*lad 10

这取决于您已检出的确切存储库.但对于他们中的大多数人来说,以下配方将起作用

http://source.android.com/source/download.html

请注意,如果您使用的是最新版本,则必须具有64位系统

更新:由于某种原因,上面的页面缺少一些重要的步骤.所以他们在这里

完成"repo sync"步骤后(需要一段时间,但我假设您已经完成了源文件),请执行以下操作:

$ . build/envsetup.sh
$ lunch
Run Code Online (Sandbox Code Playgroud)

最后一个命令将为您提供要构建的平台的选项列表.如果你想为模拟器构建,请选择full-eng.否则请为您的特定设备供应商选择一个.

选择平台后,请确保先完成所有内容,因为整个Android平台非常相互依赖.因此,您需要确保拥有所有组件.

开发时,您可以非常快速地构建单个组件.通过使用以下命令:

mmm <component_directory_name>
Run Code Online (Sandbox Code Playgroud)

例如:

mmm external/rsync
Run Code Online (Sandbox Code Playgroud)

此外,构建系统不会更改输出和中间文件与源代码.一切都进入了/目标目录.


Da *_*ong 5

It depends on the change you want to make.

In an easy case, if the change is local (e.g., adding some new lines into an existing android source files called xxx.c), you can easily run:

mm -B (under the root directory of xxx.c)
adb remount
adb sync
adb reboot
Run Code Online (Sandbox Code Playgroud)

In other cases, say, you create a new system service to replace the old one which is started at boot-up time as shown in init.rc file. Then, you probably need to:

  1. Update init.rc file
  2. Build whole android source
  3. Flash new image