3

I am building AOSP for a custom device (let's call it mycustomdevice), and have successfully built, imaged and deployed an Engineering build (TARGET_BUILD_VARIANT=eng).

However, when I try to do a build using either a user or userdebug build, the data directory is no longer created (myAOSP/out/target/product/mycustomdevice/data). Thus, there is also no userdata.img created.

I've done a full purge of the AOSP source directory (thus the out directory is purged too), and re-loaded source. I then perform a lunch mycustomdevice-userdebug (or mycustomdevice-user), and then run the m command. Nothing else has changed between eng and user/userdebug, and a repeat of the same steps with the build variant set as eng will result in the data directory being included again.

I can't find any documentation on the inclusion of the data directory. I understand from a training session I did several months ago that the data staging directory is optional. What should I do to ensure for all TARGET_BUILD_VARIANTs that the data directory gets created?

CJBS
  • 15,147
  • 6
  • 86
  • 135

1 Answers1

2

This is just an outcome of the install target for a couple of test programs that are included in the -eng build. For example, in one of the test .mk files, the following lines exist:

LOCAL_MODULE_TAGS := eng tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativebenchmark

When the user or userdebug builds are performed, the LOCAL_MODULE_TAGS settings (eng/tests) no longer match, and thus the output isn't put in the data directory. As there are no ouput to go in the $(TARGET_OUT_DATA) directory (which resolves to myAOSP/out/target/product/mycustomdevice/data). Thus, as there's no output, the directory is never created.

Note that the $(TARGET_OUT_DATA) is just a staging directory - and it doesn't mean that there will be no /data directory on the Android device. When the Android device itself first initializes, the /data directory is created based on instructions in the myAOSP/system/core/rootdir/init.rc file, which initialize the elements of the Android system.

In my case, there is a post-build step script that creates the image for all partitions, and bundles it up into a single image to be written in one go to an SD card. This script expects the data directory, even if it's empty. So to fix this problem, I simply had to create the /data directory like this:

~/myAOSP$ mkdir out/target/product/mycustomdevice/data
CJBS
  • 15,147
  • 6
  • 86
  • 135