phhusson / super-bootimg

Tools to edit Android boot.img. NDK buildable, to be usable in an update.zip
GNU General Public License v3.0
226 stars 121 forks source link

Silence "KERNEL IS NOT SEANDROID ENFORCING" warn #30

Closed jesec closed 8 years ago

jesec commented 8 years ago
phhusson commented 8 years ago

(this sounds stupid from Samsung, is this for real?) I'm not a fan of that at all.

I see two possibilities:

jcadduono commented 8 years ago

yeah it's pretty stupid, here's how i do it for simplicity's sake: https://github.com/jcadduono/lazyflasher/commit/f7235f74394bebceee2253ce92e2d706ef834607

phhusson commented 8 years ago

I don't extract properties at the moment, but that could be useful anyway Thanks

jesec commented 8 years ago

SELinux contexts of some CM-based ROMs won't contain KNOX. BL(not system) detect this string and pop warning. Hence, solution 1 is not effective.

jesec commented 8 years ago

About solution 2: if (is_samsung_phone && not_contain_seandroidenforce) problem_remained; /* Congratulations */

jesec commented 8 years ago

jcadduono's solution is effective but it needs "getprop". My solution is the most simple way.(and it won't brick support to other devices, as I mentioned.)

phhusson commented 8 years ago

I've seen so many weird bootloaders I wouldn't bet on it. Especially, this place would be where bootloader put signatures. If it tries to read this as signature, it might well crash. Additionnally, since Samsung found clever to put something there, why wouldn't some other OEMs? I'm fairly confident you haven't tested this on both Allwinner, Mediatek, Rockchip and Spreadtrum devices. (Granted, rockchip devices aren't supported ATM)

phhusson commented 8 years ago

@jcadduono Just to be sure, your getprop reads system/build.prop, not default.prop?

jcadduono commented 8 years ago

It reads default.prop (of TWRP) and getprop is included in TWRP. I suppose you could also choose to check both default.prop in the boot ramdisk and /system/build.prop. grep -iq 'ro.product.manufacturer=samsung' *.prop would definitely do the trick in both those cases. If you want to get really into the grep,

grep -iq '^\s*ro\.product\.\(brand\|manufacturer\)\s*=\s*samsung\s*$' *.prop

is nice too. (check both brand and manufacturer, at least one of them should be set! and ignore extra legal whitespace and dots who are not really dots)

That prop should be properly set on all Samsung devices I know of, and I maintain at least 60% of them lol. It is included by PRODUCT_MANUFACTURER := samsung in any of the mk files, usually omni_device.mk or cm.mk

I use grep -iq because some devs may have made it Samsung or SAMSUNG instead of samsung.

phhusson commented 8 years ago

Oh right, nice, thanks

jesec commented 8 years ago

@phhusson That's possible, admittedly. I will submit another commit based on jcadd's way soon. Also i will submit a commit that adds LZ4-compressed ramdisk support.