Confused by xconfig behaviour.

Nifty Fedora Mitch niftyfedora at niftyegg.com
Wed Nov 12 20:00:57 UTC 2008


On Mon, Nov 10, 2008 at 03:30:48PM -0700, Reg Clemens wrote:
> 
> Im confused by xconfig behaviour.
> 
> I am on a 64bit Pentium.
> If I am running a 32 bit kernel, and I go to build a kernel, I dont see any 
> 32/64
> bit options, it just assumes 32bit.
> If I am running a 64 bit kernel, and I go to build a kernel, I dont see any 
> 32/64
> bit options, it just assumes 64bit.
> 
> Shouldnt I be able to build a 64bit kernel while running in 32bit mode?
> -- 
>                                         Reg.Clemens
>                                         reg at dwf.com
 
Cross compiling can be hard.

Do not expect it to be a simple flag or two.

The "just assumes XXbit" is mostly the compiler.  While not
a useful answer in itself see the -m32, -m64, -mtune and -mmachine-option for gcc.

There are many compiler and library hints in the base install.
For the kernel look at the config flags -- mostly flags with X86_64 in them....
On this 64bit kernel in /boot/config* I see flags like.
    CONFIG_64BIT=y
    # CONFIG_X86_32 is not set
    CONFIG_X86_64=y
    CONFIG_X86=y

Other flags may be CCFLAGS in Makefiles...

The first order tricky parts include the actions of #include files...
kernel-devel and kernel-headers.... 

At first this did not work for me but
after a "yum install glibc-devel.i386" on this X86_64bit F9 system.
  $ gcc -m64 hello.c
  $ file a.out
  a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
  $ gcc -m32 hello.c
  $ file a.out
  a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

For cross compiling start with small, medium and large C programs then look at the kernel.
The kernel is a "C" program that does a lot of things that applications should
not.  It does bend some rules -- including some ABI rules that userspace programs cannot
so a simple application cross compile setup may not be enough.

Bootstrap cross compiling is interesting.   Sometimes the bridge bits in the past
no longer apply and you can no longer get there from here without a pile of work.

You may find that restructuring your disk to isolate /home and reinstalling 
is the way to go.


-- 
	T o m  M i t c h e l l 
	Found me a new hat, now what?




More information about the users mailing list