AnsweredAssumed Answered

Need to add custom script as service in init.rc for Android 9

Question asked by vinothkumar s on Sep 19, 2019
Latest reply on Oct 9, 2019 by vinothkumar s

Dear NXP,

 

I am working on i.MX 6Quad SABRE-SD with Android 9. I am planning to add USB Re-flash (custom script) service in Android 9.

 

I done the below configuration to start the service. But, the service is not started. Please let me know if I miss anything.

 

Below are the configuration,

 

1. Copy this script (usb-update.sh) to the following location
            /device/fsl/imx6dq/sabresd_6dq

2. Add the following command
            /device/fsl/imx6dq/sabresd_6dq/usb-update.sh: system/bin/usb-update.sh
            To Copy command to copy usb-update.sh to /system/bin location in the following file sabresd_6dqr.mk under following section PRODUCT_COPY_FILES

 

3. Add USB-UPDATE into the PRODUCT_PACKAGE section of sabresd_6dqr.mk file

 

4. Define the service in file init.rc
            service usb-update /system/bin/ usb-update.sh
                     class main

                     user root

                     group root system
                     oneshot
                     seclabel u:r: usb-update:s0

 

5. Add a new Domain “usb-update

      a. Create the file in the following location,
               /device/fsl/imx6dq/sabresd_6dq/sepolicy/usb-update.te
              And add the following content,
                # USB-UPDATE service
               type usb-update, domain;
               type usb-update_exec, exec_type, file_type;

      

               init_deamon_domain(foo)

b. Add the Label “/system/bin/usb-update.sh” to device/fsl/imx6dq/sepolicy/ file_contexts
            /system/bin/usb-update     u:object_r: usb-update_exec:s0

 

 

 

Thanks & Regards,

VinothS.

Outcomes