I want to run glibc within Android ICS Emulator, for which I have bundled the glibc as a separate folder in AOSP root folder, with Android.mk in it with below contents:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
$(shell mkdir -p $(TARGET_OUT)/glibc/)
$(shell cp -rf $(LOCAL_PATH)/* `pwd`/$(TARGET_OUT)/glibc/)
It copies the entire glibc folder to out/target/product/generic/system/ folder. And make snod includes it in the system.img
There is startglibc.sh and init.sh script withing glibc folder which gets copied to /system/glibc & /system/glibc/root/ folder respectively.
I have busybox compiled and copied to /system/bin/ folder.
Content of /system/glibc/startglibc.sh is as below:
BUSYBOX=/system/bin/busybox
mnt=/system/glibc
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export ROOT=/root
${BUSYBOX} chroot $mnt /root/init.sh
The startglibc.sh is invoked from init.goldfish.rc as below:
service myscript /system/bin/busybox ash /system/glibc/startglibc.sh
class main
oneshot
I have given 777 and root:root as file permission for init.sh using system/core/include/private/android_filesystem_config.h as below:
{ 00777, AID_ROOT, AID_ROOT, "system/glibc/root/init.sh" },
During boot time the startglibc.sh script is getting called but while executing chroot it gives permission denied error.
Am I missing anything for doing chroot using init.sh? Or am I copying the glibc folder wrongly during Android AOSP build?