Getting the Most Out of Your Nexus 7: Jay's Recipe for Buttery Goodness (4.1.2/4.2+)

Search This thread

sizanx

Senior Member
Aug 9, 2009
112
20
What ROM are you running, if any?

Also, could you please

cat /sys/block/zram0/disksize

And report the results?

Here:
u0_a37@android:/ $ uname -a; free; mount | grep discard
Linux localhost 3.1.10-motley+ #51 SMP PREEMPT Mon Oct 15 14:37:13 EDT 2012 armv7l GNU/Linux
total used free shared buffers
Mem: 996780 979168 17612 0 59736
-/+ buffers: 919432 77348
Swap: 0 0 0
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
u0_a37@android:/ $ cat /sys/block/zram0/disksize
134217728
u0_a37@android:/ $

I am also using Paranoidandroid 2.23
 

Jay Aristide

Senior Member
Jun 27, 2011
996
894
49
Dyer, Tennessee
www.daede.com
I posted earlier: zram device is created ok, mkswap works ok, even swapon works ok, but then swap gets turned off by something. If later I run swapon again, swap comes back, meaning both zram device and mkswap worked fine.

I'm also using PA 2.23 with Metallice alpha kernel.

Indeed you did :)

Do me a favor and rename your script from 85 to 99 and see if that helps. I don't think it will, but it's worth a try..
 

Kearkan

Senior Member
Oct 10, 2012
276
57
Thanks a lot mate. Working perfectly for me running pa 2.2 and metallices kernel.

Sent from my Nexus 7 using xda app-developers app
 

evodon84

Senior Member
Aug 7, 2010
902
130
San Diego
Jay. I'm having the same deal as a few others were typing free in terminal reports all zeros. I'm running Pa 2.23 w/motley plus 4.1.2. I only put the script into the date/local/userinit.d folder. Other than the system tuner is there no steps after moving the script in? We don't need to run it with script manager?

Sent from my Nexus 7 using Tapatalk 2
 
Last edited:

Excappe

Member
Sep 27, 2011
14
4
I'm having the same issue, running PA 2.23 and M-Kernel plus
I even tried to copy the script to /system/etc/init.d with the same results

shell@android:/ # uname -a; free; mount | grep discard
uname -a; free; mount | grep discard
Linux localhost 3.1.10-motley+ #51 SMP PREEMPT Mon Oct 15 14:37:13 EDT 2012 armv7l GNU/Linux
total used free shared buffers
Mem: 996780 980644 16136 0 98916
-/+ buffers: 881728 115052
Swap: 0 0 0
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_su
bmit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_sub
mit,data=ordered,noauto_da_alloc,discard 0 0
shell@android:/ # cat /sys/block/zram0/disksize
cat /sys/block/zram0/disksize
134217728
 

bshiznit

Senior Member
Jun 24, 2010
811
1,497
Denver
Jay, are you running 2.20 or 2.23? I recall those 2 versions were actually posted for grouper within a day or 2 of eachother is why I ask...
 

wilcomir

Senior Member
Feb 28, 2011
215
54
34
Pisa, Italy
here I've got zeroes with mount | grep discard, but numbers with uname -a ; ...

if I run swapon -a (is it correct?) I get

swapon: /etc/fstab: No such file or directory

dunno if it helps.

cheers
V
 

kzakhar

Senior Member
Dec 31, 2010
273
69
Limassol
here I've got zeroes with mount | grep discard, but numbers with uname -a ; ...

if I run swapon -a (is it correct?) I get

swapon: /etc/fstab: No such file or directory
Ignore the fstab error message: swapon -a basically looks for a swap entry in /etc/fstab and tries to enable it; since you don't have /etc/fstab, the error message is expected and correct.

What do you mean by 'zeroes with mount' and 'numbers with uname', though?
 

carrsi

Member
Jul 16, 2012
22
3
Code:
u0_a37@android:/ $ uname -a ; free ; mount | grep discard
Linux localhost 3.1.10-motley+ #51 SMP PREEMPT Mon Oct 15 14:37:13 EDT 2012 armv7l GNU/Linux
             total         used         free       shared      buffers
