Copy multiple txt files in /system using Android.mk

后端 未结 2 2025
日久生厌
日久生厌 2021-02-01 10:07

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

My Findings :

We can copy file using two approach 1)

相关标签:
2条回答
  • 2021-02-01 10:25

    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.

    You can run shell commands in mk file.

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

    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/)
    

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

    0 讨论(0)
  • 2021-02-01 10:30

    See the following example in Android font handling: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/Android.mk#66

    This creates a makefile function for a single font file, and uses a foreach loop to iterate over multiple files: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/Android.mk#79

    You can use any mechanism to populate font_src_files

    0 讨论(0)
提交回复
热议问题