OUTDATED - [MOD] CrossBreeder - Lag-/Entropy+/DNS+/Tether+/Ads-/Censors-/.bit support!!

Search This thread

fivefour

Senior Member
Jun 7, 2010
770
1,341
Emerald Coast
bit.ly
See the third post for full information about the functionality of CrossBreeder from the original creator @idcrisis. It's his blood, sweat, and tears that created CrossBreeder. I provided an app, fram, and pixelserv along with other ideas and support.

Thanks.

Please use the 12.1.2013 edition of CrossBreeder attached so I can properly diagnose and support the MOD moving forward.

The source has been pushed to github, the URL is: https://github.com/f1vefour/CrossBreeder

If you wish to help simply clone the project, make changes and create a pull request. I will review/test and commit if they are helpful.

I appreciate all the help I can get, both with the CrossBreeder scripts and with general testing and support in this thread. I have a wife and three semi-wonderful kids so time is limited, I will work on and support the project the best I can with the time I have.

Thanks,
Tim (fivefour)

If you have an issue please get a logcat, post it to pastebin and link it along with your issue. Otherwise I probably can't help you.
 

Attachments

  • CrossBreeder_12-1-2013.zip
    1.8 MB · Views: 120,045
  • CrossBreeder_Uninstall_12-1-2013.zip
    943.1 KB · Views: 53,885
Last edited:

fivefour

Senior Member
Jun 7, 2010
770
1,341
Emerald Coast
bit.ly
I just wanted to drop in and share the application and code I started on before I ran short on time.

The app is on github under my CrossBreeder repo in the entropy branch. For those who want to use it as is you can simply download the APK.

https://raw.githubusercontent.com/f1vefour/CrossBreeder/entropy/bin/CrossBreeder.apk

quqadyry.jpg


You must first flash the zip in the original post of this thread if you haven't already, the app simply allows you to control the major components of CrossBreeder.

Note:
You must touch the toggle buttons instead of sliding them, if you slide them on/off it will not function.

Enjoy,
Tim

Additional Credit: @bigsupersquid for his improvements of additional switches and for creating the git pull for said changes.
 
Last edited:

idcrisis

Senior Member
Aug 30, 2010
1,428
5,742
'This software is being distributed with the Aware license. Please allow it to be brought to your kind awareness that buying lesser devices could possibly have a direct positive socio-political impact in some countries where the components are sourced from.

If you like this work please help your friends become aware of this too.' - http://xdaforums.com/showthread.php?t=2521266

----

28/10/2013 -

Hi guys,

Uploaded the current version with development as it was. Should be very usable with some noticeable usability improvements in the process and services ionice and renice and cgroup ( iffy ) space.

Uploaded source of the binaries.

License is BSD unless inherited from GPL.

Sorry for the terrible coding. Maybe some programmer can take it up and do something good with it.

Idcrisis

-----

VERY IMPORTANT - Please take a NANDROID backup of your device before installing this MOD. This MOD is alpha and still some way to go before stabilising. Please do download both CrossBreeder and the Uninstall ZIP together to your SD Card so you can uninstall in case of any issues.

IMPORTANT - Please uninstall a prior version of CrossBreeder by flashing the attached latest uninstall ZIP before flashing the latest version. Please report problems only with the latest version of the software along with your model number, ROM details and the output of the following command:

su -c "/system/etc/CrossBreeder/CHECK_PROCS"

Please upgrade even if you're happy with a prior version as there are some prospective issues with prior versions which can result in your phone doing more work than necessary.

Also do read the portion below on how to run the REMOVE_DNS_CLIENT command to disable the DNS portion only if you're getting network issues.


QUICK LINKS TO FLASH: CrossBreeder_edition.zip and CrossBreeder_Uninstall_edition.zip - NOTE - Installer clears dalvik cache!

What is CrossBreeder?

This is a new take at improving Android and reducing GUI lag.

It's lightweight and won't consume battery. Users have reported drastic improvements in usability and battery life. It will show noticeable improvements.

All you need to try it is custom recovery. It is for all Android devices. ( not x86 ones ).

This is a combination of 5 different key methodologies to improve the Android experience:

1. It's a big new feature, DNS caching, parallelising and tether boost . A lot of the lag in a lot of apps, apart from the GUI lag, is due to slow DNS querying, specially on the mobile network.

CrossBreeder now runs a caching, parallelising DNS client on the device. So now most of your DNS queries will be served from the cache and if not found, the query will be sent in in parallel to multiple DNS servers including the two Google DNS servers, the two L3 DNS servers and your two ISP servers and the quickest reply will be served to you, hot and transparently. You can read the rationale for this approach - http://ma.ttwagner.com/make-dns-fly-with-dnsmasq-all-servers/

This speeds up network access and networked apps, like Browsers of course, and Tapatalk, Gmail and thousands of others drastically. And removes a lot of the lag where it was due to DNS querying. This will not increase your network or download speed but pages will load much faster.

This will future proof your devices as more and more apps start using HTML5 and/or reside completely as web pages or the like.

CrossBreeder boosts your tethering connection. Client devices to your device will take advantage of the new DNS. Hence their usage is also improved! In many cases this update might even fix a broken tethering feature on your phone. So if your ROM doesn't have a working tethering support, you an try and install this update. It might magically start working!

CrossBreeder blocks ads and spyware in an efficient manner by blocking access to the host. It does this using a static block list of known ad sites and behaving as an authoritative DNS server for these sites and redirecting them to a dummy address. CrossBreeder runs a simple web server serving empty images and pages, so ads completely disappear instead of showing an ugly Page/Image Not found error.

