LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-26-2015, 01:28 PM   #1
cooperjay
LQ Newbie
 
Registered: Jun 2015
Posts: 6

Rep: Reputation: Disabled
Why Can't I Generate a 64 Bit Kernel on a 64 Bit Computer?


I'm new to Linux and this Forum, but not new to computers. That said I have a lot to learn.

I'm running PCLinuxOS. On an HP p7-1254. The computer has a Pegatron 2ACF Ver 1.03 motherboard, a quad core AMD A6-3620 cpu (Which is a 64 bit processor executing the X86-64 instruction set) and 8GB of memory.

I downloaded the latest Linux Kernel source (4.1.0) and followed the cookbook for generating a new kernel. The generation worked and I'm able to run with the kernel. However, when I checked the config file I found that the kernel was for a 32 bit machine. I then checked all previous kernels as generated by Synaptic and they were also 32 bit kernels. I then went back and in a new directory untared the distro and ran menuconfig. The only item I changed was the first one which was to generate a 64 Bit Kernel. I then tried to make the kernel and got the following:

---------------------------------------------------------------------

[root@localhost linux-4.1]# make && make modules_install && install
HOSTCC scripts/kconfig/conf.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
#
# configuration written to .config
#
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:664: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_64.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
CHK include/config/kernel.release
UPD include/config/kernel.release
WRAP arch/x86/include/generated/asm/clkdev.h
WRAP arch/x86/include/generated/asm/cputime.h
WRAP arch/x86/include/generated/asm/dma-contiguous.h
WRAP arch/x86/include/generated/asm/early_ioremap.h
WRAP arch/x86/include/generated/asm/mcs_spinlock.h
WRAP arch/x86/include/generated/asm/scatterlist.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
kernel/bounds.c:1:0: error: code model ‘kernel’ not supported in the 32 bit mode
/*
^
kernel/bounds.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
Kbuild:43: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:989: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

--------------------------------------------------------------------

Why is this happening and can anyone help?

Thanks

Jay
 
Old 06-29-2015, 05:49 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Just for my info, which output do you get when running...
Code:
file /bin/bash
?
(p.s.: and "file /usr/bin/gcc"?)

Last edited by Pearlseattle; 06-29-2015 at 05:50 PM.
 
Old 06-29-2015, 07:34 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Simple google found this as first hit. Seems to cover your query.
But things are always changing - if you still have problems after that, run this and post the result
Code:
grep "64" <your-config-file> | grep -vE "(=m|^#)"

Last edited by syg00; 06-29-2015 at 08:04 PM. Reason: change config file from system
 
Old 06-29-2015, 09:41 PM   #4
cooperjay
LQ Newbie
 
Registered: Jun 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
In response to Pearlseattle:

-----------------------------------------------------------------

[root@localhost ~]# file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=d15a53e08f627374f47136eaae758d0f8a89a9b4, stripped
[root@localhost ~]# file /usr/bin/gcc
/usr/bin/gcc: symbolic link to `/etc/alternatives/gcc'

------------------------------------------------------------------

In response to syg00:

The link you provided was the first thing I tried. It failed in a manner much like the failure described.

The system seems to add boot locations to grub. So backup of the kernel isn't a problem. I'll just boot an old working kernel.

Response to the command provided for the 32 bit config file that worked:

-------------------------------------------------------------------------------

[root@localhost boot]# grep "64" config-4.1.0 | grep -vE "(=m|^#)"
CONFIG_X86_CMPXCHG64=y
CONFIG_NR_CPUS=64
CONFIG_HIGHMEM64G=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_X86_RESERVE_LOW=64
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
CONFIG_AGP_AMD64=y
CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
CONFIG_CFAG12864B_RATE=20
CONFIG_XZ_DEC_IA64=y
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y

-----------------------------------------------------------------------------------------------

This is the output from the 64 bit config file that produced the output provided in the first message.

-----------------------------------------------------------------------------------------------

[root@localhost linux-4.1]# grep "64" .config | grep -vE "(=m|^#)"
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_X86_64_SMP=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
CONFIG_NR_CPUS=64
CONFIG_X86_ESPFIX64=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_X86_64_ACPI_NUMA=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_X86_RESERVE_LOW=64
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
CONFIG_AGP_AMD64=y
CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
CONFIG_CFAG12864B_RATE=20
CONFIG_XZ_DEC_IA64=y
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y

--------------------------------------------------------------------------------------------

Thanks for any help.
 
Old 06-30-2015, 02:02 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
The config looks sane.
You will need a 64-bit toolchain - I'm guessing the gcc is 32-bit also. Try this instead
Code:
file $(which gcc)
 
Old 06-30-2015, 06:48 AM   #6
cooperjay
LQ Newbie
 
Registered: Jun 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
syg00:

The files are different, although the last half dozen or so entries are the same.

That said the answer to the gcc question is:

-----------------------------------------------------------------------------------------

[cooperjay@localhost ~]$ file $(which gcc)
/usr/bin/gcc: symbolic link to `/etc/alternatives/gcc'

-----------------------------------------------------------------------------------------
 
Old 06-30-2015, 07:04 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
so try: file $(readlink /etc/alternatives/gcc)
 
Old 06-30-2015, 09:25 AM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
You are currently running a 32-bit Linux, which means you can only use a 32-bit gcc.

There are 32-bit builds of gcc that can be used to compile for 64-bit. But I don't know how you would obtain/install such in PCLinuxOS. (That doesn't mean it is difficult, just that I don't know PCLinuxOS).

I suspect you would be better off starting over with a 64-bit install of Linux before (or instead of) trying to compile your own kernel. That does not mean that is your only choice, just that compiling a 64-bit kernel on a 32-bit Linux is unusual enough that you will find few people here able to guide you through the details.
 
1 members found this post helpful.
Old 06-30-2015, 02:45 PM   #9
cooperjay
LQ Newbie
 
Registered: Jun 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
pan64 as per your request:

--------------------------------------------------------------------------------------

[cooperjay@localhost ~]$ file $(readlink /etc/alternatives/gcc)
/usr/bin/gcc-4.9.2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=996f67273da0baf8c22bd909f7c67bc0fa61424f, stripped

-----------------------------------------------------------------------------------------

johnsfile:

You mention starting with a 64 bit install of linux. I'm new to the community, but would have thought that the kernels needed to be built to the specific target machines, that's why I tried to compile my own kernel. Better yet do you know where I can obtain a 64 bit install of Linux?

Thanks
 
Old 06-30-2015, 03:44 PM   #10
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by cooperjay View Post
thought that the kernels needed to be built to the specific target machines,
No. There is virtually zero difference between x64 CPUs and the default kernel compile (even if you compile yourself on your target machine) is for the common features of all x64 CPUs.

Quote:
Better yet do you know where I can obtain a 64 bit install of Linux?
Most Linux distributions have either only 64bit or both 32bit and 64bit.

Just pay attention to the details listed on the download page of whatever distribution you choose.
 
Old 07-01-2015, 01:58 AM   #11
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You can create a cross-toolchain from source yourself. First create a cross-binutils targeting x86_64 and then a cross-gcc for x86-64 using the cross-binutils.

Do a websearch for more info. If you can't get it done post the problem here.

If above seems difficult best would be to install a 64bit distro as advised above.
 
Old 07-01-2015, 06:59 AM   #12
cooperjay
LQ Newbie
 
Registered: Jun 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
johnsfile and veerain: Like I said at the start, I'm new to Linux and without a lot more research and experience compiling my own kernel with my own tool set seems a far reach.

I'd like to load just the kernel but the distro contains everything. So I'll offload the data acquired and reload everything. That's probably the easiest and best thing I can do.

Thanks to all who provided help. I'm getting what I came for, which was knowledge of Linux. Thanks again.
 
Old 07-01-2015, 08:19 AM   #13
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by cooperjay View Post
I'd like to load just the kernel
You might think that. But even after building the kernel, that would have been a much worse can of worms than you imagine. Installing a 64 bit kernel into a 32-bit installed Linux is doable, but not simple.

Quote:
So I'll offload the data acquired and reload everything. That's probably the easiest and best thing I can do.
Correct.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] New kernel in -current (32 bit, 64 bit) and in 14.1( 64 bit) hitest Slackware 24 03-08-2014 10:10 AM
This is a 32 bit computer, you can't use 64 bit software on it. Aquarius_Girl Linux - Newbie 6 03-26-2013 06:24 AM
What makes a computer 64-bit or 32-bit ? exceed1 Linux - General 4 11-19-2008 01:57 AM
new 64 bit computer - can i install 32 bit suse 9.3 joel b SUSE / openSUSE 2 08-28-2005 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 06:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration