android13(T) add startup script

modify list

system/core/rootdir/init.rc
system/sepolicy/private/file_contexts_asan
system/sepolicy/private/wallpaper.te
system/sepolicy/private/compat/31.0/31.0.ignore.cil
system/sepolicy/private/compat/32.0/32.0.ignore.cil
system/sepolicy/public/wallpaper.te
system/sepolicy/prebuilts/api/33.0/private/file_contexts_asan
system/sepolicy/prebuilts/api/33.0/private/wallpaper.te
system/sepolicy/prebuilts/api/33.0/private/compat/31.0/31.0.ignore.cil
system/sepolicy/prebuilts/api/33.0/private/compat/32.0/32.0.ignore.cil
system/sepolicy/prebuilts/api/33.0/public/wallpaper.te

As soon as you come up, add the wallpaper.te file according to the previous experience, and compile and report an error directly

mistake one

ermediates/built_28.0_plat_sepolicy -o out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -f /dev/null )"
system/sepolicy/prebuilts/api/28.0/public/wallpaper.te:4:ERROR 'attribute system_file_type is not declared' at token ';' on line 17448:
type wallpaper_exec, system_file_type, exec_type, file_type;
type wallpaper, domain;
checkpolicy:  error(s) encountered while parsing configuration
16:45:14 ninja failed with: exit status 1

related to the file format

I found an example extra_free_kbytes.sh in file_contexts. It looked reliable, so I reused it directly

grep extra_free_kbytes_exec ./system/sepolicy/ -nir
./system/sepolicy/private/file_contexts:233:/system/bin/extra_free_kbytes.sh u:object_r:extra_free_kbytes_exec:s0
./system/sepolicy/private/compat/31.0/31.0.ignore.cil:19: extra_free_kbytes_exec
./system/sepolicy/private/compat/32.0/32.0.ignore.cil:29: extra_free_kbytes_exec
./system/sepolicy/public/extra_free_kbytes.te:3:type extra_free_kbytes_exec, system_file_type, exec_type, file_type;
./system/sepolicy/prebuilts/api/33.0/private/file_contexts:233:/system/bin/extra_free_kbytes.sh u:object_r:extra_free_kbytes_exec:s0
./system/sepolicy/prebuilts/api/33.0/private/compat/31.0/31.0.ignore.cil:19: extra_free_kbytes_exec
./system/sepolicy/prebuilts/api/33.0/private/compat/32.0/32.0.ignore.cil:29: extra_free_kbytes_exec
./system/sepolicy/prebuilts/api/33.0/public/extra_free_kbytes.te:3:type extra_free_kbytes_exec, system_file_type, exec_type, file_type;

error two

[ 76% 19/25] build out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
FAILED: out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
/bin/bash -c "(out/host/linux-x86/bin/treble_sepolicy_tests  -f out/target/product/qssi/system/etc/selinux/plat_file_contexts  -f out/target/product/qssi/vendor/etc/selinux/vendor_file_contexts  -f out/target/product/qssi/system_ext/etc/selinux/system_ext_file_contexts  -f out/target/product/qssi/product/etc/selinux/product_file_contexts                 -b out/target/product/qssi/obj/ETC/base_plat_sepolicy_intermediates/base_plat_sepolicy -m out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil                 -o out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/qssi/obj/ETC/precompiled_sepolicy_intermediates/precompiled_sepolicy                 -u out/target/product/qssi/obj/ETC/base_plat_pub_policy.cil_intermediates/base_plat_pub_policy.cil                 --fake-treble ) && (touch out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0 )"
/home/LA.QSSI.13.0.R1/out/soong/.temp/Soong.python_cq0z3hcd/treble_sepolicy_tests.py:23: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.ccompiler
Unrecognized entrypoint for wallpaper at /oem/bin/wallpaper\.sh
SELinux: The following public types were found added to the policy without an entry into the compatibility mapping file(s) found in private/compat/V.v/V.v[.ignore].cil, where V.v is the latest API level.
wallpaper wallpaper_exec

See examples of how to fix this:
https://android-review.googlesource.com/c/platform/system/sepolicy/+/781036
https://android-review.googlesource.com/c/platform/system/sepolicy/+/852612

The solution is to add wallpaper wallpaper_exec in 31.0.ignore.cil and 32.0.ignore.cil

Mistake three

[ 76% 19/25] build out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
FAILED: out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
/bin/bash -c "(out/host/linux-x86/bin/treble_sepolicy_tests  -f out/target/product/qssi/system/etc/selinux/plat_file_contexts  -f out/target/product/qssi/vendor/etc/selinux/vendor_file_contexts  -f out/target/product/qssi/system_ext/etc/selinux/system_ext_file_contexts  -f out/target/product/qssi/product/etc/selinux/product_file_contexts                 -b out/target/product/qssi/obj/ETC/base_plat_sepolicy_intermediates/base_plat_sepolicy -m out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil                 -o out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/qssi/obj/ETC/precompiled_sepolicy_intermediates/precompiled_sepolicy                 -u out/target/product/qssi/obj/ETC/base_plat_pub_policy.cil_intermediates/base_plat_pub_policy.cil                 --fake-treble ) && (touch out/target/product/qssi/obj/FAKE/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0 )"
/home/LA.QSSI.13.0.R1/out/soong/.temp/Soong.python_cq0z3hcd/treble_sepolicy_tests.py:23: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.ccompiler
Unrecognized entrypoint for wallpaper at /oem/bin/wallpaper\.sh

The most pitfall is this error. I have not been able to find the reason. After two days, I read the error 2. There is a URL prompt of See examples of how to fix this. I went to have a look and found a file file_contexts_asan

Move /oem/bin/wallpaper.sh u:object_r:wallpaper_exec:s0 from file_contexts to file_contexts_asan, the compilation error is solved.

system/core/rootdir/init.rc

on property:persist.test.wallpaper=1
    start  setwallpaper

service setwallpaper /system/bin/sh /oem/bin/wallpaper.sh
    class main
    oneshot
    seclabel u:object_r:wallpaper_exec:s0

system/sepolicy/private/file_contexts_asan

/oem/bin/wallpaper\.sh u:object_r:wallpaper_exec:s0

system/sepolicy/private/wallpaper.te

typeattribute wallpaper coredomain;

init_daemon_domain(wallpaper)

system/sepolicy/private/compat/31.0/31.0.ignore.cil
system/sepolicy/private/compat/32.0/32.0.ignore.cil

    extra_free_kbytes
    extra_free_kbytes_exec
    wallpaper
    wallpaper_exec
    framework_status_prop

system/sepolicy/public/wallpaper.te

# The wallpaper.sh script run by init.
type wallpaper, domain;
type wallpaper_exec, system_file_type, exec_type, file_type;

Guess you like

Origin blog.csdn.net/u012932409/article/details/130420651