LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   $MACHTYPE differs from uname -m (https://www.linuxquestions.org/questions/linux-newbie-8/%24machtype-differs-from-uname-m-4175441557/)

N4n0lix 12-15-2012 09:07 AM

$MACHTYPE differs from uname -m
 
Hello,

I'm quite new to Linux (3 months on my laptop from now) and still exploring how it works and so on. I've got Debian 6.0.6(squeeze) with kernel 2.6.32-5-686. Now i came up to something strange:
Code:

uname -m
i686

the result is as excpected from kernel version 2.6.32-5-686
but now
Code:

echo $MACHTYPE
i486-pc-linux-gnu

Can someone explain to me why uname prints out i686 and $MACHTYPE i486?

N4n0lix

malekmustaq 12-15-2012 10:34 AM

Quote:

Can someone explain to me why uname prints out i686 and $MACHTYPE i486?
The uname -m function reads from the machine and reports what the machine thinks/knows of itself --check the machine:

Code:

~# dmidecode | grep Family
Signature: Type 0, Family 6, Model 42, Stepping 7

Whereas, to the contrary, every Operating System always seeks maximum backward and forward compatibility, and it usually declares itself to the backward portability: declaring to be compatible to the older earlier architecture rather than the latest; thus, in declaring its environment, it fixes the VARIABLE $MACHTYPE according to its (Operating System's) preferences 4x86 without negating the fact that it is also compatible to the newer architecture 6x86 which generally the user needs not worry. The operating system simply proclaims itself to be compatible to an older architecture; it is a declaration about itself (the OS), not about the current condition of the machine.

Therefore when "echo VARIABLE" is issued it reads from the environment according to the dictates of the operating system (not according to the dictates of the machine) --check the testimony of the operating system:

Code:

~# declare | grep MACH
MACHTYPE=i486-slackware-linux-gnu

As you see, consistently, the MACHTYPE echoed always bears the distro (debian or slackware) as the sworn witness to that statement, to inform us that it is from the tongue of the OS, not from the machine record.

Hope that helps.

Good luck.

N4n0lix 12-15-2012 10:45 AM

That clarified it for me, thanks!

N4n0lix


All times are GMT -5. The time now is 03:17 AM.