# CONFIG_x86_64=y set but 32 bit kernel ?

## gringo

hi all,

hopefully someone can sched some light : we all know about the in-kernel merge some time ago between both i386/x86_64 resulting in only one arch, x86. 

That´s all fine and cool, but why do i get a 32 bit kernel even if i have CONFIG_X86_64=y set ?

```
-->ls -la arch/x86_64/boot

total 8

drwxr-xr-x 2 root root 4096 oct  5 14:36 .

drwxr-xr-x 3 root root 4096 oct  5 14:36 ..

lrwxrwxrwx 1 root root   22 oct  5 14:36 bzImage -> ../../x86/boot/bzImage
```

```
-->file arch/x86/boot/bzImage

arch/x86/boot/bzImage: Linux kernel x86 boot executable RO-rootFS, root_dev 0x906, swap_dev 0x1, Normal VGA
```

The vmlinux image created in the root directory is 64bit btw.

Is this expected ? I have been searching and looking around a bit but i don´t see anything that explains this behaviour and yes, this happens with gentoo-sources and with current git.

I guess the Kernel section is better suited for this thread than the amd64 one, even if it apparently is x86_64 related. More kernel gurus will read this here.

TIA

( this question came up in a thread in the spanish section of this forums -> https://forums.gentoo.org/viewtopic-t-714420.html)

----------

## jw5801

This is expected I believe. I know I definitely have a 64-bit kernel, yet it still gets compiled into the x86 directory and symlinked. Try booting into the kernel and checking with: 

```
uname -m
```

Should tell you it's x86_64. `uname -a' will give you a bunch of other info about your kernel too.

----------

## gringo

yeah, i know, uname says it´s a x86_64 system of course but i was wondering why the kernel image is 32bits, at least the compressed kernel image is.

cheers

----------

## jw5801

I think most bootloaders can only load 32-bit executables, therefore the compressed image is 32-bit but actually unloads the 64-bit kernel. That's just an educated guess though.

----------

## gringo

thanks, that´s what i was guessing too. 

I´ve read somewhere the kernel is responsible to switch to long mode once executed, but my thought was this was only because of a grub ( paging) limitation and that´s why i was a bit confused after seeing the default generated kernel was 32bit only. I assumed lilo could boot such a beast.

thanks for your input  :Smile: 

----------

## gimpel

They just merged i386 and x86_64 tree into x86 in the kernel, as both is x86 after all.

http://lwn.net/Articles/243704/

----------

## gringo

 *Quote:*   

> If you end up with a symlink in arch/x86_64/boot then your kernel is 64bit.

 

no, it´s not, check yourself. 

Apparently it will switch to long mode once run but file says it isn´t a 64bit executable.

cheers

----------

## gimpel

Ah, I thought you were just wondering why the bzImage ends up in arch/x86

----------

