LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-25-2009, 02:30 PM   #1
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Rep: Reputation: 34
Can you kexec at boot from a 32-bit (x86) to 64-bit (x86_64) kernel?


I'm wanting to know if some test can be done to check the processor at boot, and load a kernel best suited to that architecture? I'm thinking of having two versions on an operating system loaded on a single filesystem (on removable disks), which can then select which of the two systems should run on that processor. The advantage being that anyone doing this could move from one system to another, and always have access to their favorite distribution on any processor.

Shingoshi
 
Old 06-26-2009, 06:20 PM   #2
clvic
Member
 
Registered: Feb 2008
Location: Rome, Italy
Distribution: OpenSuSE 11.x, vectorlinux, slax, Sabayon
Posts: 206
Blog Entries: 2

Rep: Reputation: 44
Although I know very few about kexec, I suppose it's not capable to change the architecture on the fly.
Anyway, I think that another option to choose at load time whether to load a 32bit or a 64 bit os, could be to start a kernel along with a minimal system that: (1) detects whether the CPU is 64bit capable, and (2) modifies grub on the fly to have the right OS loaded at the next reboot. And (3) automatically reboot.
I know this is slow, but that should be effective.

Anyway, this is an interesting question, although I do not really know whether real applications are worth it
 
Old 06-26-2009, 06:39 PM   #3
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
I have an application already in place for this. But keep this thread open, as I am still looking for others to contribute here. And it may lead to some very good results.

Shingoshi

Thank you for the thumbs up. I really appreciate it!
 
Old 06-26-2009, 06:50 PM   #4
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
Upon further reading, not a bad idea...

Quote:
Originally Posted by clvic View Post
Although I know very few about kexec, I suppose it's not capable to change the architecture on the fly.
Anyway, I think that another option to choose at load time whether to load a 32bit or a 64 bit os, could be to start a kernel along with a minimal system that: (1) detects whether the CPU is 64bit capable, and (2) modifies grub on the fly to have the right OS loaded at the next reboot. And (3) automatically reboot.
I know this is slow, but that should be effective.

Anyway, this is an interesting question, although I do not really know whether real applications are worth it
I had thought about having one system boot into another quite some time ago. The idea looked something like having a complete busybox system stored in your /boot partition. The purpose of this would be manifold:

1.) Exhaustive systems integrity check on each boot.
2.) The user would always have a rescue system in place to boot the main system and fix any errors that may exist.
3.) A solution like your suggestion is made easily possible.

I don't know if it would be absolutely necessary to reboot or not. I would hope not. I was thinking modifying a setup like that used when booting an installed system from a cd/vd when things aren't working as they should. The completely contained system in /boot would serve the same purpose. It would be used on every boot, having the ability to do a complete systems check before switching over to the main system.

I like your idea, and will give it consideration.

Shingoshi

Last edited by Shingoshi; 06-26-2009 at 06:56 PM.
 
Old 06-26-2009, 06:58 PM   #5
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,064

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Hello, how are you doing kexec?

I have used "netbootcd-3.1.1" which comes with(and is based off of) tinycore 2.0.
I am not sure what it means below where it says you need a tce for kexec
as far as I know there is no kexec.tce??
Code:
LABEL nbcd
menu label Start ^NetbootCD 3.1.1
menu default
kernel kexec.bzI
append initrd=nbinit3.gz quiet

#LABEL tinycore-kexec
#menu label Start ^Tiny Core 2.0 with kexec support (you still need the tce)
#kernel kexec.bzI
#append initrd=tinycore.gz quiet
anyway, I would like to know how you achieve it?
 
Old 06-26-2009, 07:08 PM   #6
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,064

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Shingoshi, have you read all this?

( http://en.wikipedia.org/wiki/Kexec )

( http://www.ibm.com/developerworks/li...y/l-kexec.html )
( http://www.linux.com/archive/feature/150202 )
 
Old 06-26-2009, 08:17 PM   #7
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
I'm just now getting to this...

Quote:
Originally Posted by linus72 View Post
I've never used kexec. I've only known that it exists. I was asking this question in a general manner, to know what's possible and how to go about it if so. I will now take the time to read the links you've left here. I might have seen some of them before.

Shingoshi
 
Old 06-26-2009, 08:26 PM   #8
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
Following up on this...

I've read part of the first link given. I have this thought in result:
Quote:
kexec (kernel execution) is a mechanism of the Linux kernel that allows "live" booting of a new kernel over the currently running one. kexec skips the bootloader stage (hardware initialization phase by the firmware or BIOS) and directly loads the new kernel into memory, which starts executing immediately. This avoids the long times associated with a full reboot[1], and is useful on systems with high availability requirements, where minimizing downtime is of essence.
I think the best way to do this, would be before the modules are even loaded. It wouldn't make sense to load modules for a 32-bit kernel, and then have to reload them for a 64-bit kernel. I know that VectorLinux has a nicer way of switching runlevels. Instead of shutting down everything in the old level, only to have to restart the same services in the new, the same logic should be used here. Only start those services which are common to any kernel regardless of their bit form.

That way, we don't waste time shutting down and restarting services that should have been postponed until really needed.

Let's keep this discussion open. This is beginning to get good!

Shingoshi
 
Old 06-26-2009, 08:45 PM   #9
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
A more intelligent bootloader is needed...

It seems there needs to be a bootloader capable of selecting a kernel for the running architecture. Because based on the following comments, it seems this needs to be done by the bootloader itself.
Quote:
[http://www.ibm.com/developerworks/li.../l-kexec.html] The main components of the bootloader stage are the hardware stage, the firmware stage, the first-level bootloader, and the second-level bootloader. The booting process begins when the hardware is powered on. After some initialization, control goes to the firmware. Firmware, also referred to as "BIOS" on some architectures, detects the various devices on the system, including memory controllers, storage devices, bus bridges, and other hardware. The firmware, based on the settings, hands over control to a minimal bootloader known as the master boot record, which could be on a disk drive, on a removable media, or over the network. The actual job of transferring control to the operating system is performed by the second-stage bootloader (commonly referred to as simply the "boot loader"). This bootloader allows the user to choose the kernel to be loaded, loads the kernel and related parameters onto memory, initializes the kernel, sets up the necessary environment, and finally "runs" the kernel.
Apparently, we need a set of code that detects the processor type, whether it is 32|64-bit. That would be done in the firmware stage as described above. This seems to be universal. When a system is running on a 64-bit processor, but loads a 32-bit kernel, the selection needs to take place before then. This could be done automatically, or manually with another boot menu provided to the user.

Tell me what the rest of you think about this.

Shingoshi

Last edited by Shingoshi; 06-26-2009 at 08:47 PM.
 
Old 06-26-2009, 08:59 PM   #10
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,064

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
So, do you think it's safe to the computer to do this, no ill effects?

Do you think practicing it in a virtual environment would work too?
 
Old 06-26-2009, 09:06 PM   #11
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
Not enough information yet to know...

Quote:
Originally Posted by linus72 View Post
So, do you think it's safe to the computer to do this, no ill effects?

Do you think practicing it in a virtual environment would work too?
I don't want to give an uninformed response here. This was something that I originally came up with from a "what if?" line of thought. I'm still working this through though. I wish some developers would see and pick up on this. But I definitely think the bootloader must be responsible, not kexec. Because this needs to be done before any kernel is loaded, not switching from one to another like an afterthought.

Shingoshi
 
Old 06-26-2009, 09:20 PM   #13
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,064

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Actually, here's the 2.0 kexec-loader manual

http://www.solemnwarning.net/kexec-l....0-readme.html

says it's for booting usb's, etc on computers where bios doesn't support that.
 
Old 06-26-2009, 09:44 PM   #14
Shingoshi
Member
 
Registered: Oct 2006
Location: Cochise County, Arizona
Distribution: Gentoo-AMD64 / Slackware64-Current
Posts: 474
Blog Entries: 28

Original Poster
Rep: Reputation: 34
It seems, I opened a barrel of worms...

These would be the good worms some of us liked to play with as kids. This thread could produce a great deal of fun for a lot of people.

Shingoshi
 
Old 06-26-2009, 09:45 PM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,309

Rep: Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032
kexec-loader looks like the answer - must try it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
compiling 32 bit application on 64 bit linux(x86_64) uttam_h Linux - Software 16 07-19-2008 02:33 PM
Triple Boot Suse 10.3 32 bit, suse alpha 11.0 64 bit and Windows XP (32 Bit) 1kyle Suse/Novell 1 02-28-2008 10:25 AM
AMD-64 processor with x86_64 or 32-bit kernel? oskar General 29 07-18-2007 07:01 PM
Mandriva 32-bit X86, 64-bit x86-64 & i586. La Dima Mandriva 9 10-07-2005 06:12 AM
x86-64 Kernel compile ---> i only get 32-bit Ben2210 Linux - Hardware 1 07-09-2004 07:26 AM


All times are GMT -5. The time now is 12:57 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration