Linux offers a limited way to change the values reported by uname
, with the personality
system call which can be invoked via the setarch
utility (part of the util-linux package available on every non-embedded Linux). For example you can use setarch i386 myprogram
or linux32 myprogram
on an amd64 machine to make a program believe that it's running on a 32-bit x86 system.
However there's no way to change the version reported by uname
to an arbitrary number.
It's also possible to change the host name for a process tree, with UTS namespaces.
schroot can set those parameters according to the configuration of the chroot.
But for compiling software, changing the information reporting by uname
is not sufficient. You also need to use the right compiler for the target processor, link with the right code, etc. This is known as cross-compiling, and a cross-compiling environment does not use any information about the host to decide what to build and how to build it. So forget about faking uname
and instead read up on, starting with Cross compiling a kernel module, and with the kbuild documentation.