HOW-TO Customizing the boot script for Gumbo ROM 1.5c

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,797
113
Visit site
As requested here, This is a short tutorial about setting and tweaking the cpu throttle and the memory settings in the gumbo.sh file.
Here's a copy of the file to help ask and answer questions:
Code:
#
# gumbo.sh tweaker edition
# Lines marked with "#" are commented out and will not be read by the system
# Read through this entire file before you make any edits

# After editing, push this file to /system/init.d/ and reboot your phone

# Do not edit this file in any standard Windows text editor.
# Use Notepad++ if you don't understand why.  It will automatically edit
# the file correctly and it is free.
# http://notepad-plus.sourceforge.net/uk/site.htm
# ---------------------------------------------------------------------------------

# This section will determine which CPU governor to use at boot
# Make sure only one line is active
#
# performance = whenever cpu is awake and active, it will be ramped up
#   to the highest possible speed (528 Mhz in our case)  This will give a great
#   performance boost, but at the cost of battery life
#
# ondemand = when cpu is awake AND in use, it will ramp up to max.  While not in use,
#   the cpu is able to throttle down to save battery.  While the screen is on,
#   the cpu will be running 528 Mhz, while off and in use, it will run at 480 Mhz
#
# msm7k = when screen is on, the device will run at 480 Mhz normally.  Under load, 
#   it will ramp to 528 Mhz.  While the screen is off, it will run at 245 Mhz always.
#   This is the default setting that the Hero shipped with, the custom kernel included with 
#   the ROM unlocks the other two governors

#echo "msm7k" >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "ondemand" >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#echo "performance" >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

#-----------------------------------------------------------------------------------------
# The following lines pass values to configure the internal memory manager in 
#   your Android device.  There are many different ways this can be configured.
#   The first three entries are suggested settings, and should work well for most.
#   The final line can be used for testing and tweaking.  Once again, make sure only
#   one line is uncommented

#Stock settings
#echo "1536,2048,4096,5120,5632,6144" > /sys/module/lowmemorykiller/parameters/minfree

#Semi-agressive settings
#echo "1536,2048,4096,5120,15360,23040" > /sys/module/lowmemorykiller/parameters/minfree

#Maximum free RAM settings.  Not for use with SenseUI ROMS
#echo "1536,3072,4096,21000,23000,25000" > /sys/module/lowmemorykiller/parameters/minfree
# ----------------------------------------------------------------------------------------

# Tweaker time.
#   The first three values inside the quotes (1536, 2048, and 4096 should stay as they are
#   You will see trouble keeping vital processes awake if you increase these values.
#   The last three numbers are much more configurable.
#
#   The fourth number in the list (10240) controls how much RAM "Hidden" processes are
#   allowed to use.  Hidden processes are called by the system at boot time, and are
#   things that will not show up in a task manager app. In my testing, I have found
#   that I can safely set the value to 10240.  You may be able to go higher or lower, 
#   depending on how YOU are using your phone.  Increase or decrease the number in 
#   multiples of FOUR.  Example - DO NOT decrease the number by 1025.  Decrease it by
#   1024 instead.  256 x 4 = 1024 
#
#   The fifth number (15360) controls RAM used by empty content providers.  Empty 
#   is the key word.  If you only use the Gmail app, the Android mail application is 
#   an empty content provider.  The issue here is apps like Twitter and Facebook.
#   If the app was coded correctly and sleeps properly when idle, it's associated 
#   content provider may be killed off.  When the app needs that content, it will 
#   probably force close while waiting for it.  If things like HTC's social network
#   start force closing, decrease this number.  Like above, use multiples of 4 when
#   changing.
#
#   The final number is "ghosts".  Apps that were closed by the user remain in memory
#   until the memory is needed elsewhere.  This makes loading an app you've closed
#   much quicker, at the cost of a little performance when opening new apps.  
#   Crank this one up to 25000 to increase the "snap" factor.  Things like 
#   pulling down your notifications or opening a menu will stay very quick like they
#   are right after a reboot.  The offset is that when you close an app and need 
#   to jump back to it quickly, you have to load it again instead of it just redrawing
#   Unless you're looking for it, you'll not notice it much.  If you have to lower this, 
#   use multiples of 4 once again
#
# DO NOT UNCOMMENT THE FOLLOWING LINE.  This is your baseline, in case you get things
#   so screwed up you forget where you started.  Trust me.
#
#echo "1536,2048,4096,10240,15360,25000" > /sys/module/lowmemorykiller/parameters/minfree
#
# EDIT THIS ONE INSTEAD.    
echo "1536,2048,4096,10240,15360,25000" > /sys/module/lowmemorykiller/parameters/minfree

# This file is open source.  It has absolutely no license whatsoever. 
# As always, I am not responsible for anything, anywhere, at any time.
# Doing stuff like this is a good way to break your phone.
# You have been warned.

A copy is attached to this post. READ THROUGH IT HERE SO YOU KNOW HOW TO OPEN IT. Simply pushing this file as is will set your Hero exactly like mine. That may work for you, but it may not. I recommend trying as is, then make small (1024 or so) adjustments.

The file is pretty well commented, but any questions just ask.
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,797
113
Visit site
Tweaker kernel

For anyone interested in this, here's my latest kernel to play with

4shared.com - online file sharing and storage - download signed-GKTweaker-03-03-10.zip
Latest version as of 03/02/2010 20:26

README file attached, here is link if you're on WAP - README

Changes -
ext4 support
Modifications to memory killer kernel space driver.
IP tunneling
USB host/gadget support (you'll have to compile device drivers as a module then copy to /system/lib/modules/. Then symlink to /system/lib/modulesGK-1.5c/)
Extra cpu governors stripped
All kernel debugging stripped

Be sure to backup before applying. The kernel package is an update.zip file and includes the above user script file. Stable here, but not tested anywhere else.

Tested only on Gumbo 1.5c. YMMV
I'm not responsible if your phone goes tits up, or you miss important notifications/calls, or if your dog dies. Android Central certainly isn't responsible for anything I do.
You have been warned.
 
Last edited:

Andrew Ruffolo

Well-known member
Jan 5, 2010
3,567
172
0
Visit site
With the tweaker addition, do I just flash that on top of my gumbo rom already installed? And when you say flash on top of things in other posts, I just boot in recovery and flash something, when this is already on the device? I'm backed up already, so I'm not too worried experimenting. My phone killed the battery early today, but I think it was google chat that did it in. I left it on since someone added me on there.
 

Robchaos_

Well-known member
Feb 18, 2010
141
50
0
Visit site
I just flashed this onto my phone. As of now no problems to report.:cool: I'm still learning about kernels, roms, and the android OS, so if you don't mind me asking a question or two at the risk of seeming stupid...

Did the changes you made to the kernel space driver allow us to run more aggresive memory killer settings and still retain multitasking data and services? I assume these changes were made within the boot.img since I don't see much different in the gumbo.sh script.

Stripping out kernel debugging and the extra CPU governors just got rid of some bloat in the rom, right?

The USB host/gadget support
I understand the part about having to compile device drivers (the phone can't do anything with a usb device if it has no instructions for using it).
For instance, if I wanted to hook up a USB keyboard to my hero,
In addition to compiling the device drivers and adding them to the system library, I'd have to add in a set of instructions within the rom to allow such a device to be used whenever I call upa text input box.
Is my understanding of that correct?


Thank you for your time and work!
Once the phone has been up for a few hours I'll report back.
 
Last edited:

Robchaos_

Well-known member
Feb 18, 2010
141
50
0
Visit site
This is not the same kernel as in 1.5c. It can be flashed over 1.5c without a wipe and should not affect any data. Post #2 outlines the changes gbhil made.
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,797
113
Visit site
I just flashed this onto my phone. As of now no problems to report.:cool: I'm still learning about kernels, roms, and the android OS, so if you don't mind me asking a question or two at the risk of seeming stupid...

Did the changes you made to the kernel space driver allow us to run more aggresive memory killer settings and still retain multitasking data and services? I assume these changes were made within the boot.img since I don't see much different in the gumbo.sh script.

That (in theory...jury is still out) and change the polling times/priorities. I run EVERYTHING (even stocks and footprints lol) with the settings in the "new" sh script, and have zero problems. Before the changes, stocks widget would FC and HTC facebook sync would die off and only update if it was called manually.

Stripping out kernel debugging and the extra CPU governors just got rid of some bloat in the rom, right?

Got rid of bloat in the kernel. You'll get less useful error messages, but the kernel itself can run much smoother.

The USB host/gadget support
I understand the part about having to compile device drivers (the phone can't do anything with a usb device if it has no instructions for using it).
For instance, if I wanted to hook up a USB keyboard to my hero,
In addition to compiling the device drivers and adding them to the system library, I'd have to add in a set of instructions within the rom to allow such a device to be used whenever I call upa text input box.
Is my understanding of that correct?

Very close. You will need to grab my sources, build your modules against it, place them where the kernel knows to load them, then tell the system to load the modules. You'll also need to hack up your own hardware as the USB controller does not send out 5v on the bus. I'm toying around here using SCSI drivers and some cable splicing to be able to plug USB flash drives to the phone. You can bet if I ever get it working I'll let everyone know exactly how.

Thank you for your time and work!
Once the phone has been up for a few hours I'll report back.

You're welcome. Looking forward to your results.

Is that the same kernel included in 1.5c?
I'm assuming not. I may give it a try even though I don't quite understand the differences.

I appreciate your work, gbhil.
This is not the same kernel as in 1.5c. It can be flashed over 1.5c without a wipe and should not affect any data. Post #2 outlines the changes gbhil made.

Correct. This is slightly different than "Stock" Gumbo.

thanks for the vote of confidence funcrusher. Hope you like.
 

Robchaos_

Well-known member
Feb 18, 2010
141
50
0
Visit site
quick update before I go to sleep.
Phone still seems snappy. RAM numbers are reading lower then when I was running 1.5c with the custom user config update (25-30 after 2 hours of uptime), but I am trying to keep myself from clicking that task manager icon and checking RAM numbers as much because it really doesn't seem to be slower then before when it was reading 40 or 50. Benchmarks seem to perform similar to before (pi and linpack).
No force closes or processes hanging up yet.
 

Jerry Hildenbrand

Space Cowboy
Staff member
Oct 11, 2009
5,569
2,797
113
Visit site
quick update before I go to sleep.
Phone still seems snappy. RAM numbers are reading lower then when I was running 1.5c with the custom user config update (25-30 after 2 hours of uptime), but I am trying to keep myself from clicking that task manager icon and checking RAM numbers as much because it really doesn't seem to be slower then before when it was reading 40 or 50. Benchmarks seem to perform similar to before (pi and linpack).
No force closes or processes hanging up yet.

I'm not going to say anything to influence your results.

Please if you could - give it a run just as you are for a couple of days. I know you're tempted to up that RAM level :) but if you could i would appreciate it.

RE - benchmarks.
Should be about the same. The kernel probably can't run the system much faster, but still more that can be done to stabilize it. Which means no more of those "hiccups" like before it was rooted.
 

Drybonz

Active member
Dec 29, 2009
38
0
0
Visit site
gbhil... I'm running your 1.5c rom and am going to flash your new kernel over it tonight. I'll let you know how it works out for me. Thanks.
 

Robchaos_

Well-known member
Feb 18, 2010
141
50
0
Visit site
I'm not going to say anything to influence your results.

Please if you could - give it a run just as you are for a couple of days. I know you're tempted to up that RAM level :) but if you could i would appreciate it.

RE - benchmarks.
Should be about the same. The kernel probably can't run the system much faster, but still more that can be done to stabilize it. Which means no more of those "hiccups" like before it was rooted.

I'm training myself not to worry about the ram number. I more or less know how linux works with allocation of memory, and I've been trying to get myself away from the windows way of thinking. I'm setting up a VM so I can give Ubuntu a try when I get home from work tonight. It just seems like poking around in the boot.img and some other android related development things would just be much simpler in a linux environment and I'd learn more overall.
As for the benchmark, I should have added that when I sat there and a few in a row, results were much closer. Before it could have went 11800 12300 11900, now they seemed more consistent.
 

Drybonz

Active member
Dec 29, 2009
38
0
0
Visit site
RE - benchmarks.
Should be about the same. The kernel probably can't run the system much faster, but still more that can be done to stabilize it. Which means no more of those "hiccups" like before it was rooted.

I have spent some hands-on time with the new kernel and, while I have not done any benchmarking tests I'm happy to report that I am seeing less of the "hiccups" you referred to, especially in scrolling and typing. While there are still some hiccups in the system (most noticeable to me in the dialer and contacts), I am finding it to be an improvement over the 1.5c kernel IMO.

Thanks for giving us a chance to test the new kernel.
 

funcrusher

Member
Feb 2, 2010
15
0
0
Visit site
Just flashed it over your 0.31 kernel on Fresh 1.1

Everything's still snappy. Not nearly as much free ram, but I guess that was expected.

I used wifi tether for about 20 mins and that worked fine.

I'll report back later after I've spent more time with it.

Thanks again.
 

Robchaos_

Well-known member
Feb 18, 2010
141
50
0
Visit site
only thing I'm noticing so far is every once in a while when the phone has been asleep for a bit, when unlocking if you go to swipe down the taskbar, it has a few seconds of delay. This happened with stock, fresh and gumbo 1.5c so its nothing new, and it doesn't seem to happen too often. Most of the times its a clean unlock with a nice smooth swipe. Maybe the times I experience has a delay might be due to one of the taskbar icons refreshing or a new notification.
 

Forum statistics

Threads
943,151
Messages
6,917,535
Members
3,158,848
Latest member
kerokekerol