LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-21-2015, 11:16 PM   #1
anctop
Member
 
Registered: Feb 2010
Posts: 99

Rep: Reputation: Disabled
replacing kernel for 32-bit system


I'm sorry for asking an old question.

In my understanding, it seems possible to replace the kernel of a purely 32-bit system with a 64-bit kernel.
It sounds natural that the 32-bit executables will run on such a "hybrid" system, but I concern about the effect on the development environment.
As the original tools (binutils, gcc, glibc, etc) are all 32-bit, will they take care of the inconsistency with the kernel and run correctly under the hybrid system ?
 
Old 06-22-2015, 03:31 AM   #2
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
Sorry guy, but I think I do not understand:
Quote:
replace the kernel of a purely 32-bit system with a 64-bit kernel
What do you mean by that?
It is impossible (to replace only the kernel), but you need to replace all the drivers, and a lot of other things too. That means you need to install a 64bit OS. And a 64bit os is capable to run 32bit programs, and the development environment is not an exception.
Probably you mean multiarch os, but I do not really understand you.
 
Old 06-22-2015, 09:32 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,649
Blog Entries: 4

Rep: Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934
Exactly so: the 64-bit capable hardware now runs in its native, 64-bit mode. The kernel is compiled to run 64-bit instructions and to build the virtual-memory (et al) data structures needed by the CPU in that mode. And-d-d-d... this change necessarily bubbles all the way to the top of the entire software stack. A 64-bit version of "glibc" must be available. 64-bit executables must be used as often as possible (although 64-bit Linux can deploy a process in 32-bit compatibility mode).

Situations that involve the running of 64- and 32-bit software "at the same time" (a) can only be done at the application level, and (b) are very inefficient and awkward. The term, "thunking," is very apropos. ("Clunking, Wheezing, and Spewing Smoke" would also be appropriate. Yes, it can be done. No, you'd prefer not to be doing it. You have a racehorse: don't put hobbles and blinkers on it.)
 
Old 06-22-2015, 10:26 PM   #4
anctop
Member
 
Registered: Feb 2010
Posts: 99

Original Poster
Rep: Reputation: Disabled
Thank you for your explanations.

It is of course an intuitive assumption that system executables should match the kernel, but it is not groundless as I wrote
Quote:
it seems possible to replace the kernel of a purely 32-bit system with a 64-bit kernel
I've conducted an experiment using a pre-compiled kernel and an initrd image from an earlier Slackware distribution :
  • Firstly I retrieved a 64-bit kernel from "slackware64-x.x/kernels/huge.s/bzImage" and a 32-bit initrd image from "slackware-x.x/isolinux/initrd.img"
  • All the downloaded files were then copied to a bootable FAT partition with SYSLINUX installed.
  • At the "boot:" prompt I entered the parameters :
    Code:
    bzImage root=/dev/ram initrd=initrd.img rw
  • The booting process was completed successfully. Commands from coreutils, util-linux, etc seemed to work as usual, and "uname -m" returns "x86_64".
The experiment was repeated using the combination of 32-bit kernel and 64-bit initrd, but it failed to boot then.

The result of the experiments, I think, indicates the possibility of constructing a hybrid system with 32-bit executables and a 64-bit kernel, and this is the reason for my asking the question about the behaviour of development tools.
 
Old 06-23-2015, 03:45 AM   #5
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
please read this: https://en.wikipedia.org/wiki/Initrd (and the link to the linux startup process)
 
Old 06-23-2015, 05:08 AM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
It is totally possible to use a 32 bit userland on top of a 64 bit kernel, this configuration just works, no 64 bit glibc and no other 64 bit parts in the software stack are needed (for anyone not believing that: go ahead and try it, you will see). You will only need a 64 bit software stack if you actually plan to use 64 bit software, or if you need proprietary drivers for your AMD videocard, these drivers don't support this configuration (don't know for Nvidia, never tried that).
 
Old 06-23-2015, 08:39 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,649
Blog Entries: 4

Rep: Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934Reputation: 3934
Tobi, of course you are technically correct: the 64-bit kernel can run a 32-bit userland stack. The x86 microprocessor (for instance) has well-defined architectural support for that. But this is not what is typically done, nor if at all possible should (IMHO) be done, because ... even though the kernel can use "all that 64-bit goodness" to make full use of what this CPU can do, the individual userland processes are firmly stuck in the past. The kernel can exploit 64-bit mode to run a whole bunch of "2/4 gigs max" virtual address spaces in a machine with capacious RAM capacity, but those processes, as individuals, are still stuck with that individual limitation.

Most systems that I see will have two sets of libraries ... 64 bit and 32 bit ... side-by-side in userland.
 
Old 06-23-2015, 08:47 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by sundialsvcs View Post
But this is not what is typically done, nor if at all possible should (IMHO) be done, because ... even though the kernel can use "all that 64-bit goodness" to make full use of what this CPU can do, the individual userland processes are firmly stuck in the past. The kernel can exploit 64-bit mode to run a whole bunch of "2/4 gigs max" virtual address spaces in a machine with capacious RAM capacity, but those processes, as individuals, are still stuck with that individual limitation.
Of course, a 32 bit program will still be limited to 32 bit. If it should be done, well, some kernel developers think different about that topic than you and I personally see nothing wrong with it.
 
Old 06-23-2015, 07:21 PM   #9
anctop
Member
 
Registered: Feb 2010
Posts: 99

Original Poster
Rep: Reputation: Disabled
TobiSGD, thank you for your justification.

I fully understand that such a hybrid system is meant to be experimental, but I'm interested in program compilation therein, e.g. when building software packages from sources.
It is expected that 32-bit development tools and library can only produce 32-bit executables. But if architecture detection is involved (e.g. in most "configure" scripts), will the inconsistency with the kernel break the compilation ?
 
Old 06-24-2015, 12:43 AM   #10
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
the compilation itself is not related to the kernel. The kernel is only used to run the tools you use and the result will only depend on the tools you have. You can use the -march=<something> to specify the target architecture
 
1 members found this post helpful.
Old 06-24-2015, 06:45 PM   #11
anctop
Member
 
Registered: Feb 2010
Posts: 99

Original Poster
Rep: Reputation: Disabled
Thanks for the answers.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any solution for debugging 64-bit kernel with using qemu-system-32bit host? chaoxifer Linux - Virtualization and Cloud 1 08-12-2015 07:41 AM
Compiling UM fails for 32 bit kernel, but works for 64 bit kernel gregorian Linux - Kernel 2 02-10-2014 10:32 AM
C++ support in kernel module in 64-bit system yuhuahe Linux - Kernel 3 08-19-2011 06:15 PM
Has anyone installed a 32-bit debian system to replace their current 64-bit system? BigVig Debian 2 06-27-2008 10:44 AM
how to compile 32 bit kernel on 64bit system slantoflight Linux - General 3 03-15-2006 11:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:45 PM.

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