Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Thread Closed

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

OP naudmick

29th January 2013, 02:22 AM   |  #1  
OP Senior Member
Thanks Meter: 147
 
283 posts
Join Date:Joined: Jan 2012
More
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, 229 views)
File Type: img rngd.img - [Click for QR Code] (950.0 KB, 92 views)
Last edited by naudmick; 31st January 2013 at 04:07 AM.
The Following 7 Users Say Thank You to naudmick For This Useful Post: [ View ]
29th January 2013, 04:58 AM   |  #2  
Member
Flag Yangzhou
Thanks Meter: 16
 
53 posts
Join Date:Joined: Jul 2012
rngd.img.......

http://forum.xda-developers.com/show....php?t=2113150
30th January 2013, 12:36 AM   |  #3  
DuTY09's Avatar
Senior Member
Flag basildon
Thanks Meter: 81
 
196 posts
Join Date:Joined: Aug 2010
More
Thumbs up
Quote:
Originally Posted by naudmick

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
30th January 2013, 10:23 AM   |  #4  
remusator's Avatar
Senior Member
Thanks Meter: 75
 
372 posts
Join Date:Joined: Jul 2012
More
Quote:
Originally Posted by DuTY09

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 ?
30th January 2013, 11:20 AM   |  #5  
DuTY09's Avatar
Senior Member
Flag basildon
Thanks Meter: 81
 
196 posts
Join Date:Joined: Aug 2010
More
Quote:
Originally Posted by remusator

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
30th January 2013, 01:25 PM   |  #6  
anazhd's Avatar
Senior Member
Flag Los Santos
Thanks Meter: 375
 
1,285 posts
Join Date:Joined: Jun 2012
Donate to Me
More
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 .
30th January 2013, 01:57 PM   |  #7  
OP Senior Member
Thanks Meter: 147
 
283 posts
Join Date:Joined: Jan 2012
More
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!
30th January 2013, 07:40 PM   |  #8  
totalnoob34's Avatar
Senior Member
Flag Alessandria
Thanks Meter: 116
 
465 posts
Join Date:Joined: May 2012
More
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
31st January 2013, 01:20 AM   |  #9  
oddoneout's Avatar
Senior Member
Thanks Meter: 73
 
336 posts
Join Date:Joined: Sep 2012
More
What's the difference between this and the version by idcrisis?
31st January 2013, 02:49 AM   |  #10  
OP Senior Member
Thanks Meter: 147
 
283 posts
Join Date:Joined: Jan 2012
More
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 to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes