views:

51

answers:

1

Can I run some some custom code at the time when GRUB loads up? In other words does GRUB provide a facility to run some custom code before loading any operating system?

+2  A: 

Since GRUB support the Multiboot specification, yes you can. You would get your code loaded by GRUB, then you'll have to load the operating system yourself (which you could do by supporting the Multiboot specification yourself...). Depending on what you want to do, that may not be the easiest way to do it.

If you want to run some custom code before loading a linux-based operation system, creating a custom initramfs would be a lot easier.

Laurent Parenteau