Mem:        996780       976648        20132            0       275496
-/+ buffers:             701152       295628
Swap:            0            0            0
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit,data=ordered,noauto_da_alloc,discard 0 0
u0_a37@android:/ $ cat /sys/block/zram0/disksize
134217728
u0_a37@android:/ $
Same here. PA 2.23 :/
 
Last edited:

kzakhar

Senior Member
Dec 31, 2010
273
69
Limassol
Do we have to flash the m-kernel? Is it the only way?

It isn't, but the m-kernel is based on one of the best kernels around. You could try trinity, faux, franco or any other kernel with undervolting and init.d support, they all work relatively well. Make sure to read the kernel description, especially if the kernel already has lowered voltages: in this case you will have to skip the undervolting section or experiment on your own to find stable voltages.
 

Jay Aristide

Senior Member
Jun 27, 2011
996
894
49
Dyer, Tennessee
www.daede.com
Download: Nexus7_CM10_PA22_4.1.2_complete.zip

Those of you on ParanoidAndroid and other CM10 based ROMs who can't get the zram to turn on, download this, then

* reboot into CWM
* flash this zip
* go to advanced and fix permissions
* reflash M-Kernel Plus
* fix permissions again just to be safe
* reboot
* profit (I hope)

Please report your findings

DON'T DO THIS if you're not on a CM-based ROM.

If anybody is stock-based and having this issue, let me know. AFAIK, everyone experiencing this is on something CM-based..
 

Attachments

  • Nexus7_CM10_PA22_4.1.2_complete.zip
    4.3 MB · Views: 681
Last edited:

Jay Aristide

Senior Member
Jun 27, 2011
996
894
49
Dyer, Tennessee
www.daede.com

Jay Aristide

Senior Member
Jun 27, 2011
996
894
49
Dyer, Tennessee
www.daede.com
How about battery life when use your script.

Without zRam and undervolted by -75mV, battery life is awesome.

Folks, zRam impedes battery performance, but increases tablet performance considerably (while multitasking moderately). However, zRam is not the only thing the recipe does. If battery life is important to you, I urge you to grab the no zRam script, run at stock speeds, ondemand governor, deadline scheduler, and undervolt -75mV
 

superbellefleche

Senior Member
Jun 22, 2011
180
61
Download: Nexus7_CM10_PA22_4.1.2_complete.zip

Those of you on ParanoidAndroid and other CM10 based ROMs who can't get the zram to turn on, download this, then

* reboot into CWM
* flash this zip
* go to advanced and fix permissions
* reflash M-Kernel Plus
* fix permissions again just to be safe
* reboot
* profit (I hope)

Please report your findings

DON'T DO THIS if you're not on a CM-based ROM.

If anybody is stock-based and having this issue, let me know. AFAIK, everyone experiencing this is on something CM-based..

Ouh yeah, that's finally working !! Thx for the butter
 

