将制造规则添加到AOSP的主要品牌中 [英] Add a make rule to the main make of AOSP

查看:129
本文介绍了将制造规则添加到AOSP的主要品牌中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在frameworks/base/cmds/myproject处添加了一个新的C ++子项目,它具有自己的Android.mk文件.当我运行make myproject时,它将编译良好,没有问题.

I've added a new C++ subproject at frameworks/base/cmds/myproject and it has its own Android.mk file. When I run make myproject, it'll compile well and no problem.

但是我想将make myproject添加到主make中.我的意思是,当有人在AOSP的根目录下运行make时,我的项目也将包括在内.我该怎么办?

However I want to add make myproject to the main make. I mean, when someone runs make at the root of AOSP, my project to be included as well. What should I do?

推荐答案

您需要调用Android.mk文件.有多种方法,具体取决于您的需求.

You need your Android.mk file to be called. There are various ways to do so, depending on your needs.

如果要为device/下的多个设备编译myproyect,请寻找一个常见的mk文件.例如,这就是高通公司的做法,您可以将其复制为AOSP.

If you want your myproyect to be compiled for several of the devices you have under device/, then look for a common mk file. For example this is how Qualcomm does it, you can copy it for AOSP.

  • 编辑/创建device/common/common.mk
  • 从所需的每个设备拨打该device/common/common.mk的电话. (这是QCM的操作方式:$(call inherit-product, device/qcom/common/common.mk)
  • Edit/create device/common/common.mk
  • Make calls to that device/common/common.mk from every device you want to. (This is how QCM does it: $(call inherit-product, device/qcom/common/common.mk)

如果您只想在特定设备上使用它:

If you want it just for a specific device:

  • 想当然地想为mini_emulator_x86-userdebug进行编译,而mini_emulator_x86-userdebugdevice/generic/mini-emulator-x86中包含它.
  • 编辑mini_emulator_x86.mk
  • 按如下所示编辑或添加PRODUCT_PACKAGES:

  • Let's take for granted you want to compile for mini_emulator_x86-userdebug, which has it's mk file in device/generic/mini-emulator-x86.
  • Edit mini_emulator_x86.mk
  • Edit or add PRODUCT_PACKAGES as follows:

PRODUCT_PACKAGES += \
    myproyect

当心正确的缩进.

这样,当您先执行source build/envsetup.shlunch mini_emulator_x86-user然后执行make时,将到达myproyect.mk.

This way, when you do source build/envsetup.sh and lunch mini_emulator_x86-user and then make, your myproyect.mk will be reached.

为了对其进行测试:

  • 通过添加以下内容来编辑myproject.mk文件:$(warning MyProject MK has been called
  • 致电lunch mini_emulator_x86-user.
  • make | grep MyProject,您无需等待整个编译,如果在最初的几秒钟内输出了某些内容,那么您就很好了.
  • Edit your myproject.mk file by adding something like this: $(warning MyProject MK has been called
  • Call lunch mini_emulator_x86-user.
  • make | grep MyProject and you don't need to wait for the whole compilation, if this outputs something in the first seconds, you're good to go.

有关其他参考,您可以看看高通公司如何组织其device文件夹以及commonbase mk文件.在此处

For additional reference you may take a look at how Qualcomm organizes their device folder, with common and base mk files. Take a look at their open source code here

这篇关于将制造规则添加到AOSP的主要品牌中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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