在/用Android.mk系统复制多个txt文件 [英] Copy multiple txt files in /system using Android.mk

查看:1807
本文介绍了在/用Android.mk系统复制多个txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:我要的多个复制txt文件在/系统中使用Android.mk(Android设备)

Aim : I want to copy multiple txt files in /system ( of Android Device ) using Android.mk

我的发现:

我们可以使用两种方法复制文件
1)使用PRODUCT_C​​OPY_FILES。这是从设备做/ / makefile.mk

We can copy file using two approach 1) Use PRODUCT_COPY_FILES. This is done from devices/ / makefile.mk

例如:

PRODUCT_COPY_FILES := \
  frameworks/base/data/etc/telephony.gsm.xml:system/etc/permissions/telephony.gsm.xml \
  some/other/sourc/file:some/destination \
  some/other/sourcefile2: some/destination

2)使用BUILD_ preBUILD

2) Using BUILD_PREBUILD

例如:

##############copy txt file##################
include $(CLEAR_VARS)
#LOCAL_MODULE := mydata.txt
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/myfolder
LOCAL_SRC_FILES := mydata.txt
include $(BUILD_PREBUILT)

以上的工作使在建/目标/产品/ core.mk mydata.txt的条目

for above to work make entry of mydata.txt in build/target/product/core.mk

我的具体查询:
现在我可以通过重新编写上述code复制使用第二个方法的多个文件
一个接一个地。但我想用第二个方法(BUILD_PERBUILD),而无需重新编写code复制多个txt文件的所有文件。

My Specific Query is : Now i can copy multiple files using 2nd approach by re-writing the above code one after the other. But i want to use 2nd approach (BUILD_PERBUILD ) to copy multiple txt files without re-writing code for all files.

1)我可以做到只用一个包括$(BUILD_ preBUILT)调用?

1) Can i do that with just one include $(BUILD_PREBUILT) call ?

2)可以BUILD_MULTI_ preBUILD被用来解决的目的何在?怎么样 ?

2 )Can BUILD_MULTI_PREBUILD be used to solve the purpose? how ?

推荐答案

好吧,我发现一个黑客(我知道存在的),我不是在寻找,但它的工作
并解决了我的问题非常简单的方式。

Ok, I found one hack ( which i knew exists ) ,which i was not looking for but it worked and solved my problem in a very simple way.

您可以在MK文件运行shell命令。

You can run shell commands in mk file.

所以,如果你想只在一个单一的去使用多个文件复制以下code并将其放置在您的MK文件。

So if you want to copy multiple files just in a single go use following code and place it in your mk file.

在以下情况下,我需要复制的文件都在file_folder(目录),这是在我的MK文件同一目录present。我和婉的所有文件复制present在file_folder系统/ file_folder。

In following scenario the files i need to copy are present in file_folder ( directory ) , which is in same directory where my mk file is. And i wan to copy all the files present in file_folder to system/file_folder.

#create a directory in /system/
    $(shell mkdir -p $(TARGET_OUT)/file_folder/)
#copy stuff
    $(shell cp $(LOCAL_PATH)/file_folder/* `pwd`/$(TARGET_OUT)/file_folder/)

这工作得很好。所以,现在在所有我们有3种方式来做到这一点。希望这将有助于我这样的人。

This worked fine. So now in all we have 3 ways to do it. Hope it will help someone like me.

这篇关于在/用Android.mk系统复制多个txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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