EMUI8 using split sepolicy, there isn't sepolicy in ramdisk.img, you get get sepolicy from vendor.img /etc/selinux/precompiled_sepolicy and rename it to sepolicy.
when patching sepolicy using supolicy, add --sdk=26 or it won't work.
adb shell su supolicy --file /sdcard/sepolicy/sepolicy /sdcard/sepolicy/sepolicy_out --sdk=26
Since there is not a custom recovery , so i have to make a boot.img with supersu inside to root.
But I came up with two problems:
1. i found no article about how to patch init manually, so i have to get the init from mate 10's root boot.img, but i'd like to learn how to patch the init manually
2. i patch the sepolicy , but it seems not work
the stock vendor.img/etc/selinux/precompiled_sepolicy is here
my patched sepolicy is here.
I will describe all my detail modifications below, please someone point out where i did wrong. Thanks thanks a lot
This is my stock boot.img, i get it from the official full-ota update files
This is my modified boot.img
All i modified is listed below:
1. Unzip the update.zip
2. Unpack it with Huawei Update Extrator
3. Extract ramdisk.img, vendor.img, recovery_ramdis.img
4. Unpack ramdisk with bootimg.exe
5. replace init
6. copy res/.su dir
7. copy /sbin/fbe_bypass.sh /sbin/launch_daemonsu.sh /sbin/tar
All the files above i get from @mankindtw 's mate 10 's root boot.img)
8. patch sepolicy which i get from vendor.img /etc/selinux/precompiled_sepolicy and recovery_ramdis.img
on a rooted phone (supersu 2.82 sr5) and patch sepolicy follow this guide
9. rename the patched sepolicy to sepolicy and put into initrd(this is bootimg.exe's unpack dir)
10. modify the cpiolist.txt file, add the added dirs and files
11. repack the bootimg with a name boot-root-b122.img
12. fastboot flash ramdisk boot-root-b122.img
But it does not work, i can't get root.
I've tried to replace other's sepolicy , and it can get root right, but have some other issues( Looking at the screen, it will keep turning on does not work)
So anybody can point what should i do ?
How to patch the stock sepolicy right?
How to patch init manually?
Is there any other mistakes i've taken?