Reputation: 1549
I don't have this configuration, so I would like to find out from you.
If you have a 32-bit Linux kernel on a 64-bit hardware (e.g. Core 2 Duo, i3, i5, i7), then what outputs do you get for uname -i
, uname -m
and uname -p
? Please paste this here.
Which one of the three can decisively tell me my kernel type?
I plan to take the output from this or getconf LONG_BIT
in a bash script and determine whether to build my program only for 32-bit or for both 32-bit and 64-bit, using CMake.
Upvotes: 1
Views: 694
Reputation: 1826
I think there are something wrong in your thought.
I have one PC which CPU is Intel(R) Core(TM)2 Duo CPU, so hardware support 64bit definitely, but I install 32-bit Linux system(RedHat Enterprise Linux Server 5.4, Tikanga). Following are the output of uname -i, uname -m, uname -p:
[root@build-server-for-9K proc]# uname -i
i386
[root@build-server-for-9K proc]# uname -m
i686
[root@build-server-for-9K proc]# uname -p
i686
[root@build-server-for-9K proc]# getconf LONG_BIT
32
All output shows that the Linux Kernel is built as 32bit. The output does not show the hardware capability.
So I think neither "getconf" nor "uname" can give you guidelines whether to build 32bit kernel or 64bit kernel.
But the /proc/cpuinfo can give you information of the CPU hardware capability, such as whether it supports 64bit or not.
After you get the hardware capability, you can make the decision to build only 32bit or 32bit&64bit kernel.
Hope the above explanation can give you some help.
I also attach part of results of "cat /proc/cpuinfo":
model name : Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
Upvotes: 1