Remove All Ads from XDA

[How to] Set Selinux to permissive on boot

832 posts
Thanks Meter: 461
 
By padhu1989, Senior Member on 18th February 2015, 06:13 PM
Post Reply Email Thread
1st March 2015, 04:48 PM |#21  
Senior Member
Thanks Meter: 16
 
More
You forgotten about init.d, because when i wrote in terminal "mkdir ..." i get error.
I install init.d enabler from GP and i get info "Your kernel is not support init.d". What the ..?
I have CM12 ofcourse.
 
 
1st March 2015, 06:11 PM |#22  
Senior Member
Thanks Meter: 305
 
More
Quote:
Originally Posted by DualJoe

Just dd the kernel partition and hex-edit the kernel command line (androidboot.selinux=permissive).

Can you please elaborate?
1st March 2015, 08:25 PM |#23  
DualJoe's Avatar
Senior Member
DE
Thanks Meter: 716
 
More
Quote:
Originally Posted by Gundabolu SC

Can you please elaborate?

On nightly roms (AOSP, CM..) you can take the boot.img directly from the zip file. If you want to change the current running kernel you would have to dump it with dd. For my device its something like this:
Code:
busybox dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/boot.img bs=1M
Edit the kernel command line in boot.img correspondingly (with a hex editor) and flash the kernel back. Its right at the beginning and is not covered by any checksum. I use a nightly CM12 zip image, delete the rom stuff (/system) and change the updater-script (META-INF/com/google/android/updater-script) so it only flashes the kernel. Alternatively, it can be reflashed with dd as well.
Just append this to kernel command line (marked in blue below). Don't forget the leading space.
Code:
androidboot.selinux=permissive
The Following 12 Users Say Thank You to DualJoe For This Useful Post: [ View ] Gift DualJoe Ad-Free
1st March 2015, 08:55 PM |#24  
Senior Member
Thanks Meter: 305
 
More
Quote:
Originally Posted by DualJoe

On nightly roms (AOSP, CM..) you can take the boot.img directly from the zip file. If you want to change the current running kernel you would have to dump it with dd. For my device its something like this:

Code:
busybox dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/boot.img bs=1M
Edit the kernel command line in boot.img correspondingly (with a hex editor) and flash the kernel back. Its right at the beginning and is not covered by any checksum. I use a nightly CM12 zip image, delete the rom stuff (/system) and change the updater-script (META-INF/com/google/android/updater-script) so it only flashes the kernel. Alternatively, it can be reflashed with dd as well.

Sadly i own a Moto Maxx which has got no cm12 but when i used the same hex editor as yours on STOCK boot.img, this is what i get, and the rest of it is some jibber jabber.... Not even a mention of selinux in the understandable stuff!
Attached Thumbnails
Click image for larger version

Name:	Untitled.png
Views:	2034
Size:	54.6 KB
ID:	3189495  
1st March 2015, 09:09 PM |#25  
DualJoe's Avatar
Senior Member
DE
Thanks Meter: 716
 
More
Quote:
Originally Posted by Gundabolu SC

Not even a mention of selinux in the understandable stuff!

You have to paste it there yourself. The blue marked part is the new stuff. Just append it with copy&paste (Edit/Clipboard data/Write) or write it by hand.

androidboot.selinux=permissive

Don't forget the 'space' delimiter in front of it.
The Following User Says Thank You to DualJoe For This Useful Post: [ View ] Gift DualJoe Ad-Free
1st March 2015, 09:21 PM |#26  
Senior Member
Thanks Meter: 305
 
More
Quote:
Originally Posted by DualJoe

You have to paste it there yourself. The blue marked part is the new stuff. Just append it with copy&paste (Edit/Clipboard data/Write) or write it by hand.

androidboot.selinux=permissive

Don't forget the 'space' delimiter in front of it.

Adding those lines is making the boot.img larger than my device's partition size so its failing... i even tried removing few lines and adding these but fails on me cuz partition size is 16,384 and the modified boot.img size is 16,385!!

Edit:- Just used another Hex editor and it works perfectly!!! This was one of the easiest method so far!!
Can i put my the edited boot.img in my device forum and credit to you of course?
1st March 2015, 09:56 PM |#27  
DualJoe's Avatar
Senior Member
DE
Thanks Meter: 716
 
More
Quote:
Originally Posted by Gundabolu SC

Adding those lines is making the boot.img larger than my device's partition size so its failing... i even tried removing few lines and adding these but fails on me cuz partition size is 16,384 and the modified boot.img size is 16,385!!

You maybe used Edit/Clipboard data/paste on Winhex. That definitely increases file sizes and cannot work. That's why i explicitly wrote (Edit/Clipboard data/Write). That simply overwrites data. It shouldn't tamper with size or any other data at all.

Quote:
Originally Posted by Gundabolu SC

Edit:- Just used another Hex editor and it works perfectly!!! This was one of the easiest method so far!!
Can i put my the edited boot.img in my device form and credit to you of course?

Not sure if i understand that correctly but you have to flash it back to the same device, yes. There is nothing else to change. Just make sure you know how to flash that properly and it lands in BOOT partition where it comes from and nowhere else. Maybe keep a backup or rom images available on sdcard in case it doesn't work for you (for whatever reason).
The Following 2 Users Say Thank You to DualJoe For This Useful Post: [ View ] Gift DualJoe Ad-Free
1st March 2015, 09:59 PM |#28  
Senior Member
Thanks Meter: 305
 
More
Quote:
Originally Posted by DualJoe

You maybe used Edit/Clipboard data/paste on Winhex. That definitely increases file sizes and cannot work. That's why i explicitly wrote (Edit/Clipboard data/Write). That simply overwrites data. It shouldn't tamper with size or any other data at all.


Not sure if i understand that correctly but you have to flash it back to the same device, yes. There is nothing else to change. Just make sure you know how to flash that properly and it lands in BOOT partition where it comes from and nowhere else. Maybe keep a backup or rom images available on sdcard in case it doesn't work for you (for whatever reason).

I know a little bit about android as well! I already had the boot.img dumped from my phone... Edited the boot.img with your instructions... Now flashed back the boot.img using fastboot! Everything is set!! Gonna share the modified boot.img on my Device's FORUM!
The Following User Says Thank You to Gundabolu SC For This Useful Post: [ View ] Gift Gundabolu SC Ad-Free
1st March 2015, 10:15 PM |#29  
DualJoe's Avatar
Senior Member
DE
Thanks Meter: 716
 
More
Quote:
Originally Posted by Gundabolu SC

I know a little bit about android as well! I already had the boot.img dumped from my phone... Edited the boot.img with your instructions... Now flashed back the boot.img using fastboot! Everything is set!! Gonna share the modified boot.img on my Device's FORUM!

Now it makes sense. 'device forum' not 'device from'.
Sure, post as you like and thanks for testing that method.
1st March 2015, 10:19 PM |#30  
Senior Member
Thanks Meter: 305
 
More
Quote:
Originally Posted by DualJoe

Now it makes sense. 'device forum' not 'device from'.
Sure, post as you like and thanks for testing that method.

Pardon me for that typo!
Its 3 A.M from where i am from, i am half asleep!
The Following User Says Thank You to Gundabolu SC For This Useful Post: [ View ] Gift Gundabolu SC Ad-Free
2nd March 2015, 12:34 PM |#31  
Senior Member
Flag São Paulo
Thanks Meter: 19
 
More
I have just tried the method in the OP and it works like a charm! Running CM12.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes