KChef

- Bork! Bork! Bork!

Introdoocshun

You're running Linux. You think you're on top of the world. You think for a minute that things can't get any better. Then, you read the kernel messages dumped to your console and a little voice in your head says: "Vhy isn't thees vreettee in zee style-a ooff zee Sveedeesh Cheff? Bork Bork Bork!" (Why isn't this written in the style of the Sweedish Chef?)

If you're like me, you don't believe people when they tell you that the voice is a sign of mental illness, and you know the truth - that it is a glimpse of shear brilliance and inspiration that musn't be ignored. And so, on one rainy Pittsburgh day, I heeded the call of the Great Chef and wrote a kernel hack to end the voices.


Poorpuse-a

The hack has the sole purpose of translating all kernel messages into Sweedish Chef Bork-Speak.


Doonlued

I provide here a patch against Linux version 2.4.9. It may work just fine against other versions, particularly of the 2.4.x series. Let me know how it works, and if you modify it in any way to get things working for you (ie: if you have a different kernel version), let me know, and I'll post it here, with credit.

To install the patch, you want to run the following commands to apply the patch. First start with your linux source directory and the kchef diff file in the same directory. (Note that you will need the 'flex' lexical analizer generator, quite possibly version 2.5.4).


	$ cd linux
	$ patch -p1 < ../kchef.diff

Then, you want to compile Linux as you would normally do:


	$ gmake config
	$ gmake dep
	$ gmake 

If you don't have a working copy of flex, or it doesn't work with the patch, let me know, and use this version of linux/kernel/kchef.c.

Example-a

If you don't have the time or the willpower to install the patch on your system, you may be able to get your "Bork! Leenox" hit here.


Hoo?

The concept is pretty straightforward. The hack starts in the function printk() in linux/kernel/printk.c. After printk() handles the variable argument lists, I pass the generated string off to the lexical analyzer. The lexical analyzer has been completely gutted (hopefully) of stdio and stdlib references, for inclusion in the kernel. YY_INPUT is used to direct the lexer to read from the printk()-generated string.

The output of the lexer is put into a static kernel buffer, as is done in printk(). This buffer is returned to printk() for normal message-handling. Since cheferized text is often longer than the corresponding english, if an overflow is detected in the lexer, the un-cheferized message is passed back to printk().


Warnings

The code I provide here is nothing more than a complete and utter hack. I am not proud of the nasty things I had to do to get Flex-generated code to run in the kernel. It is almost entirely untested. Be warned. I don't know why it would do anything horrible to your computer, but you should use the software at your own risk.


Thunks

Special thanks to:


Thoonks A Lut

Special "Thoonks A Lut" to Dan Dacosta at Drexel University for having the conversation with inspired this program on the day of a final exam I should have been studying for, not kernel-hacking : )


Links