Search code examples
androidandroid-source

How do I preserve file permissions in a custom external project added to Android AOSP?


I've downloaded (using repo) the Android 4.0 OS source code (from here - http://source.android.com/). I'm trying to add a new external project (in external/ for example external/libhelloworld) to the build system so that it is built into the system image. In that project I would like to deploy a shell script and have it keep it's permissions which are rwxr-xr-x but when I build it and load the emulator I see the file permissions have been changed to rw-r--r--. I am deploying the script to /etc. My Android.mk file looks like this

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS) LOCAL_MODULE := libhelloworld LOCAL_MODULE_TAGS := optional LOCAL_MODULE_SRC := helloworld.c include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS) LOCAL_MODULE := myscript.sh LOCAL_MODULE_TAGS := optional LOCAL_MODULE_SRC := $(LOCAL_MODULE) LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/helloscripts include $(BUILD_PREBUILT)

I see the script permissions are preserved when it is copied into the intermediates area but then the permissions are changed at some point after that in the build process. Any idea why the script permissions are not being preserved when it gets added into the system image? Is there something I'm missing from my Android.mk?


Solution

  • System image filesytem modifications you can change in this file:

    system/core/include/private/android_filesystem_config.h
    

    Try to change permissions there. If you have problems, please, post here.