You can update this block list from an external specialised tool like Adaway if you need. Here is a guide ( http://xdaforums.com/showthread.php?p=42711244 )

CrossBreeder now includes the bypass censor functionality. This allows you to circumvent DNS based censors as used by most authoritarian countries. This basically works by bypassing your ISP's DNS servers and querying the 2 Google DNS servers and 2 L3 DNS servers only. These are usually faster anyway, more so due to the caching and parallelizing nature of the query. Thus if your ISP is blocking websites without telling you, you have a way out if this. You can enable it using the following command:

su -c "/system/etc/CrossBreeder/ENABLE_BYPASS_ISP"

and rebooting. You can read this for some more info ( http://xdaforums.com/showpost.php?p=42240441&postcount=2748 )

You can also choose your custom DNS servers by updating the /etc/CrossBreeder/REMOTE_DNS file with each custom DNS server in a separate line.

NOTE: CrossBreeder DNS (Boost/Adblock/Censor Bypass) will not work (as in it won't be used ) if your ISP APN contains an entry for a proxy server. Do edit the APN and remove the proxy entry and see if you can browse fine. That will allow CrossBreeder DNS to work.

CrossBreeder also renames any existing /etc/hosts file on your device. Testing has proven that keeping a system wide /etc/hosts file as is used by most other Ad blocking software actually slows down your system. So it is recommended to use this method instead. Check this out for the demonstration of the slowdown and how to test it yourself - http://xdaforums.com/showthread.php?p=41877518

In order to achieve all this DNS related functionality, CrossBreeder relies on the excellent open source utilities - DNRD and Dnsmasq

2. Modulate OS entropy levels for lag reduction ala Seeder. The whole OS reads either /dev/random or /dev/urandom and both need entropy. However this mod uses a completely different, lightweight and efficient random number generator called Havege . This sharply reduces cpu consumption and corresponding battery life loss compared to Seeder. It also does a better job at keeping entropy levels high hence your device is more responsive. It doesn't run in a CPU intensive loop either. The extend queue functionality has also been added to CrossBreeder. See here for another rationale favouring Havege compared to Rngd - ( http://code.google.com/p/csrng/ - Look for the limitations.)

3. Change kernel parameters specially the wakeup threshold ones so read blocks are released instantly and writes never wake up as we have an external entropy generator. And a host of other fail safe and working tweaks from the community for each key subsystem. ( one can look inside /etc/CrossBreeder/zzCrossBreeder ).

4. 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 and with Haveged running, is as secure anyway as it's very difficult to empty the entropy pool faster than Havege can replenish it. Pre ICS devices have a lot to gain with this but ICS+ devices show visible gains too.

5. Frandom support (Optional) - CrossBreeder now supports linking both your random devices to the extremely fast alternative - Frandom ( http://billauer.co.il/frandom.html ). This module is orders of magnitude (10-50 times) faster than the standard character devices ( Check this out - http://xdaforums.com/showpost.php?p=37409586&postcount=134 ). The erandom character device also installed by Frandom doesn't use up system entropy at all on top of being fast. You will need to ask your ROM developer to develop the kernel module for you and then place it in /system/lib/modules. CrossBreeder will then try and load it and if successful, make all the necessary adjustments so that both /dev/random and /dev/urandom are pointing to /dev/frandom and /dev/erandom respectively. The speed benefits are to be seen to be believed. But since each ROM requires a unique kernel module, this option is left optional ( but auto detect ). Advanced users can even try and load the frandom module built for other kernels if they don't have one readily available for their own kernel version using the Punchmod utility. Read this: http://xdaforums.com/showthread.php?p=41920265#post41920265

Your thoughts and experiences welcome and actively solicited.

HOWTO:

- If you want to install it automatically please flash the attached file in recovery. That's it. You're done!

*** WARNING - Other entropy reduction apps like rngd standard and rngd from Seeder and qrngd are not compatible with this mod. In case you have Seeder running please disable it. You can run the app to see the entropy levels though. This mod blocks all other rngs so Seeder may not run. The nature of the /dev/random device is now faster non blocking link to urandom and different to what these apps expect. They would otherwise go into a CPU consumption loop at 60-70% cpu usage. There is no loss of functionality by disabling other rngs as this is a replacement and an improvement***

1. VALIDATION and TROUBLESHOOTING:

You can check your DNS boost functionality by running the following command:
Code:
getprop net.dns1

It should report 0.0.0.0

Then to verify Adblock you can select any one host from the blocked hosts file using the command:

Code:
 tail /etc/CrossBreeder/dnrd_root/master

Pick one from there and browse to it in your browser. You should get a blank space :good:

If you're experiencing any issues with your tethering, then you can first try and disable the tethering using:
Code:
su -c /system/etc/CrossBreeder/REMOVE_TETHER_BOOST
and rebooting.

You can re-enable it with:
Code:
su -c /system/etc/CrossBreeder/INSTALL_TETHER_BOOST
and rebooting.

Similarly if you're getting any issues with browser not reaching pages etc. then you can try and disable the entire DNS speedup functionality using:
Code:
su -c /system/etc/CrossBreeder/REMOVE_DNS_CLIENT
and rebooting.

You can re-enable it with:
Code:
su -c /system/etc/CrossBreeder/INSTALL_DNS_CLIENT
and rebooting.

Also of note is the Adblock feature. CrossBreeder now uses it's own Adblock file in /etc/CrossBreeder/dnrd_root/master ( NOTE - CHANGED FROM PREVIOUS VERSION). It also serves up these blocks in a clean blank format so you don't get an ugly 'Page not found' error instead of every ad. This is quite unique. If you want to disable Adblock to save around 3 MB of RAM on low end devices, you can run the command:
Code:
su -c /system/etc/CrossBreeder/DISABLE_ADBLOCK
You can re-enable it with:
Code:
su -c /system/etc/CrossBreeder/ENABLE_ADBLOCK

The biggest improvements are in general usability of apps, both local and network based.

2. You can check your entropy values with this tool:

http://play.google.com/store/apps/details?id=com.promethylhosting.checkrandentropyavail

or use this method for more fine grained graphs: http://xdaforums.com/showthread.php?p=38509664

You should get values moving to 4000 regularly with this mod.

Also of some use is this Lag Test app: Lag Test http://db.tt/eBHYJWYn ( Thanks MW86 ). This is for generally testing the CPU based GUI rendering functionality. The aim is to approach 60 fps, but there isn't a guaranteed correlation with CrossBreeder and your FPS result as of now. It is mostly related to your Governor but CrossBreeder certainly helps.

2. If for some reason, your entropy values aren't hovering around 4096 then the app most probably didn't start automatically. You can try and run it manually using:
Code:
su -c "/system/etc/CrossBreeder/zzCrossBreeder FORCE"

If the entropy values go up to around 4096 and stay there, it's working. CrossBreeder is now in it's separate directory and not dependent on your init.d support. You can make it run automatically on boot using an app like SManager from the Play store, just remember to check both 'BOOT' and 'ROOT' for the execution.

3. If you're still getting issues, you can run the collection script:
Code:
su -c /system/etc/CrossBreeder/CHECK_PROCS
(if it hangs you can close the window and run it again) and post the resultant /data/cb_CHECK_PROCS.log file here in this thread or anywhere else and post here pointing to it please. I will try to find a solution or post a bugfix soon.

You can also disable CrossBreeder if you have any problems using:

Code:
su -c /system/etc/CrossBreeder/DISABLE_CROSSBREEDER

4. If you tried (2) and (3) above and it still doesn't work for you or you would still like to uninstall the mod, then please flash the CrossBreeder_Uninstall.zip.

GENERAL RECOMMENDATIONS:

1. It is recommended to disable all animations in your System settings and Launcher settings ( or keep them at 0.5 ). Also recommended is to disable haptic feedback and keypress sounds in your system, launcher and keyboard ( especially on low memory phones).

Some software recommendations include the Holo Launcher as a launcher replacement, HoloWeb Browser ( version 1.4 only) or Naked browser and exDialer as a dialer replacement.

These recommendations are general in nature and are not required for normal CrossBreeder functionality.

NOTE FOR ROM/KERNEL DEVELOPERS:

Please feel free to include CrossBreeder in your ROM/kernel. Do include a link to this thread in your credits. The best way to include it has not been given much thought so I'd like to recommend that you install it as the last thing and then package /system completely. If you are distributing files alone, then I guess the best way would be to include (from a ROM with CrossBreeder installed) :

1. /system/etc/CrossBreeder - The entire directory structure with perms intact
2. /system/bin/dnsmasq
3. /system/bin/dnsmasq_dhcp
4. /system/xbin/haveged
5. /system/etc/hosts
6. /system/bin/debuggerd
7. /system/xbin/debuggerd
8. /data/rngd.pid ( as a directory with permissions intact. Important or the device will crawl if your user installs Seeder/RNGD ).
9. Remove any /system/[x]bin/*rngd

Also do make sure that the debuggerd entry exists in /init.rc and before the zygote/system_server entry.

And it is a very very strong recommendation to use a CrossBreeder version after 6.30.13. Earlier versions just don't cut it. You and your users deserve better.

Credits:

1. This software is dedicated to the entire Open Source community.
2. DNRD
3. DNSMasq ( http://thekelleys.org.uk/dnsmasq/doc.html )
4. Havege ( http://irisa.fr/caps/projects/hipsor/ )
5. Seeder. ( http://xdaforums.com/showthread.php?p=33999592 ). Thunderbolt tweaks for I/O tweaks and governor tweaks ( http://xdaforums.com/showthread.php?p=23827087 )
6. V6 Supercharger for network buffer size tweaks and always for a general idea of what to do ( http://xdaforums.com/showthread.php?t=991276 ).
7. Pixelserv ( Thanks Fivefour and Wonderwoofy for the referrals)

Absolutely no guarantees. I'm not responsible or liable for anything that arises out of the use of this, including you out of your chair.

.
 

Attachments

  • CrossBreeder_5.21.13.zip
    2.5 MB · Views: 13,340
  • CrossBreeder_7.2.13.zip
    1.6 MB · Views: 83,023
  • CrossBreeder_Uninstall_7.2.13.zip
    943.1 KB · Views: 42,335
  • CrossBreeder_7.2.13_No_AutoStart.zip
    1.6 MB · Views: 12,491
  • CrossBreeder_Source.tar.gz
    3.4 MB · Views: 1,429
  • CrossBreeder_edition.zip
    1.8 MB · Views: 12,271
  • CrossBreeder_Uninstall_edition.zip
    943.1 KB · Views: 6,718
Last edited:

desalesouche

Senior Member
Feb 6, 2012
3,651
4,297
Hi,

This is just a suggestion to reduce lag on Android devices based on others' findings that the blocking /dev/random device may be the cause of the significant lag on most Android devices.

Why can't we just remove the /dev/random device and link it to /dev/urandom?:

1. mv /dev/random /dev/random.ORIG ; ln /dev/urandom /dev/random
2. Stop the seeder service if it's running.

Wakelock and battery drain is probably not a concern as there's nothing running in the background. Also this may be better than feeding /dev/random from external sources as the device is now non blocking.

Saw this on some JDK optimisation site and decided to try it. I'm getting some good results on all Android devices I've tried this on.

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 guess usability is more important than catering to a one in a impossibillion chance and a billion devices performing sub optimally.

Your thoughts welcome.

Ref:

http://forums.oracle.com/forums/thread.jspa?threadID=991619
http://itonguard.com/20090313/weblogic-starts-slow/
hi.i would like to try.how to do that? do you have a script or something? thank you.
 

desalesouche

Senior Member
Feb 6, 2012
3,651
4,297
Hi,

You can adb into the phone and type 'su' and enter and then run the command in the first step:

mv /dev/random /dev/random.ORIG ; ln /dev/urandom /dev/random

Sent from my Transformer TF101G using xda app-developers app
i tried with terminal emulator but it is not working...
have to do it with adb so?
thank you
 

DEF3NDER

Senior Member
Jul 3, 2012
1,465
1,442
Neat idea! Trying now. Thank you.

Edit: It's so hard to tell with these kinds of things whether they are working or it's placebo. If it is working, it is definitely not like an "in yo face" difference, on my device at least. Before it was pretty smooth with an occasional stutter here and there. Now it is pretty smooth with an occasional stutter here and there. It didn't blow up so that's a win.

Curious to hear what results other have though.
 
Last edited:

idcrisis

Senior Member
Aug 30, 2010
1,428
5,742
Re: [MOD] Link /dev/random to urandom for lag reduction

Neat idea! Trying now. Thank you.

Edit: It's so hard to tell with these kinds of things whether they are working or it's placebo. If it is working, it is definitely not like an "in yo face" difference, on my device at least. Before it was pretty smooth with an occasional stutter here and there. Now it is pretty smooth with an occasional stutter here and there. It didn't blow up so that's a win.

Curious to hear what results other have though.

Hi,

Thanks for your feedback.

I just updated the post with the accompanying kernel parameters. You can try the whole thing as a bunch perhaps and maybe create an init.d script and reboot. Then after ensuring that it actually ran on boot, you can perhaps test.

Sent from my Transformer TF101G using xda app-developers app
 

DEF3NDER

Senior Member
Jul 3, 2012
1,465
1,442
Re: [MOD] Link /dev/random to urandom for lag reduction

I don't know how to make an init.d script but can I just run that code in adb for a temporary test? I tried that and I could swear it made a difference.

Sent from my SPH-D710 using xda premium
 

idcrisis

Senior Member
Aug 30, 2010
1,428
5,742
Re: [MOD] Link /dev/random to urandom for lag reduction

I don't know how to make an init.d script but can I just run that code in adb for a temporary test? I tried that and I could swear it made a difference.

Sent from my SPH-D710 using xda premium

Yeah sure, you can run it in ADB. The settings will then remain till the next reboot.

Sent from my Transformer TF101G using xda app-developers app
 
  • Like
Reactions: Ci-Fi and takkaros

DEF3NDER

Senior Member
Jul 3, 2012
1,465
1,442
Re: [MOD] Link /dev/random to urandom for lag reduction

OK that's what I thought. Been running these settings for a few hours now with good results.

Gonna post a link to this thread over in the e4gt forum and see if everyone gets the same results.

What devices have you tried this on?

Sent from my SPH-D710 using xda premium
 

mw86

Senior Member
Jul 17, 2012
2,953
3,091
Afton
forum.techinferno.com
Re: [MOD] Link /dev/random to urandom for lag reduction

Is setting write up threshold to 2048 the best idea? Stock is 128 and using a higher value resembles what we may want to call a minimum entropy value. Using 2048 one should not see entropy drop below that value. Using that high a read wake up threshold keeps enropy filling up till it caps and stops at 4096. It likely is smoother to have a more default write wake up threshold as the system doesn't need to wait for the minimum of 2048 it just starts using entropy right away on the default 128. By time system boots im always at 1000+ plenty and as day of usage progresses it climbs to 2-3k. 2048 may be more than necessary. Zepplinrox uses 1366 and 128 and his explanation made sense to me. I also had a smoother experience on stock write uo threshold. Ive tried above and below 2048 also. The rest all seems to be what has been discussed like the randomize va space etc. I made an initd for this last month too... this seems just as useful as seeder apk etc but Ive seen people claim this method is slower. To me they both work and this way has no added apk or overhead to do so.

GS3 L710 4.2.1 AOSP Kt747 2.1Ghz ROW/Ktoonservative *Tapatalk
 

idcrisis

Senior Member
Aug 30, 2010
1,428
5,742
Re: [MOD] Link /dev/random to urandom for lag reduction

Is setting write up threshold to 2048 the best idea? Stock is 128 and using a higher value resembles what we may want to call a minimum entropy value. Using 2048 one should not see entropy drop below that value. Using that high a read wake up threshold keeps enropy filling up till it caps and stops at 4096. It likely is smoother to have a more default write wake up threshold as the system doesn't need to wait for the minimum of 2048 it just starts using entropy right away on the default 128. By time system boots im always at 1000+ plenty and as day of usage progresses it climbs to 2-3k. 2048 may be more than necessary. Zepplinrox uses 1366 and 128 and his explanation made sense to me. I also had a smoother experience on stock write uo threshold. Ive tried above and below 2048 also. The rest all seems to be what has been discussed like the randomize va space etc. I made an initd for this last month too... this seems just as useful as seeder apk etc but Ive seen people claim this method is slower. To me they both work and this way has no added apk or overhead to do so.

GS3 L710 4.2.1 AOSP Kt747 2.1Ghz ROW/Ktoonservative *Tapatalk

Hi,

This method is different from Zepplinrox as /dev/random is now a link to /dev/urandom and is thus non blocking. So the idea is to take the best of all worlds.

I think your suggestions for the read and write values seem valid when there's no entropy generator but may need some analysis on top of Zeppelin's observations due to the changed nature of the random device. I have changed the OP with your suggestions as there's no rngd around to fill 2048 of entropy very easily.

This method is different to Seeder as nothing is running in the background but suffers from the same drawbacks of the Zeppenlin's method that the entropy pool may be getting populated naturally slower than what rngd would have. Which is where it might make sense to run rngd too once-off every 5 minutes.

Or maybe replace rngd with havenged.

Thanks a lot for your feedback.

Sent from my Transformer TF101G using xda app-developers app
 
Last edited:

mw86

Senior Member
Jul 17, 2012
2,953
3,091
Afton
forum.techinferno.com
Re: [MOD] Link /dev/random to urandom for lag reduction

Hi,

This method is different from Zepplinrox as /dev/random is now a link to /dev/urandom and is thus non blocking. So the idea is to take the best of all worlds.

I think your suggestions for the read and write values seem valid when there's no entropy generator but may need some analysis on top of Zeppelin's observations due to the changed nature of the random device. I have changed the OP with your suggestions as there's no rngd around to fill 2048 of entropy very easily.

This method is different to Seeder as nothing is running in the background but suffers from the same drawbacks of the Zeppenlin's method that the entropy pool may be getting populated naturally slower than what rngd would have. Which is where it might make sense to run rngd too once-off every 5 minutes.

Rngd from Seeder seems to be taking 60-70% system CPU and therefore possibly more battery. Top shows that it's certainly nowhere close to an idle system. I'm pretty sure all sorts of wakelocks etc will be disturbed in that scenario.

The next step for this method would be to bring rngd cpu usage down to negligible (maybe by removing all customisations and running once every 5 minutes instead of 1 second) and use that in conjunction. Or maybe replace rngd with havenged.

Thanks a lot for your feedback.

Sent from my Transformer TF101G using xda app-developers app

I see because of the symbolic link it does differ from Zeppelinrox method. So with the symbolic link method why is it necessary to raise write or read wake threshold from from default?
Yes your idea of having seeder run every five minutes makes sense as entropy isn't drained in most cases by that much.
With no link and no seeder 1366 read wake and 128 write wake, entropy doesnt drop only accumulates and takes a lot of actual entropy drain to reach 4096 and stays there. Why are read wake needed to differ from default on the symbolic link method?
Edit: sorry did i mis read and think you wrote 2048 write wake up in the OP? Or was it updated i am confused now.
 
Last edited:

idcrisis

Senior Member
Aug 30, 2010
1,428
5,742
Re: [MOD] Link /dev/random to urandom for lag reduction

I see because of the symbolic link it does differ from Zeppelinrox method. So with the symbolic link method why is it necessary to raise write or read wake threshold from from default?
Yes your idea of having seeder run every five minutes makes sense as entropy isn't drained in most cases by that much.
With no link and no seeder 1366 read wake and 128 write wake, entropy doesnt drop only accumulates and takes a lot of actual entropy drain to reach 4096 and stays there. Why are read wake needed to differ from default on the symbolic link method?
Edit: sorry did i mis read and think you wrote 2048 write wake up in the OP? Or was it updated i am confused now.

Yeah I changed it according to your suggestions. Its WIP ;)

Write doesn't seem to affect entropy values much but read does. But write may affect usability so I'll take your word for it.

Values still needs to be increased because I'm told the blocking /dev/random is not the only issue, the entropy pool still needs to be maintained in an efficient manner.

You can see how the available entropy falling even with the link in place.

Hence the attempt to use all 3 methods.

Sent from my Xperia X10 using xda app-developers app
 

DEF3NDER

Senior Member
Jul 3, 2012
1,465
1,442
Re: [MOD] Link /dev/random to urandom for lag reduction

I rebooted my phone and then attempted to adb the code with the updated values. Both codes give me an error that says "link failed file exists." Does that mean they stuck through the reboot or what should I do?

Sent from my SPH-D710 using xda premium
 
  • Like
Reactions: JohnCorleone

Top Liked Posts

  • There are no posts matching your filters.
  • 1387
    'This software is being distributed with the Aware license. Please allow it to be brought to your kind awareness that buying lesser devices could possibly have a direct positive socio-political impact in some countries where the components are sourced from.

    If you like this work please help your friends become aware of this too.' - http://xdaforums.com/showthread.php?t=2521266

    ----

    28/10/2013 -

    Hi guys,

    Uploaded the current version with development as it was. Should be very usable with some noticeable usability improvements in the process and services ionice and renice and cgroup ( iffy ) space.

    Uploaded source of the binaries.

    License is BSD unless inherited from GPL.

    Sorry for the terrible coding. Maybe some programmer can take it up and do something good with it.

    Idcrisis

    -----

    VERY IMPORTANT - Please take a NANDROID backup of your device before installing this MOD. This MOD is alpha and still some way to go before stabilising. Please do download both CrossBreeder and the Uninstall ZIP together to your SD Card so you can uninstall in case of any issues.

    IMPORTANT - Please uninstall a prior version of CrossBreeder by flashing the attached latest uninstall ZIP before flashing the latest version. Please report problems only with the latest version of the software along with your model number, ROM details and the output of the following command:

    su -c "/system/etc/CrossBreeder/CHECK_PROCS"

    Please upgrade even if you're happy with a prior version as there are some prospective issues with prior versions which can result in your phone doing more work than necessary.

    Also do read the portion below on how to run the REMOVE_DNS_CLIENT command to disable the DNS portion only if you're getting network issues.


    QUICK LINKS TO FLASH: CrossBreeder_edition.zip and CrossBreeder_Uninstall_edition.zip - NOTE - Installer clears dalvik cache!

    What is CrossBreeder?

    This is a new take at improving Android and reducing GUI lag.

    It's lightweight and won't consume battery. Users have reported drastic improvements in usability and battery life. It will show noticeable improvements.

    All you need to try it is custom recovery. It is for all Android devices. ( not x86 ones ).

    This is a combination of 5 different key methodologies to improve the Android experience:

    1. It's a big new feature, DNS caching, parallelising and tether boost . A lot of the lag in a lot of apps, apart from the GUI lag, is due to slow DNS querying, specially on the mobile network.

    CrossBreeder now runs a caching, parallelising DNS client on the device. So now most of your DNS queries will be served from the cache and if not found, the query will be sent in in parallel to multiple DNS servers including the two Google DNS servers, the two L3 DNS servers and your two ISP servers and the quickest reply will be served to you, hot and transparently. You can read the rationale for this approach - http://ma.ttwagner.com/make-dns-fly-with-dnsmasq-all-servers/

    This speeds up network access and networked apps, like Browsers of course, and Tapatalk, Gmail and thousands of others drastically. And removes a lot of the lag where it was due to DNS querying. This will not increase your network or download speed but pages will load much faster.

    This will future proof your devices as more and more apps start using HTML5 and/or reside completely as web pages or the like.

    CrossBreeder boosts your tethering connection. Client devices to your device will take advantage of the new DNS. Hence their usage is also improved! In many cases this update might even fix a broken tethering feature on your phone. So if your ROM doesn't have a working tethering support, you an try and install this update. It might magically start working!

    CrossBreeder blocks ads and spyware in an efficient manner by blocking access to the host. It does this using a static block list of known ad sites and behaving as an authoritative DNS server for these sites and redirecting them to a dummy address. CrossBreeder runs a simple web server serving empty images and pages, so ads completely disappear instead of showing an ugly Page/Image Not found error.

    You can update this block list from an external specialised tool like Adaway if you need. Here is a guide ( http://xdaforums.com/showthread.php?p=42711244 )

    CrossBreeder now includes the bypass censor functionality. This allows you to circumvent DNS based censors as used by most authoritarian countries. This basically works by bypassing your ISP's DNS servers and querying the 2 Google DNS servers and 2 L3 DNS servers only. These are usually faster anyway, more so due to the caching and parallelizing nature of the query. Thus if your ISP is blocking websites without telling you, you have a way out if this. You can enable it using the following command:

    su -c "/system/etc/CrossBreeder/ENABLE_BYPASS_ISP"

    and rebooting. You can read this for some more info ( http://xdaforums.com/showpost.php?p=42240441&postcount=2748 )

    You can also choose your custom DNS servers by updating the /etc/CrossBreeder/REMOTE_DNS file with each custom DNS server in a separate line.

    NOTE: CrossBreeder DNS (Boost/Adblock/Censor Bypass) will not work (as in it won't be used ) if your ISP APN contains an entry for a proxy server. Do edit the APN and remove the proxy entry and see if you can browse fine. That will allow CrossBreeder DNS to work.

    CrossBreeder also renames any existing /etc/hosts file on your device. Testing has proven that keeping a system wide /etc/hosts file as is used by most other Ad blocking software actually slows down your system. So it is recommended to use this method instead. Check this out for the demonstration of the slowdown and how to test it yourself - http://xdaforums.com/showthread.php?p=41877518

    In order to achieve all this DNS related functionality, CrossBreeder relies on the excellent open source utilities - DNRD and Dnsmasq

    2. Modulate OS entropy levels for lag reduction ala Seeder. The whole OS reads either /dev/random or /dev/urandom and both need entropy. However this mod uses a completely different, lightweight and efficient random number generator called Havege . This sharply reduces cpu consumption and corresponding battery life loss compared to Seeder. It also does a better job at keeping entropy levels high hence your device is more responsive. It doesn't run in a CPU intensive loop either. The extend queue functionality has also been added to CrossBreeder. See here for another rationale favouring Havege compared to Rngd - ( http://code.google.com/p/csrng/ - Look for the limitations.)

    3. Change kernel parameters specially the wakeup threshold ones so read blocks are released instantly and writes never wake up as we have an external entropy generator. And a host of other fail safe and working tweaks from the community for each key subsystem. ( one can look inside /etc/CrossBreeder/zzCrossBreeder ).

    4. 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 and with Haveged running, is as secure anyway as it's very difficult to empty the entropy pool faster than Havege can replenish it. Pre ICS devices have a lot to gain with this but ICS+ devices show visible gains too.

    5. Frandom support (Optional) - CrossBreeder now supports linking both your random devices to the extremely fast alternative - Frandom ( http://billauer.co.il/frandom.html ). This module is orders of magnitude (10-50 times) faster than the standard character devices ( Check this out - http://xdaforums.com/showpost.php?p=37409586&postcount=134 ). The erandom character device also installed by Frandom doesn't use up system entropy at all on top of being fast. You will need to ask your ROM developer to develop the kernel module for you and then place it in /system/lib/modules. CrossBreeder will then try and load it and if successful, make all the necessary adjustments so that both /dev/random and /dev/urandom are pointing to /dev/frandom and /dev/erandom respectively. The speed benefits are to be seen to be believed. But since each ROM requires a unique kernel module, this option is left optional ( but auto detect ). Advanced users can even try and load the frandom module built for other kernels if they don't have one readily available for their own kernel version using the Punchmod utility. Read this: http://xdaforums.com/showthread.php?p=41920265#post41920265

    Your thoughts and experiences welcome and actively solicited.

    HOWTO:

    - If you want to install it automatically please flash the attached file in recovery. That's it. You're done!

    *** WARNING - Other entropy reduction apps like rngd standard and rngd from Seeder and qrngd are not compatible with this mod. In case you have Seeder running please disable it. You can run the app to see the entropy levels though. This mod blocks all other rngs so Seeder may not run. The nature of the /dev/random device is now faster non blocking link to urandom and different to what these apps expect. They would otherwise go into a CPU consumption loop at 60-70% cpu usage. There is no loss of functionality by disabling other rngs as this is a replacement and an improvement***

    1. VALIDATION and TROUBLESHOOTING:

    You can check your DNS boost functionality by running the following command:
    Code:
    getprop net.dns1

    It should report 0.0.0.0

    Then to verify Adblock you can select any one host from the blocked hosts file using the command:

    Code:
     tail /etc/CrossBreeder/dnrd_root/master

    Pick one from there and browse to it in your browser. You should get a blank space :good:

    If you're experiencing any issues with your tethering, then you can first try and disable the tethering using:
    Code:
    su -c /system/etc/CrossBreeder/REMOVE_TETHER_BOOST
    and rebooting.

    You can re-enable it with:
    Code:
    su -c /system/etc/CrossBreeder/INSTALL_TETHER_BOOST
    and rebooting.

    Similarly if you're getting any issues with browser not reaching pages etc. then you can try and disable the entire DNS speedup functionality using:
    Code:
    su -c /system/etc/CrossBreeder/REMOVE_DNS_CLIENT
    and rebooting.

    You can re-enable it with:
    Code:
    su -c /system/etc/CrossBreeder/INSTALL_DNS_CLIENT
    and rebooting.

    Also of note is the Adblock feature. CrossBreeder now uses it's own Adblock file in /etc/CrossBreeder/dnrd_root/master ( NOTE - CHANGED FROM PREVIOUS VERSION). It also serves up these blocks in a clean blank format so you don't get an ugly 'Page not found' error instead of every ad. This is quite unique. If you want to disable Adblock to save around 3 MB of RAM on low end devices, you can run the command:
    Code:
    su -c /system/etc/CrossBreeder/DISABLE_ADBLOCK
    You can re-enable it with:
    Code:
    su -c /system/etc/CrossBreeder/ENABLE_ADBLOCK

    The biggest improvements are in general usability of apps, both local and network based.

    2. You can check your entropy values with this tool:

    http://play.google.com/store/apps/details?id=com.promethylhosting.checkrandentropyavail

    or use this method for more fine grained graphs: http://xdaforums.com/showthread.php?p=38509664

    You should get values moving to 4000 regularly with this mod.

    Also of some use is this Lag Test app: Lag Test http://db.tt/eBHYJWYn ( Thanks MW86 ). This is for generally testing the CPU based GUI rendering functionality. The aim is to approach 60 fps, but there isn't a guaranteed correlation with CrossBreeder and your FPS result as of now. It is mostly related to your Governor but CrossBreeder certainly helps.

    2. If for some reason, your entropy values aren't hovering around 4096 then the app most probably didn't start automatically. You can try and run it manually using:
    Code:
    su -c "/system/etc/CrossBreeder/zzCrossBreeder FORCE"

    If the entropy values go up to around 4096 and stay there, it's working. CrossBreeder is now in it's separate directory and not dependent on your init.d support. You can make it run automatically on boot using an app like SManager from the Play store, just remember to check both 'BOOT' and 'ROOT' for the execution.

    3. If you're still getting issues, you can run the collection script:
    Code:
    su -c /system/etc/CrossBreeder/CHECK_PROCS
    (if it hangs you can close the window and run it again) and post the resultant /data/cb_CHECK_PROCS.log file here in this thread or anywhere else and post here pointing to it please. I will try to find a solution or post a bugfix soon.

    You can also disable CrossBreeder if you have any problems using:

    Code:
    su -c /system/etc/CrossBreeder/DISABLE_CROSSBREEDER

    4. If you tried (2) and (3) above and it still doesn't work for you or you would still like to uninstall the mod, then please flash the CrossBreeder_Uninstall.zip.

    GENERAL RECOMMENDATIONS:

    1. It is recommended to disable all animations in your System settings and Launcher settings ( or keep them at 0.5 ). Also recommended is to disable haptic feedback and keypress sounds in your system, launcher and keyboard ( especially on low memory phones).

    Some software recommendations include the Holo Launcher as a launcher replacement, HoloWeb Browser ( version 1.4 only) or Naked browser and exDialer as a dialer replacement.

    These recommendations are general in nature and are not required for normal CrossBreeder functionality.

    NOTE FOR ROM/KERNEL DEVELOPERS:

    Please feel free to include CrossBreeder in your ROM/kernel. Do include a link to this thread in your credits. The best way to include it has not been given much thought so I'd like to recommend that you install it as the last thing and then package /system completely. If you are distributing files alone, then I guess the best way would be to include (from a ROM with CrossBreeder installed) :

    1. /system/etc/CrossBreeder - The entire directory structure with perms intact
    2. /system/bin/dnsmasq
    3. /system/bin/dnsmasq_dhcp
    4. /system/xbin/haveged
    5. /system/etc/hosts
    6. /system/bin/debuggerd
    7. /system/xbin/debuggerd
    8. /data/rngd.pid ( as a directory with permissions intact. Important or the device will crawl if your user installs Seeder/RNGD ).
    9. Remove any /system/[x]bin/*rngd

    Also do make sure that the debuggerd entry exists in /init.rc and before the zygote/system_server entry.

    And it is a very very strong recommendation to use a CrossBreeder version after 6.30.13. Earlier versions just don't cut it. You and your users deserve better.

    Credits:

    1. This software is dedicated to the entire Open Source community.
    2. DNRD
    3. DNSMasq ( http://thekelleys.org.uk/dnsmasq/doc.html )
    4. Havege ( http://irisa.fr/caps/projects/hipsor/ )
    5. Seeder. ( http://xdaforums.com/showthread.php?p=33999592 ). Thunderbolt tweaks for I/O tweaks and governor tweaks ( http://xdaforums.com/showthread.php?p=23827087 )
    6. V6 Supercharger for network buffer size tweaks and always for a general idea of what to do ( http://xdaforums.com/showthread.php?t=991276 ).
    7. Pixelserv ( Thanks Fivefour and Wonderwoofy for the referrals)

    Absolutely no guarantees. I'm not responsible or liable for anything that arises out of the use of this, including you out of your chair.

    .
    330
    See the third post for full information about the functionality of CrossBreeder from the original creator @idcrisis. It's his blood, sweat, and tears that created CrossBreeder. I provided an app, fram, and pixelserv along with other ideas and support.

    Thanks.

    Please use the 12.1.2013 edition of CrossBreeder attached so I can properly diagnose and support the MOD moving forward.

    The source has been pushed to github, the URL is: https://github.com/f1vefour/CrossBreeder

    If you wish to help simply clone the project, make changes and create a pull request. I will review/test and commit if they are helpful.

    I appreciate all the help I can get, both with the CrossBreeder scripts and with general testing and support in this thread. I have a wife and three semi-wonderful kids so time is limited, I will work on and support the project the best I can with the time I have.

    Thanks,
    Tim (fivefour)

    If you have an issue please get a logcat, post it to pastebin and link it along with your issue. Otherwise I probably can't help you.
    154
    EDIT:

    Hi, due to some unforeseen circumstances, I'm stopping development on this MOD.

    I apologize for the inconvenience caused and thank you sincerely for your support.

    God speed.

    Sent from my Transformer TF101G using xda app-developers app
    88
    That sucks. Let the community fight back! If you open the source and let it get forked to be integrated into a new project or app (see how AFWall+ was created), nobody can stop us!

    Uploaded the last version with development as it was. Should be very usable with some noticeable usability improvements in the process and services ionice and renice and cgroup ( iffy ) space.

    Uploaded source of the binaries.

    License is BSD unless inherited from GPL.

    Sorry for the terrible coding. Maybe some programmer can take it up and do something good with it.

    Bye. Thanks a lot. Take care.

    Sent from my Transformer TF101G using xda app-developers app
    78
    Hi guys,

    New version has been uploaded with the following points:

    - DNS Changes module has been completely rewritten so that it doesn't loop every 3-5 seconds. Instead it waits for netlink events. There is a backup thread checking every minute just in case. This should help both battery life and speed of DNS takeover

    - DNS Changer now puts your last 4 successful local DNS server in its file: /dev/resolv-local.conf so connection times are much quicker.

    - ENTROPY_FEED_FREQUENCY_SECS is at 0.5 seconds for ICS/ICS- and 1.0 seconds for JB/JB+. If the file doesn't exist then 1.0 is the default in place.

    - IO Tweaks are off by default. You can use the ENABLE_IO_TWEAKS command to enable them. Remember you need to reboot after a disable.

    - Governor tweaks are off by default too except for the sampling_rate value is increased to 40000 if found to be below and decreased to 100000 if found to be above. You can enable the entire set of governor tweaks using the ENABLE_GOVERNOR_TWEAKS command. Do remember that you have to run CrossBreeder every time you change governors for the tweak to take effect. You can look inside the CB_Governor_Tweaks.sh file to see what values are being used if you do decide to enable them. The governor tweaks honour the STOP_TWEAKING_GOVERNOR file too. Remember you need to reboot after a disable.

    - All supplementary tweaks honour the /data/STOP_TWEAKING_ME file.

    - New feature support - Namecoin .BIT domain support transparently. .BIT is a new decentralised model for DNS which is based on the Bitcoin protocol and the control of it is decentralised. Hence your domain can't be hijacked by authoritarian governments. CrossBreeder now supports the resolution of .bit domains on your device without intervention. It also caches and parallelises the results like other DNS queries, hence takes load of the servers. It currently uses the 3 active DNS servers in:

    http://dot-bit.org/HowToBrowseBitDomainsAdvanced#Use_a_DNS_server_that_support_.bit_domains

    You can look inside

    /system/etc/CrossBreeder/dnsmasq.conf

    for the exact DNS server IP addresses. As you can see from the conf file, it queries these special DNS servers only when the query is a .BIT query. Otherwise it resorts to the standard ones.

    .BIT DNS servers are up and coming and go down often. But with the parallel load balancing and caching of CrossBreeder, the entire ecosystem becomes stronger. You can check your .BIT resolution using the command:
    Code:
    /system/etc/CrossBreeder/dnsc 0.0.0.0 dns.bit

    That means it's working. Welcome to the new internet!

    - The BYPASS_ISP method for bypassing DNS based ISP censors is still the same. Just to reiterate, you can run the command;
    Code:
    su -c /system/etc/CrossBreeder/ENABLE_BYPASS_ISP

    Note, bypassing ISP will not work if the remote DNS servers are not reachable. You can check your configured remote DNS servers using the command:
    Code:
    su
    for i in `cat /system/etc/CrossBreeder/REMOTE_DNS`; do /system/etc/CrossBreeder/dnsc $i; done

    FYI, the dnsc command provided with CrossBreeder has the syntax

    dnsc [remote_dns_server_to_query] [domain_to_resolve] [port]

    If all or at least one of the Remote DNS servers reply successfully on that connection then bypassing ISP will work. Else you can look for other public DNS servers and put them there in the REMOTE_DNS file to test again. Don't put more than 4 in there.

    Do remember that the connectivity over Wifi with different/home router will mean a different connection to the 3G connection and your REMOTE_DNS file is the same for both so best you run the tests above for both connection.

    Also do remember that CrossBreeder doesn't take over your connection till it gets a successful DNS path, so if you use the BYPASS_ISP flag and the remote DNS servers are blocked then it will wait forever for a valid connection and your ISP's DNS will be used in the meanwhile, so you'll be undergoing the censored connection during that time.

    The best way to check that CrossBreeder has taken over your connection is that

    getprop net.dns1

    should report 0.0.0.0

    If you don't want to allow the DNS seepage, then you can force the primary DNS for both Wifi and 3G connection to 0.0.0.0 using SetDNS or DNS Changer app. Do remember that this can result in a non working connection if the Remote DNS servers are blocked ( that's why I didn't enable that option).

    But best to change ISPs if they're a) censoring anything or b) blocking remote DNS servers. Net neutrality is paramount and this increasing attempts by ISPs to curb our online freedom is a race to the bottom and we should get out from under that sinking ship ;)

    - If you're getting bootloops then you can do a

    touch /data/CrossBreeder.RUN

    before installing. That effectively disable auto startup.

    With this file in place, the way to start CrossBreeder upon bootup is:
    Code:
    su -c "/system/etc/CrossBreeder/zzCrossBreeder FORCE"

    Please report anything and everything.

    Cheers and happy CrossBreeding!

    Sent from my Transformer TF101G using xda app-developers app