Issue
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?
Solution
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.
Answered By - Laurent Parenteau Answer Checked By - Candace Johnson (WPSolving Volunteer)