Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to reboot really fast?: (4 Items)
   
How to reboot really fast?  
First, some details on my development environment.  I'm working with a small embedded system with a minimal QNX install.
  Its an x86 board with PC BIOS booting.  The boot device is a compact flash card with the QNX 4 format.  I'm developing
 under QNX 6.5.0.  Since this system is small, I've packaged the whole system, including our software, into a single IFS
 image file.

When we need to do a software update, our code does the following:

1. When the operator request it, we copy the selected file from a USB drive to /.altboot, which is normally zero length.
  We check the file for the boot signature to insure we are loading a QNX image.

2. The system calls shutdown_system:
	shutdown_system(SHUTDOWN_REBOOT, FLAG_FAST);

3. The system reboots.  Our custom IPL, ipl-diskpc2, sees that /.altboot is non-zero length, and loads it.  Otherwise it
 would load /.boot

4. Our system starts and sees that /.altboot is non-zero length.  This means that a update is in progress.  It copies 
the contents of /.altboot to /.boot, and then truncates /.altboot to zero length.  It performs some other cleanup and 
the update is complete.

This process works well except for shutdown_system.  This process takes almost 30 seconds.  We need to be faster than 
this.  I tried to trick the system by performing an indirect call to 0xFFFFFFF0, but this just caused a segmentation 
fault.  Is there a way to force a fast reboot through software, the functional equivalent of pressing the reset button 
or cycling power?
RE: How to reboot really fast?  
If you just want to pull the rug out from under the system, you want
sysmgr_reboot().  This just invokes the reboot callout, which gives you
the same effect as hitting the reset line.

> -----Original Message-----
> From: Robert Murrell [mailto:community-noreply@qnx.com]
> Sent: August-12-11 8:53 AM
> To: ostech-core_os
> Subject: How to reboot really fast?
> 
> First, some details on my development environment.  I'm working with a
> small embedded system with a minimal QNX install.  Its an x86 board
> with PC BIOS booting.  The boot device is a compact flash card with
the
> QNX 4 format.  I'm developing under QNX 6.5.0.  Since this system is
> small, I've packaged the whole system, including our software, into a
> single IFS image file.
> 
> When we need to do a software update, our code does the following:
> 
> 1. When the operator request it, we copy the selected file from a USB
> drive to /.altboot, which is normally zero length.  We check the file
> for the boot signature to insure we are loading a QNX image.
> 
> 2. The system calls shutdown_system:
> 	shutdown_system(SHUTDOWN_REBOOT, FLAG_FAST);
> 
> 3. The system reboots.  Our custom IPL, ipl-diskpc2, sees that
> /.altboot is non-zero length, and loads it.  Otherwise it would load
> /.boot
> 
> 4. Our system starts and sees that /.altboot is non-zero length.  This
> means that a update is in progress.  It copies the contents of
> /.altboot to /.boot, and then truncates /.altboot to zero length.  It
> performs some other cleanup and the update is complete.
> 
> This process works well except for shutdown_system.  This process
takes
> almost 30 seconds.  We need to be faster than this.  I tried to trick
> the system by performing an indirect call to 0xFFFFFFF0, but this just
> caused a segmentation fault.  Is there a way to force a fast reboot
> through software, the functional equivalent of pressing the reset
> button or cycling power?
> 
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post88060
Re: RE: How to reboot really fast?  
Thank you.  This is exactly what I was looking for.
Re: RE: How to reboot really fast?  
Another fast reboot method. It is not very friendly to the file system. It solves known shutdown problems on some x86 
boards under QNX 6.5.0.


#define KBD_CTRL_IO 0x64

int
main( void )
{
	uintptr_t hndl;

	if (ThreadCtl (_NTO_TCTL_IO, 0) != -1)
	{
		if ( (hndl = mmap_device_io(2, KBD_CTRL_IO)) != MAP_DEVICE_FAILED)
		{
			/* disable interrupts when accesing hardware 		*/
			/* write to the keyboard port system reset command 	*/
			asm("cli");			
			out8(KBD_CTRL_IO, 0xfe); 

			//  should not get here 
			exit (EXIT_SUCCESS);
		}
	}

	exit(EXIT_FAILURE);
}