5,600,053 Members 42,632 Now Online
XDA Developers Android and Mobile Development Forum

[MOD JB, ICS, GB / 31/01] CrossBreeder (uRandom) for entropy based lag reduction

Tip us?
 
naudmick
Old
(Last edited by naudmick; 31st January 2013 at 03:07 AM.)
#1  
Senior Member - OP
Thanks Meter 138
Posts: 250
Join Date: Jan 2012
Thumbs up [MOD JB, ICS, GB / 31/01] CrossBreeder (uRandom) for entropy based lag reduction

Hi,

This is a combination of 3 different methodologies to reduce Android lag due to low entropy.

1. Change wakeup threshold kernel parameters ala KAK.
2. Run rngd ala Seeder but not in intensive feed mode.
3. Remove /dev/random as it's blocking. Link it to non-blocking /dev/urandom. Since /dev/random is blocking and designed to protect us from Quantum alien cryptographers with mathematical certainty and urandom is non blocking pseudo-random device that most apps and OSs are using anyway.

I'm getting some good results on all Android devices I've tried this on.

You can check your results with this tool:

http://play.google.com/store/apps/de...ndentropyavail

You should get consistent values around the maximum 4096 with this mod.

This is the listing of /etc/init.d/00CrossBreeder (Can be run manually too) :

Code:
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
busybox mknod -m 666 /dev/random.fake c 1 8
busybox chown root.root /dev/random.fake
rngd -t 10 -T 1 -s 256 -W 80% -o /dev/random.fake
sleep 2
echo -8 > /proc/$(busybox pgrep rngd)/oom_adj
renice 5 `busybox pidof rngd`
rm /dev/random.fake
Your thoughts and experiences welcome.

Notes:

1. You can put the code in /etc/init.d/00CrossBreeder and make it executable with:

chmod 755 /etc/init.d/00CrossBreeder

This should run on every boot if you have init.d support. You can also run it manually.

2. You'll need to rename the attached rngd.img binary to /system/xbin/rngd and make it executable with:

cp rngd.img /system/xbin/rngd
chmod 755 /system/xbin/rngd

3. You'll need to stop the seeder service and disable auto start ( IMPORTANT as seeder rngd can take high cpu with the link enabled). Though you can run the app to see available entropy.

or flash zip ( update 31/01/13 ) => CrossBreederByMick.zip

CREDITS:

1. Seeder. This rngd binary is from the seeder util. ( http://forum.xda-developers.com/show...php?p=33999592 )
2. KAK ( http://forum.xda-developers.com/show...php?p=12058585 ).
Attached Files
File Type: zip CrossBreederByMick.zip - [Click for QR Code] (678.3 KB, 188 views)
File Type: img rngd.img - [Click for QR Code] (950.0 KB, 70 views)
The Following 7 Users Say Thank You to naudmick For This Useful Post: [ Click to Expand ]
 
ReznovHuang
Old
#2  
Member
Thanks Meter 16
Posts: 53
Join Date: Jul 2012
Location: Yangzhou
rngd.img.......

http://forum.xda-developers.com/show....php?t=2113150
 
DuTY09
Old
#3  
DuTY09's Avatar
Senior Member
Thanks Meter 81
Posts: 196
Join Date: Aug 2010
Location: basildon
Quote:
Originally Posted by naudmick View Post
Hi,

This is a combination of 3 different methodologies to reduce Android lag due to low entropy.

1. Change wakeup threshold kernel parameters ala KAK.
2. Run rngd ala Seeder but not in intensive feed mode.
3. Remove /dev/random as it's blocking. Link it to non-blocking /dev/urandom. Since /dev/random is blocking and designed to protect us from Quantum alien cryptographers with mathematical certainty and urandom is non blocking pseudo-random device that most apps and OSs are using anyway.

I'm getting some good results on all Android devices I've tried this on.

You can check your results with this tool:

http://play.google.com/store/apps/de...ndentropyavail

You should get consistent values around the maximum 4096 with this mod.

This is the listing of /etc/init.d/00CrossBreeder (Can be run manually too) :

Code:
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
busybox mknod -m 666 /dev/random.fake c 1 8
busybox chown root.root /dev/random.fake
rngd -t 30 -T 1 -s 256 -W 80% -o /dev/random.fake
sleep 2
echo -8 > /proc/$(busybox pgrep rngd)/oom_adj
renice 5 `busybox pidof rngd`
rm /dev/random.fake
Your thoughts and experiences welcome.

Notes:

1. You can put the code in /etc/init.d/00CrossBreeder and make it executable with:

chmod 755 /etc/init.d/00CrossBreeder

This should run on every boot if you have init.d support. You can also run it manually.

2. You'll need to rename the attached rngd.img binary to /system/xbin/rngd and make it executable with:

cp rngd.img /system/xbin/rngd
chmod 755 /system/xbin/rngd

3. You'll need to stop the seeder service and disable auto start ( IMPORTANT as seeder rngd can take high cpu with the link enabled). Though you can run the app to see available entropy.

or flash zip ( update 29/01/13 ) => CrossBreederByMick.zip

CREDITS:

1. Seeder. This rngd binary is from the seeder util. ( http://forum.xda-developers.com/show...php?p=33999592 )
2. KAK ( http://forum.xda-developers.com/show...php?p=12058585 ).
had this running on flinnys cm10.1 since the morning and so far so good
Samsung Galaxy S4
Current Rom--->?
Old Phones
HTC Desire S SAGA PVT SHIP S-OFF (REVOLUTIONARY)<---Passed Down To Son
 
remusator
Old
#4  
remusator's Avatar
Senior Member
Thanks Meter 62
Posts: 330
Join Date: Jul 2012
Quote:
Originally Posted by DuTY09 View Post
had this running on flinnys cm10.1 since the morning and so far so good
Can you translate it to "human language" ?
Or is it for devs only ?
HTC One
4.19.401.11 (And 4.4.2, Sense 5.5)
Silver M7, no case, no foil

HTC Desire S
Stock pre-rooted gingerbread
Nexus 7 16G 2012 - Stock JB 4.2.2
(no need to root)
 
DuTY09
Old
#5  
DuTY09's Avatar
Senior Member
Thanks Meter 81
Posts: 196
Join Date: Aug 2010
Location: basildon
Quote:
Originally Posted by remusator View Post
Can you translate it to "human language" ?
Or is it for devs only ?
basically all this does is free up more resources which helps reduce lag well that's what I've gathered anyways I'm probably wrong but I'm not a dev either I just flashed the zip lol
Samsung Galaxy S4
Current Rom--->?
Old Phones
HTC Desire S SAGA PVT SHIP S-OFF (REVOLUTIONARY)<---Passed Down To Son
 
anazhd
Old
#6  
anazhd's Avatar
Senior Member
Thanks Meter 287
Posts: 1,144
Join Date: Jun 2012
Location: Kuala Lumpur

 
DONATE TO ME
well, just use Seeder. End of story.

btw, are you a leecher or what? kinda same post like the one on this thread by idcrisis .
I LIKE TURTLES
but this one is a tortoise
 
naudmick
Old
#7  
Senior Member - OP
Thanks Meter 138
Posts: 250
Join Date: Jan 2012
This yarn is a non-development? If yes what is the Idcrisis with a tweak added!
But said that everyone does not parcour Forum fro!
 
totalnoob34
Old
#8  
totalnoob34's Avatar
Senior Member
Thanks Meter 90
Posts: 397
Join Date: May 2012
Location: Alessandria
Default R: [MOD ICS, GB / 29/01] CrossBreeder (uRandom) for entropy based lag reduction

It feels better and smoother than with seeder only. Running fine on JellyTime 4.2

Inviato dal mio Desire S
If I helped, hit the THANKS button!

->LOOKING FOR AN ITALIAN TRANSLATOR?<-
Just PM me and I'll do the job for you!
 
oddoneout
Old
#9  
oddoneout's Avatar
Senior Member
Thanks Meter 69
Posts: 329
Join Date: Sep 2012
What's the difference between this and the version by idcrisis?
HTC Desire X
ROM: fulmix.ROM 1.1
Mods: CrossBreeder, Greenify, Pimp My Rom tweaks


HTC Desire S (Retired)
S-OFF Revolutionary
ROM: Andromadus CM10
 
naudmick
Old
#10  
Senior Member - OP
Thanks Meter 138
Posts: 250
Join Date: Jan 2012
Quote:
What's the difference between this and the version by idcrisis?
Script IdCrisis :

init.d => 00CrossBreeder
xbin => haveged

Quote:
#!/system/bin/sh

busybox sysctl -w kernel.random.write_wakeup_threshold=4096

busybox sysctl -w kernel.random.read_wakeup_threshold=1333

rm /dev/random && ln /dev/urandom /dev/random

if pgrep haveged > /dev/null; then
echo Haveged already running. Not starting another instance.
exit 1
fi

haveged -w 4096
Script me :

init.d => 00CrossBreeder + 04ramtweaks + 30sdcardspeedfix + 93zipalign
xbin => rngd

Quote:
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
busybox mknod -m 666 /dev/random.fake c 1 8
busybox chown root.root /dev/random.fake
rngd -t 10 -T 1 -s 256 -W 80% -o /dev/random.fake
sleep 2
echo -8 > /proc/$(busybox pgrep rngd)/oom_adj
renice 5 `busybox pidof rngd`
rm /dev/random.fake

THREAD CLOSED
Subscribe
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes