[Vibrant Android Development] s0niqu3:
Hi again everyone,

So this is kind of a continuation of my earlier thread here: http://xdaforums.com/showthread.php?t=977211

Cmenard and I were talking earlier about adding the individual developers custom kernel "names" into that display string, and thanks to his direction, now we can!

Its kind of "hack-ish" right now, piggybacking on either the version# or the individual build #XX string in order to actually display in Settings.apk, and so it makes the string look nasty and unformatted. Sadly though, even though I've spent 3-4 hours learning rudimentary regex syntax to understand the code used, I don't feel comfortable enough yet to modify it.

(If anyone here is a REGEX master and can tell me how to build the string and insert it into the original AOSP regex string, then I'll update both this thread and my Settings.apk thread accordingly.)

Here's the AOSP regex code for anyone that's a master and wants to help me out, my best guess would be to group the third line (group 1) a second time, and after it finds white space, then add something to look for anything other than a digit (assuming devs always end their name with a numerical version number) maybe something like: ([^\\d]+[\\d]*)\\s+

"\\w+\\s+" + /* ignore: Linux */
"\\w+\\s+" + /* ignore: version */
"([^\\s]+)\\s+" + /* group 1: 2.6.22-omap1 */
"\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+" + /* group 2: (xxxxxx@xxxxx.constant) */
"\\((?:[^(]*\\([^)]*\\))?[^)]*\\)\\s+" + /* ignore: (gcc ..) */
"([^\\s]+)\\s+" + /* group 3: #26 */
"(?:PREEMPT\\s+)?" + /* ignore: PREEMPT (optional) */
"(.+)"; /* group 4: date */

Ok, so source for kernel developers:

In the makefile:

First, at the very top, change the name to whatever you want, though if you want it appended to the kernel version (for instance 2.6.32.9-XXXXXkernelXXXXX) then you need to make sure you omit ANY whitespace/

NAME = Categorically Worthless v4
or
NAME = CategoricallyWorthless4

then in "define filechk_version.h"

Change the line:

(echo \#define LINUX_VERSION_CODE $(shell \

to the following

(echo \#define LINUX_CODE_NAME \"$(NAME)\"; \
echo \#define LINUX_VERSION_CODE $(shell \

And second, in /init/version.c we need to display the LINUX_CODE_NAME somewhere, and this depends on your naming convention in the makefile; did you use whitespace or not?

If you DIDN'T use whitespace, the cleanest formatting is to append to the version number string:

in "const char linux_proc_banner[] ="

Change the first line

"%s version %s"

to the following

"%s version %s" "-" LINUX_CODE_NAME

If you DID use whitespace in your kernel name, then instead change the last line

" (" LINUX_COMPILER ") %s\n";

into two lines that read

" (" LINUX_COMPILER ") "
LINUX_CODE_NAME " %s\n";

If you move the position of the LINUX_CODE_NAME in proc_banner in version.c, anywhere else, or if your kernel name isn't formatted properly (without whitespace for the first version) then it breaks the entire display, and Settings.apk will just display "Unavailable."

And the result (coupled with my settings.apk mod I posted earlier) will display this:

left image is the first method (no white space in kernel "name") right image the second method

So there you go, an easy way for users to know what kernel version they have installed.

I hope someone finds this useful, and be sure to also thank cmenard for his help in this.

Cheers everyone, =)