Re: change kernel name

From: Richard B. Johnson
Date: Thu Feb 05 2004 - 14:34:05 EST



Hello all,

It turns out that you can easily change the kernel name, version,
etc., even on a running kernel.

Everything you need is already exported.
A very easy module and test program is attached.

Script started on Thu Feb 5 14:24:20 2004
# ./tester
Usage:
./tester <Item> <string>
Items are SYSNAME, NODENAME, RELEASE, VERSION, MACHINE, DOMAIN
# ./tester SYSNAME foo
Can't open device file, UNAME
Maybe `insmod` the driver?
# insmod unamedrvr.o
# ./tester sysname foo
# uname -a
foo chaos 2.4.24 #1 SMP Wed Feb 4 11:50:33 EST 2004 i686
# ./tester sysname Linux
You have new mail in /var/spool/mail/root
# uname -a
Linux chaos 2.4.24 #1 SMP Wed Feb 4 11:50:33 EST 2004 i686
# ./tester nodename bar
# uname -a
Linux bar 2.4.24 #1 SMP Wed Feb 4 11:50:33 EST 2004 i686
# ./tester node chaos
# uname -a
Linux chaos 2.4.24 #1 SMP Wed Feb 4 11:50:33 EST 2004 i686
# ./tester releas 1.1
You have new mail in /var/spool/mail/root
# uname -a
Linux chaos 1.1 #1 SMP Wed Feb 4 11:50:33 EST 2004 i686
# ./tester r 2.4.24
# uname -a
Linux chaos 2.4.24 #1 SMP Wed Feb 4 11:50:33 EST 2004 i686
# exit
exit
Script done on Thu Feb 5 14:27:04 2004

Have fun!


On Thu, 5 Feb 2004, Randy.Dunlap wrote:

> On Thu, 05 Feb 2004 07:04:26 -0500 "Nicholas Berry" <nikberry@xxxxxxxxxxxxx> wrote:
>
> | Note the words 'after the compilation'.
>
> I think that the other person who answered 'no' was close enough.
>
> BTW, did you say what processor architecture and what kernel
> image file format? If it's a zipped kernel image, changing text
> in it is a bit tougher, I guess. If it's not zipped, almost
> anything could change that string (just not make it larger).
>
> --
> ~Randy
>
> | >>> "Richard B. Johnson" <root@xxxxxxxxxxxxxxxxxx> 02/04/04 07:38AM
> | >>>
> | On Tue, 3 Feb 2004, Gaspar Bakos wrote:
> |
> | > Hello,
> | >
> | > I have the following question:
> | > If I compile the kernel (2.4.*) and boot it in, then the
> | kernel-release,
> | > as shown by 'uname -r' will be the string that was in the
> | EXTRAVERSION
> | > string from the kernel Makefile.
> | > Is there any way to change this 'identity' of the kernel after the
> | > compilation?
> | > Such as
> | > changekernelname bzImage "newname"
> |
> | Put anything you want in the structure, system_utsname, in your copy
> | of
> | linux-nn-nn/init/version.c.
> |
> | Cheers,
> | Dick Johnson
> | Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
> | Note 96.31% of all statistics are fiction.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.

Attachment: module.tar.gz
Description: Binary data