Returning back to GRUB after booting

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kernel_journeyman

Returning back to GRUB after booting

Post by kernel_journeyman »

Instead of rebooting all the time, I would like to simply return to GRUB. Is this possible? I would need to preserve wherever GRUB is in memory, and I think it loads itself into 'lowmem', plus the video mode it uses, and its stack, and maybe the EFLAGS register too. Is that correct?

I think GRUB jumps to the kernel when it loads it, so there is nothing to "return" to as such. Otherwise I'd need to know a location in memory for the GRUB entry point at the menu, and jump back there to "return" to GRUB. This may need hacking on GRUB to work... or am I missing something?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Returning back to GRUB after booting

Post by Brendan »

Hi,
kernel_journeyman wrote: Instead of rebooting all the time, I would like to simply return to GRUB. Is this possible? I would need to preserve wherever GRUB is in memory, and I think it loads itself into 'lowmem', plus the video mode it uses, and its stack, and maybe the EFLAGS register too. Is that correct?

I think GRUB jumps to the kernel when it loads it, so there is nothing to "return" to as such. Otherwise I'd need to know a location in memory for the GRUB entry point at the menu, and jump back there to "return" to GRUB. This may need hacking on GRUB to work... or am I missing something?
I don't know much about GRUB, but I doubt it's possible to return to GRUB. Therefore you'd need to restart GRUB from it's start, but if you where going to do that it would be better to restart the BIOS's bootstrap (INT 0x19) instead. This would have a similar effect, but if the user boots GRUB from a floppy they'd be able to remove the floppy and the BIOS would boot from the hard drive...

This may be possible early in your OS's boot, but the more your OS (and GRUB) changes the more it will need to reset to what the BIOS expects.

If you'd rather hack GRUB to make it work, then making GRUB call your kernel (instead of jumping) might be an easier approach, as you wouldn't need to worry about where your entry point ends up each time CRUB is re-compiled. Of course hacking GRUB would make it incompatible with every else's version, and each time a better version of GRUB is released you'd need to re-hack it.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply