Jump to content











Photo
- - - - -

WinKexec - kexec for NT-based systems


  • Please log in to reply
34 replies to this topic

#1 slothman

slothman

    Member

  • Members
  • 38 posts
  •  
    United States

Posted 12 March 2009 - 05:03 AM

Hello,

I had just installed kexec onto my gentoo server and it was really cool how I could now reboot instantly or load grub4dos/etc without going thru the stupid reallly slow intel bios.

Then I thought it would be really cool if there was such a thing for windows nt-based systems, because 9x has this feature already (the fast reboot thing, dunno about loading grub4dos or linld from inside 9x).

So I searched for awhile on google and found that someone had managed to port the kexec-tools (not the driver) to windows. I kept looking and found that John Stumpo is working on WinKexec, which is the kernel driver part for kexec.

Hopefully someone can try to compile this and see what it can do, as my time is somewhat limited at the moment.

The address is here:
WinKexec

#2 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 12 March 2009 - 08:08 AM

Seems like interesting. :cheers:

Of course, (boy do I hate sometimes the otherwise good Linux guys :cheers: ) there isn't a single line of description/documentation. :cheers:

Maybe solemnwarning has the capabilities/interest in this? :cheers:

:cheers:

jaclaz

#3 mr_

mr_

    Frequent Member

  • Members
  • 355 posts
  •  
    Germany

Posted 12 March 2009 - 09:42 AM

Yeah, it would be pretty cool to start grub.exe directly from NT based Windows.

It's questionable how well this could work? Does NT based Windows mess with BIOS / hardware like some Linux drivers do? I mean, will there be the same hardware based issues like at Linux?

#4 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 12 March 2009 - 09:53 AM

It's questionable how well this could work?


YES, everything is questionable. :cheers:

Does NT based Windows mess with BIOS / hardware like some Linux drivers do?

YES, it does, though in almost, but not quite, completely unlike what Linux does.

I mean, will there be the same hardware based issues like at Linux?


YES or NO? :cheers: Who knows? :cheers:

Unless the app is compiled and tested, there is NO way to know.....:cheers:

jaclaz

#5 solemnwarning

solemnwarning

    Member

  • Members
  • 73 posts
  •  
    United Kingdom

Posted 12 March 2009 - 04:09 PM

Is this port actually going to support booting NT kernels, or only Linux ones?

#6 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 12 March 2009 - 08:34 PM

Is this port actually going to support booting NT kernels, or only Linux ones?


Well, I was expecting some answers from you :cheers:, not another question! :cheers:

All I can find (meaning all I can find that I am PARTIALLY capable to understand :cheers:) related to the OP "hints" is this thread:
http://www.mail-arch...s.infradead.org

jaclaz

#7 mr_

mr_

    Frequent Member

  • Members
  • 355 posts
  •  
    Germany

Posted 12 March 2009 - 09:42 PM

He writes like a nice guy, I think you can mail him directly with your inquire and get highly probable a nice and helpful answers.

#8 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1063 posts
  •  
    Belgium

Posted 19 April 2010 - 10:07 PM

WinKexec site:
https://www.jstump.c...ects/kexec/wiki

This are the available parameters for WinKexec (kexec.exe)
WinKexec: kexec for Windows (v1.0, svn revision 92)

Copyright (C) 2008-2009 John Stumpo



This program is free software; you may redistribute or modify it under the

terms of the GNU General Public License, version 3 or later.  There is

ABSOLUTELY NO WARRANTY, not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.  See the GPL version 3 for full details.



Usage: kexec [action] [options]...

Actions:

  /l /load	 Load a Linux kernel.

	The next option is the kernel filename.  All subsequent options are

	passed as the kernel command line.  If an initrd= option is given,

	the named file will be loaded as an initrd.  The kexec driver will

	be loaded automatically if it is not loaded.  With no options, just

	load the kexec driver without loading a kernel.

  /u /unload   Unload the kexec driver.  (Naturally, this causes it to

	forget the currently loaded kernel, if any, as well.)

  /c /clear	Clear the currently loaded Linux kernel, but leave the

	kexec driver loaded.

  /s /show	 Show current state of kexec.

  /h /? /help  Show this help.

I tried it in VirtualBox:
C:\> kexec.exe /l bzImage initrd=initrd.img
Startmenu ==> Press "Reboot" icon
WinKexec: Linux bootloader implemented as a Windows device driver

Copyright (C) 2008-2009 John Stumpo



This processor does not support PAE.

PAE support is requierd in order to use WinKexec.
So you seem to need PAE support.

Enabling the PAE/NX checkbox (Sytstem ==> Processor) in VirtualBox allows me to boot the linux kernel.

KexecGui.exe gives you a GUI interface for choosing the kernel, initrd and command line.

In the attachment you can find a compiled version (got it from somebody).

Attached Files



#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 20 April 2010 - 10:45 AM

Great news! :ranting2:

:ranting2:
Wonko

#10 slothman

slothman

    Member

  • Members
  • 38 posts
  •  
    United States

Posted 29 July 2010 - 05:15 AM

Well,

I officially tried winkexec today. I tried it once previously and it didn't work, but that was because I was just trying grub4dos. I thought for some reason, the video was not getting initialized properly, but it was still working.

I tried many different things and it always hangs right after it restarts. This is on a core2 duo running xp, which I know has PAE support.

So it looks like there are at least a few bugs to be worked out.

#11 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 27 November 2010 - 09:36 PM

I compiled John Stumpo's WinKexec on Ubuntu with MinGW32. I had to fight with MinGW's libhal.a a bit before linking succeeded, but I have documented it on WinKexec's mailing-list, if anyone cares. I used Windows XP Professional SP2 (the gold of XPs, IMHO).

I ran three tests (also documented on their mailing-list), and the one which worked best was booting GRUB4DOS' GRUB.EXE. I was able to do:

Windows -> WinKexec -> GRUB4DOS -> Windows

:)

I noticed a few things:
  • If whatever you boot from WinKexec tries to poll the keyboard, the system will freeze, so don't have any timeouts/choices in GRUB4DOS. I had to remove a timeout from BOOT.INI so it wouldn't check for the user using arrow keys, for example.
  • As slothman mentioned, at Windows reboot time (HalReturnToFirmware(), hooked by WinKexec), the video mode didn't switch unless I initiated the reboot from a Remote Desktop session! That is, I remoted into the system and used the WinKexec GUI to load GRUB4DOS and then rebooted from there. Otherwise, I would only see the Windows logon background at reboot time, though I suspect WinKexec was performing its activities invisibly. Something about the Remote Desktop session causes a video mode switch at reboot, which is what we want.
  • I tried to run MEMDISK with a Recovery Console image file (CMDCONS.HDD), but that 24 MB image caused a problem during WinKexec's pagesort_sort() function. I then did gzip -9 to the image file to reduce it significantly, and it did get further. I saw MEMDISK output, but the system hung right at the point where the HDD image file would be booted.

My next trial will be GRUB4DOS + CMDCONS.HDD. I guess I'll use something like:
--config-file="map (rd) (hd0); map --hook; root (hd0,0); chainloader /cmldr; boot"


#12 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 28 November 2010 - 10:14 AM

Some moderate success...

Both Windows XP Pro SP2 Recovery Console as well as Setup failed, and I suspect it is because, again, they check the keyboard for F6 (additional drivers) and F2 (automatic system recovery).

So I moved on to a MinWin.HDD which is 13,418,496 bytes (26,208 512-byte sectors), one NTFS partition, compression enabled for entire filesystem except for \NTLDR and \NTDETECT.COM, whose directory listing is:
F:\>dir /a /s

 Volume in drive F is MINWIN

 Volume Serial Number is 6C76-8758



 Directory of F:\



11/28/2010  04:40 AM			 1,308 boot.ini

08/04/2004  08:00 AM			47,564 NTDETECT.COM

05/13/2007  08:01 AM		   295,536 NTLDR

11/28/2010  03&#58;20 AM	<DIR>		  Windows

			   3 File&#40;s&#41;		344,408 bytes



 Directory of F&#58;\Windows



11/28/2010  03&#58;20 AM	<DIR>		  .

11/28/2010  03&#58;20 AM	<DIR>		  ..

11/28/2010  03&#58;20 AM	<DIR>		  Fonts

11/28/2010  03&#58;10 AM	<DIR>		  Inf

11/28/2010  04&#58;40 AM	<DIR>		  System32

			   0 File&#40;s&#41;			  0 bytes



 Directory of F&#58;\Windows\Fonts



11/28/2010  03&#58;20 AM	<DIR>		  .

11/28/2010  03&#58;20 AM	<DIR>		  ..

08/23/2001  07&#58;00 AM			 5,168 vgaoem.fon

			   1 File&#40;s&#41;		  5,168 bytes



 Directory of F&#58;\Windows\Inf



11/28/2010  03&#58;10 AM	<DIR>		  .

11/28/2010  03&#58;10 AM	<DIR>		  ..

08/03/2004  03&#58;05 PM			48,044 biosinfo.inf

			   1 File&#40;s&#41;		 48,044 bytes



 Directory of F&#58;\Windows\System32



11/28/2010  04&#58;40 AM	<DIR>		  .

11/28/2010  04&#58;40 AM	<DIR>		  ..

08/04/2004  06&#58;00 AM			12,288 bootvid.dll

11/28/2010  04&#58;53 AM	<DIR>		  Config

08/23/2001  07&#58;00 AM			66,082 c_1252.nls

08/23/2001  07&#58;00 AM			66,594 c_437.nls

08/23/2001  07&#58;00 AM			66,594 c_850.nls

11/28/2010  04&#58;33 AM	<DIR>		  Drivers

08/03/2004  10&#58;59 PM		   131,968 halaacpi.dll

08/03/2004  10&#58;59 PM			81,280 halacpi.dll

08/23/2001  07&#58;00 AM			 7,040 kdcom.dll

08/23/2001  07&#58;00 AM			 7,046 l_intl.nls

08/04/2004  06&#58;00 AM		   708,096 ntdll.dll

08/03/2004  11&#58;20 PM		 2,180,992 ntkrnlup.exe

02/07/2008  07&#58;45 PM			 7,353 SMSS.EXE

			  11 File&#40;s&#41;	  3,335,333 bytes



 Directory of F&#58;\Windows\System32\Config



11/28/2010  04&#58;53 AM	<DIR>		  .

11/28/2010  04&#58;53 AM	<DIR>		  ..

11/28/2010  04&#58;53 AM			 8,192 SOFTWARE

11/28/2010  03&#58;21 AM		 3,932,160 system

11/28/2010  03&#58;21 AM			 1,024 system.LOG

			   3 File&#40;s&#41;	  3,941,376 bytes



 Directory of F&#58;\Windows\System32\Drivers



11/28/2010  04&#58;33 AM	<DIR>		  .

11/28/2010  04&#58;33 AM	<DIR>		  ..

08/03/2004  04&#58;14 PM			49,664 classpnp.sys

08/03/2004  06&#58;05 PM			36,352 disk.sys

08/03/2004  04&#58;07 PM		   153,344 dmio.sys

08/23/2001  07&#58;00 AM			 5,888 dmload.sys

08/23/2001  07&#58;00 AM			 7,936 fs_rec.sys

08/23/2001  07&#58;00 AM		   125,056 ftdisk.sys

08/17/2001  01&#58;58 PM			35,840 isapnp.sys

08/04/2004  06&#58;00 AM			92,032 ksecdd.sys

08/04/2004  06&#58;00 AM		   574,592 ntfs.sys

08/23/2001  07&#58;00 AM			18,688 partmgr.sys

08/03/2004  11&#58;07 PM			68,224 pci.sys

08/03/2004  04&#58;00 PM			52,352 volsnap.sys

08/23/2001  07&#58;00 AM			 4,352 wmilib.sys

11/28/2010  03&#58;51 AM			44,032 wvblk32.sys

			  14 File&#40;s&#41;	  1,268,352 bytes



	 Total Files Listed&#58;

			  33 File&#40;s&#41;	  8,942,681 bytes

			  18 Dir&#40;s&#41;	   2,983,424 bytes free

I produced the SOFTWARE hive by creating a key named SOFTWARE just anywhere and then doing:
REG SAVE HKCU\foo\SOFTWARE SOFTWARE

move SOFTWARE f&#58;\windows\system32\config

I stole the SYSTEM hive from any Windows XP Pro SP2 system that had WinVBlock installed.

Anyway, my SMSS.EXE was replaced by a simple native-mode program which just prints a message every few seconds. I just wanted proof-of-concept. Unfortunately, I am still investigating why SMSS.EXE is crashing, but will probably figure it out at some point soon and report back.

The GRUB4DOS command-line I used for WinKexec was:
--config-file=&#34;map &#40;rd&#41; &#40;hd0&#41;; map --hook; root &#40;hd0,0&#41;; chainloader /ntldr&#34;

My BOOT.INI was:
&#91;boot loader&#93;

timeout=0

default=multi&#40;0&#41;disk&#40;0&#41;rdisk&#40;0&#41;partition&#40;1&#41;\WINDOWS



&#91;operating systems&#93;

multi&#40;0&#41;disk&#40;0&#41;rdisk&#40;0&#41;partition&#40;1&#41;\WINDOWS=&#34;UP HALACPI&#34; /noexecute=optin /fastdetect /sos /kernel=ntkrnlup.exe /hal=halacpi.dll /debug /debugport=com1 /baudrate=115200

But you would likely omit /DEBUG, /DEBUGPORT, /BAUDRATE switches.

#13 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 28 November 2010 - 10:26 AM

Sha0
If you don't provide the compiled thingy, WHAT sense has the

But you would likely ....

?
:)

I would NOT likely, since I have NOTHING to test. :)

:)
Wonko

#14 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 28 November 2010 - 10:48 AM

...provide the compiled thingy...

You could try Icecube's attachment up above.

#15 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 28 November 2010 - 10:59 AM

You could try Icecube's attachment up above.

...and will have ANYWAY different results from you, since you are using ANOTHER version.

Or did you suddenly become demented :D and fighted with MinGW and it's libhal.a only to get in the end a compiled version byte by byte IDENTICAL to the one Icecube posted? :D :D


:)
Wonko

#16 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 28 November 2010 - 05:07 PM

...and will have ... different results from you, since you are using ANOTHER version...

You can expect the same results. I would.

#17 grubstake

grubstake

    Member

  • Members
  • 30 posts
  •  
    United States

Posted 05 December 2010 - 02:42 AM

..... I used Windows XP Professional SP2 (the gold of XPs, IMHO).


Shao, I'd be very interested in knowing the basis for your opinion that sp2 is the 'gold' of XP, vs sp3.....if you would?

thanks! :worship:

#18 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 05 December 2010 - 06:19 PM

Shao, I'd be very interested in knowing the basis for your opinion that sp2 is the 'gold' of XP, vs sp3.....if you would?

It's simply that it's the minimum Windows with the enhanced Windows Firewall interface and without a giant vulnerability to Sasser. Please feel free to discard the opinion... There're obviously items in SP3 that some people need.

When SP3 started breaking systems which had Norton/Symantec products installed[1], you might understand my reluctance to move forward, and SP2 still does everything I need it to. :worship:

[1] FAQ: Upgrading to Windows XP Service Pack 3 or Windows Vista Service Pack 1 with your Norton 2008 product installed

#19 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 December 2010 - 07:39 PM

If I may, some "better" links than what the Symantec peeps state NOW:
http://www.msfn.org/...howtopic=118290
http://news.idg.no/c...19B3023FDD85185
http://www.computerw...l...T_AM&nlid=1

http://support.micro...kb/953979/en-us

At the time what the combination of the demented guys at MS and those at Symantec (I don't want to blame the ones or the others) managed to create was pure havoc. :worship:

:frusty:
Wonko

#20 grubstake

grubstake

    Member

  • Members
  • 30 posts
  •  
    United States

Posted 05 December 2010 - 09:47 PM

It's simply that it's the minimum Windows with the enhanced Windows Firewall interface and without a giant vulnerability to Sasser. Please feel free to discard the opinion... There're obviously items in SP3 that some people need.

When SP3 started breaking systems which had Norton/Symantec products installed[1], you might understand my reluctance to move forward, and SP2 still does everything I need it to. :worship:

[1] FAQ: Upgrading to Windows XP Service Pack 3 or Windows Vista Service Pack 1 with your Norton 2008 product installed


Thank you for replying Shao.

I have not used anything 'norton' since the DOS version of Norton Utilities, back in the Winnt3.31 days...I couldn't stand the Symantec versions.... :frusty: ....so perhaps that won't be an issue for me.

Understand that I am currently a win2k user, who has yet to install XP even once :smart: :smart: ....let alone Vista, or win7....but who is about to "make the big plunge" of giving up his years-stable win2k and update to XP.

So very modern of me to move to XP now, yes? :worship:

So anyway, all this time I'd planned to install/use XPsp3, thinking it was the most stable and bug-free....and thus why your statement caught my eye and interest.

-----

Wonko- thank you for links. :smart:

If sp3 is 'best' rev to use -except- for symantec issue, then it'll be good for me, as I don't use any symantec software.

---------

ps; system is T60p thinkpad....and I am minutes from posting to XP forum to ask some questions about doing install on ext. usb HD, then moving that drive inside the laptop....

thanks again to you both. :worship:

EDIT; Can I assume that the 'sasser' thing you mentioned has been been fixed in a hotfix that I'm likely to apply via, e.g., Ryan's 27mb hotfix-update 'pack' or other means? Or does sp3 still have glaring vulnerabilities?

thanks again

Edited by grubstake, 05 December 2010 - 09:51 PM.


#21 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 06 December 2010 - 03:58 AM

EDIT; Can I assume that the 'sasser' thing you mentioned has been been fixed in a hotfix that I'm likely to apply via, e.g., Ryan's 27mb hotfix-update 'pack' or other means? Or does sp3 still have glaring vulnerabilities?

The Sasser bug was fixed by SP2. Anything >= SP2 should be fine. :worship:

#22 grubstake

grubstake

    Member

  • Members
  • 30 posts
  •  
    United States

Posted 06 December 2010 - 04:11 AM

thank you Sha0 ! :worship:

#23 slothman

slothman

    Member

  • Members
  • 38 posts
  •  
    United States

Posted 07 December 2010 - 10:32 PM

Excellent work Sha0!

You proved me wrong about it not working. One day I'll have better diag tools to be able to see if its working even w/o video output.

It seems like unless you do that rdp login thing, the video and keyboard need to be re-initialized for it to be of any use. Maybe someone can test it with kexec-loader or something similar?

#24 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 07 December 2010 - 11:31 PM

... ... ...
It seems like unless you do that rdp login thing, the video and keyboard need to be re-initialized for it to be of any use. Maybe someone can test it with kexec-loader or something similar?

kexec-loader is a Linux distribution. John Stumpo of WinKexec has told me that his Linux tests have had keyboard failure, as well. Right now, it seems we are stuck booting a Windows, or possibly anything else that doesn't think about the keyboard.

I mentioned before that a tiny little Windows was BlueScreening; it was my own fault. I had copied the wrong file to replace SMSS.EXE. So I can honestly say that one can: Windows XP -> WinKexec -> GRUB4DOS -> tiny Windows XP RAM disk with WinVBlock. :worship:

As far as the Remote Desktop video mode switch thing, it might additionally require the /SOS switch in BOOT.INI. I always use that switch, so it slipped my mind to mention it. I haven't yet tested if it's really needed. Perhaps a service or shutdown script could switch the video mode, too...

#25 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 28 May 2012 - 12:38 PM

Great!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users