15

I'm building AOSP from source. What I would like to do is to include a few prebuilt files in the generated system.img as part of the make process. I'm trying to find the actual file that creates the system.img and add a few lines there. Any idea?

Thank you in advance.

Yury
  • 20,618
  • 7
  • 58
  • 86
Erez A. Korn
  • 2,697
  • 3
  • 24
  • 32

4 Answers4

11

A good way of adding custom files to the system.img is to add them under vendor/your_name/product_you_want_to_add_them/proprietary/your_files_go_here and add a custom make file called device-product_name.mk.

After that's done, just define which files are to be copied from the proprietary folder and inside (e.g. vendor/samsung/crespo/device-vendor.mk add to call your device make file).

CJBS
  • 15,147
  • 6
  • 86
  • 135
GiantDwarf
  • 164
  • 2
  • 9
7

Just put your source code to the Packages/apps directory,then make sure your project has a correct make file like other project in the apps directory.You will make the package prebuilt after finish the android build.

dreamtale
  • 2,905
  • 1
  • 26
  • 38
  • This will work with source I have, but I need it for prebuilt apk files. Any idea? – Erez A. Korn Dec 06 '11 at 10:49
  • You mean you have a apk without the source? I found some info in the `build/core/build-system.html` **How to add another component to the build - Android.mk templates** You have a new library, a new app, or **a new executable**. For each of the common types of modules, there is a corresponding file in the templates directory. But i do not found this directory in my source code, hope this will help you. – dreamtale Dec 07 '11 at 04:27
  • Basically, I'm trying to add the google framework to the emulator I'm building. It works perfectly when I'm adding it myself after the build, but then it's too late to add it to the system.img. – Erez A. Korn Dec 11 '11 at 15:14
  • 1
    Adding google framework to emulator?I was confused. Anyway, if you just want a APK to be prebuilt, you can sign the APK with the **system sign key**(I'm not sure that when execute make snod whether signing will be done automatically. ) ,then put it in the ***out/target/product/system/app***, finally, excute make snod. – dreamtale Dec 12 '11 at 11:54
2

To add a prebuilt file to a build, find a .mk file which makes sense for your project and add the file under PRODUCT_COPY_FILE. It looks like this

 PRODUCT_COPY_FILE += your/build/tree/$FILE:path/to/location/on/device/$FILE

Using a separate vendor tree is following good domain-driven principles...but is perhaps overkill for a single binary. Examine the makefiles you already use, there is often prebuilt apks already being added that you can piggyback on. device and existing vendor trees are good places to start looking. Maintaining an entirely new project is not something to be taken lightly, in my opinion.

mateor
  • 1,293
  • 1
  • 16
  • 19
0

If you want to add programs in the system.img, go to the vendor, then go to the operator, then go the app and enter the files inside the app If you use the roms modification program, the program name is rom helper, it modifies prmission to 0755, and it modifies UserID 2000, thus adding the apk to rom