Top Liked Posts

  • There are no posts matching your filters.
  • 49
    Getting the Most Out of Your Nexus 7
    Jay's Recipe for Buttery Goodness
    for Android 4.1.2/4.2/4.2.1

    What we're going to do here is remount /data and /cache with discard and noauto_da_alloc, disable fsync, enable a 128mb zRAM and setup a good, stable starting point for further modification. The result is a stable, considerably smoother multitasking powerhouse with overall better power management and performance.

    This recipe will work on pretty much any 4.1.2 ROM, and instructions are given for stock-based (with and without init.d support) and CM-based ROMs. If you have any questions, comments, or suggestions, please leave them below. I'll be happy to address whatever I can in a timely manner :)

    [Common] Determining which script to use:
    Download: SecretSauce4.1.2.zip - Contains 4 scripts. Unzip and choose which one you want
    This all depends on how much you multitask (how many different things you do at once). If you usually have 4 or 5 apps open that you switch between regularly, then you do a moderate amount of multitasking, and would choose the 256mb script. If you tend to do only one thing at a time, you may decide to save the RAM and run with no zRAM. That's fine, too (I've even got a script for that, it's a favorite among gamers :)). If you feel you fall somewhere in between, there are 64mb and 128mb scripts, as well.
    If in doubt, try each for a day or two. Decide for yourself (and let me know what you find). Feel free to modify the script to suit you. If you don't understand anything in there, don't worry about it. It's set up pretty well as-is, and the defaults should suit you fine.
    Please read this post to help you decide which script to install :)

    [Common] To init.d or not to init.d:
    If you run a custom ROM that supports /system/etc/init.d/ (and sometimes even /data/local/userinit.d), then you definitely want to go the init.d route, as it's pretty much bulletproof and needs virtually no resources to operate - it's built-in to the system.
    If your ROM is stock-based, it probably doesn't support init.d - but it might. Ask the developer of your ROM if it has init.d support (and then let me know :)). This recipe can be done on stock with init.d support! I include a link to a stock 4.1.2 kernel with init.d support in the ramdisk that you can flash before the M-Kernel Plus. Then just create /system/etc/init.d, chmod it 0755, and drop your script in there.
    If your ROM is CyanogenMod (CM) based, then not only does it have init.d support, it has userinit.d support, which is great because it persists between dirty flashes. userinit.d is a directory you create in /data/local and chmod 0755. Any script you put in there (chmod 0755) will be run as it would were it in /system/etc/init.d
    If you're completely stock but rooted (hey, it happens), and you want the buttery goodness but you don't want to flash a kernel - don't fret! I've even included a way for you to get what you can from the recipe! You'll be using an app called Script Manager (it's free, but you can donate, too. It's totally worth it) to autoload the script at boot-time. A couple of extra steps, but absolutely no mucking around under the hood :)

    Personally, whether I'm on stock or something CM-based, I prefer having init.d (and userinit.d) support, as like I said, it's pretty much bulletproof and requires no extra resources. I, myself, run ParanoidAndroid 2.23, which is CM-based. It's the best-running, sturdiest, most usefully customized ROM I have ever used on any device, and I can't recommend it enough. Team Paranoid Android is top-notch!

    ...Now that you've decided on, flashed, setup and customized a ROM (or maybe you stayed stocked)...

    BEYOND THIS POINT, THERE BE DRAGONS!
    I'm not responsible if you FUBAR your device. But, if you follow my directions and pay attention to what you're doing, you won't.
    This tutorial assumes basic knowledge of the Android operating system, related terminology, and the most basic of Linux understanding. Any term I use in this guide can be quickly and easily Googled.

    [Stock, rooted, no init.d] Installing the Special Sauce script and Script Manager:
    * Open the Play Store and get the Stericson's Busybox Installer and install it
    * Run the program, let it boot up and figure out what's where (takes a bit)
    * Install Busybox 1.20.2 to /system/xbin
    * Create /sdcard/scriptinit.d
    * Copy the script you decided on into /sdcard/scriptinit.d
    * Open the Play Store and get Script Manager and install it
    * Run Script Manager, find your script, load it up, click the little root icon, and set it to run at boot
    * Close Script Manager
    * Skip to [Common (except CM-based)] Install M-Kernel Plus

    [Stock, has init.d] Installing the Special Sauce script:
    * Open the Play Store and get the Stericson's Busybox Installer and install it
    * Run the program, let it boot up and figure out what's where (takes a bit)
    * Install Busybox 1.20.2 to /system/xbin
    * Copy the script you decided on into /system/etc/init.d/ and chmod it 0755
    * Skip to [Common (except CM-based)] Install M-Kernel Plus

    [Stock, needs init.d] Installing the Special Sauce script and creating init.d:
    Download:Nexus7Stock_Insecure_InitD_4.1.2.zip by Metallice
    * Reboot into recovery
    * Flash Nexus7Stock_Insecure_InitD_4.1.2.zip
    * Go to advanced and fix permissions
    * Go back and reboot system
    * Open the Play Store and get the Stericson's Busybox Installer and install it
    * Run the program, let it boot up and figure out what's where (takes a bit)
    * Install Busybox 1.20.2 to /system/xbin
    * If /system/etc/init.d/ does not exist, create it, and make sure it's chmod 0755
    * Copy the script you decided on into /system/etc/init.d/ and chmod it 0755
    * Skip to [Common (except CM-based)] Install M-Kernel Plus

    [CM-Based] Installing the ramdisk, M-Kernel Plus and Special Sauce script:
    CM really should have busybox. If it doesn't, install it.
    Download: Nexus7_CM10_PA22_4.1.2_complete.zip
    and
    the M-Kernel Plus of your choice from Metallice's M-Kernel Classic/Plus thread
    * Reboot into recovery
    * Flash Nexus7_CM10_PA22_4.1.2_complete.zip
    * Go to advanced and fix permissions
    * Go back and flash the M-Kernel Plus you downloaded
    * Go to advanced and fix permissions again
    * Go back and reboot system
    * If /data/local/userinit.d/ does not exist, create it and chmod it 0755
    * Copy the script you decided on into /data/local/userinit.d/ and chmod it 0755
    * Skip to [Common] Verifying Installation

    [Common (except CM-based)] Install M-Kernel Plus
    Download: the M-Kernel Plus of your choice from Metallice's M-Kernel Classic/Plus thread
    * Reboot into recovery
    * Flash M-Kernel_alpha1_446GPU.zip
    * Go into advanced and fix permissions
    * Go back and reboot system
    * Profit - You're done!

    [Common] Verifying Installation
    Pretty easy to verify if it's working. First off, it'll be really fast and snappy! Second, if you're using zRAM, you can open a terminal or adb shell from your PC and

    free

    The last line it outputs will be for swap (this is actually your compressed zRAM). For total and free, there should be numbers. If there are, then you have a page file and it's working.
    Finally, you can open a terminal or adb shell from your PC and

    mount | grep discard

    It should output 2 lines, one for /data and one for /cache. That means it's working.

    [Common] Further Optimization:
    I recommend the Play Store app System Tuner for further customization. The customizations I recommend are
    * Undervolt the entire system by -50mV
    * Try that for a day or two and then try another -25mV
    * If you end up stable at -75mV, leave it be. That's a good unvervolt
    * CPU Governor should be set to either interactive or ondemand, unless you're a hardcore gamer, in which case you might want to use performance
    * CPU Frequencies can be set. I use 100-1300. Use whatever floats your boat
    * I/O Scheduler can be specified. I recommend deadline in every situation, as it's specially modified by _motley
    * Go to Boot Settings from any of those screens, and save cpu and sd via the 'on boot complete' or init.d method (if you chose not to implement init.d, choose upon boot completion).
    * Back out of System Tuner and reboot
    * Profit

    Feel free to take it from there, and post your experiences here :)
    6
    I've noticed most people are using a 256mb zRam and I was planning on addressing that..

    Everything Kzakhar said is true. By dedicating 256mb to zRam, you're effectively cutting your system RAM to 768mb. Since that 256mb chunk is always present and compressed, you use CPU cycles (and by proxy, battery) to constantly compress/decompress the information being read from it and written to it.

    If you use your tablet as most people do -- that is, one app running in the foreground, and you don't do a lot of 'recents -> switch app -> work some -> recents -> switch back -> rinse/repeat' -- then you probably don't need much zRam, if any at all. I recommend zRam because it helps -- a LOT -- with launcher lag after exiting an app, but for that you only need a 64mb zRam. Hardcore gamers and those who want superior battery life will disable zRam altogether, while forum warriors who often have 3 browsers, 2 apps, maps, officer suite, and trillian open all at once will choose a 256mb zRam. Personally, I run 128, as I often fall in the middle of these two extremes.

    I hope this helps shed some insight into why and how to utilize zRam :)
    4
    Download: Nexus7_CM10_PA22_4.1.2_complete.zip

    Those of you on ParanoidAndroid and other CM10 based ROMs who can't get the zram to turn on, download this, then

    * reboot into CWM
    * flash this zip
    * go to advanced and fix permissions
    * reflash M-Kernel Plus
    * fix permissions again just to be safe
    * reboot
    * profit (I hope)

    Please report your findings

    DON'T DO THIS if you're not on a CM-based ROM.

    If anybody is stock-based and having this issue, let me know. AFAIK, everyone experiencing this is on something CM-based..
    3
    A couple of people have asked if this script is compatible with and relevant to Android 4.2/4.2.1
    Yes, and yes. It is both compatible and relevant (and very beneficial) in the latest versions of Android, whether you use zRAM or not. All you need is a working busybox installation and a compatible kernel (any kernel with init.d, fsynccontrol & zRAM suppprt) to take full advantage :)

    The OP has been updated to reflect current compatibility.
    2
    Just In Case

    Update 11/10/2012

    If you are using kernel a6 or better, you don't need to flash any other kernel or ramdisk zip first. Starting with a6, Metallice compiles his own universally-compatible ramdisk.