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

Status
Not open for further replies.
Search This thread

naudmick

Senior Member
Jan 26, 2012
608
257
Reims
forum.frandroid.com
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://xdaforums.com/show...php?p=33999592 )
2. KAK ( http://xdaforums.com/show...php?p=12058585 ).
 

Attachments

  • CrossBreederByMick.zip
    678.3 KB · Views: 334
  • rngd.img
    950 KB · Views: 146
Last edited:

DuTY09

Senior Member
Aug 28, 2010
237
100
38
basildon
Samsung Galaxy A51
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://xdaforums.com/show...php?p=33999592 )
2. KAK ( http://xdaforums.com/show...php?p=12058585 ).

had this running on flinnys cm10.1 since the morning and so far so good :)
 

naudmick

Senior Member
Jan 26, 2012
608
257
Reims
forum.frandroid.com
What's the difference between this and the version by idcrisis?

Script IdCrisis :

init.d => 00CrossBreeder
xbin => haveged

#!/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

#!/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
 

gsimeonov

Senior Member
Mar 14, 2010
294
43
Sofia
OK... It's not very clear in the OP. What should I do to use this mod? Should I just flash the ZIP? And if yes, how can I find the service and stop it?

Thanks a lot in advance!
 

leimrey

Senior Member
Nov 23, 2009
812
240
So all we need is to flash the crossbreed zip? What about the rngd.img? fastboot flash?
Sorry but, i can't understand @_@
 

dan-fish

Senior Member
May 27, 2011
1,937
423
Just for anyone who hasn't seen it. This was posted by arcee on his G+
https://plus.google.com/115049428938715274412/posts/GWr72W9zmY2

I should've learned by now that sarcasm doesn't translate well on the internet :)

So to be clear... IMNSHO, the recent entropy pool fad is bull****. The only users of /dev/random are libcrypto (used for cryptographic operations like SSL connections, ssh key generation, and so on), wpa_supplicant/hostapd (to generate WEP/WPA keys while in AP mode), and the libraries that generate random partition IDs when you do an ext2/3/4 format. None of those 3 users are in the path of app execution, so feeding random from urandom does nothing except make random... well... less random

The only conceivable reason some devices may feel faster is because by constantly polling the PRNG, it keeps the device's I/O in constant use (which in turn, depending on device, will make the CPU stick to higher clock frequencies to keep up and/or ramp up the IO scheduler).

I'm not hating on the OP or anything, just thought I'd share the info.
 
Last edited:

vampire36

Senior Member
May 11, 2011
2,170
2,023
Pune
Just for anyone who hasn't seen it. This was posted by arcee on his G+
https://plus.google.com/115049428938715274412/posts/GWr72W9zmY2



I'm not hating on the OP or anything, just thought I'd share the info.

Gosh so happy...
The day my exam ends am gonna post a thread...on all placebo effects and atleast make desire s users smart to not believe in placebo effects...
Entropy bingo just keeps cell at higher frequency thereby making cell feel responsive...
You can achieve same by keeping lower frequency to say 768 or something rather than 245 and upper limit 1200 as always...and voila everythings flying :p :p
Gosh entropy, lag reduction, build prop tweaks (setting some values which are not even used post GB still people say set some windows manager event or debug.some value as 1 makes rom feel smoother which ain't even used in code)
I am gonna do that 1st than port some rom...so people are a bit smart rather than live in placebo world :p
Atleast desire S users for heaven sake are
 
Last edited:
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Just for anyone who hasn't seen it. This was posted by arcee on his G+
    https://plus.google.com/115049428938715274412/posts/GWr72W9zmY2



    I'm not hating on the OP or anything, just thought I'd share the info.

    Gosh so happy...
    The day my exam ends am gonna post a thread...on all placebo effects and atleast make desire s users smart to not believe in placebo effects...
    Entropy bingo just keeps cell at higher frequency thereby making cell feel responsive...
    You can achieve same by keeping lower frequency to say 768 or something rather than 245 and upper limit 1200 as always...and voila everythings flying :p :p
    Gosh entropy, lag reduction, build prop tweaks (setting some values which are not even used post GB still people say set some windows manager event or debug.some value as 1 makes rom feel smoother which ain't even used in code)
    I am gonna do that 1st than port some rom...so people are a bit smart rather than live in placebo world :p
    Atleast desire S users for heaven sake are
    8
    Just for anyone who hasn't seen it. This was posted by arcee on his G+
    https://plus.google.com/115049428938715274412/posts/GWr72W9zmY2

    I should've learned by now that sarcasm doesn't translate well on the internet :)

    So to be clear... IMNSHO, the recent entropy pool fad is bull****. The only users of /dev/random are libcrypto (used for cryptographic operations like SSL connections, ssh key generation, and so on), wpa_supplicant/hostapd (to generate WEP/WPA keys while in AP mode), and the libraries that generate random partition IDs when you do an ext2/3/4 format. None of those 3 users are in the path of app execution, so feeding random from urandom does nothing except make random... well... less random

    The only conceivable reason some devices may feel faster is because by constantly polling the PRNG, it keeps the device's I/O in constant use (which in turn, depending on device, will make the CPU stick to higher clock frequencies to keep up and/or ramp up the IO scheduler).

    I'm not hating on the OP or anything, just thought I'd share the info.
    7
    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://xdaforums.com/show...php?p=33999592 )
    2. KAK ( http://xdaforums.com/show...php?p=12058585 ).
    1
    So all we need is to flash the crossbreed zip? What about the rngd.img? fastboot flash?
    Sorry but, i can't understand @_@

    Yes flash the zip, it's in the OP

    Sent from my supercharged :tank: