You may follow the same structure as the one proposed in this other question, but use this macro:
PRODUCT_COPY_FILES += \
device/common/my_bin.bin:cache/my_bin.bin \
device/common/my_so.so:system/art/my_so.so
This works as follows:
- The file is copied from left to(:) right.
- When the image is generated, in this case
cache
or system
, it would be generated with the files contained in those folders.
- As we have copied our files to that destination, when
system.img
is generated, our file will be contained.
Also, the order in which this files are copied, matters. For instance if you are copying a file that already exists, hence, you want it replaced. (As your libart.so
), you would need YOUR call to that copy to be done before the default one.
For this, I recommend doing:
source build/envsetup.sh
lunch <<device>>
mgrep libart.so
-> This does a grep through mk
files, so you can see where the default copy is done.
- Insert
$(info whatever)
calls in desired mk
files to trace where is a good spot to add your PRODUCT_COPY_FILES
.
It's not easy to answer where to add it. I have never modified libart.so
myself, but I have copied many files this way and it works like a charm.
I hope it works for your case as well.