Hello peeps.
Is there a way to hack GRUB2 so it sets wanted video mode only when you type custom command inside your shell?
[Answered] GRUB2 "Hacking"
[Answered] GRUB2 "Hacking"
Last edited by Octacone on Wed Aug 10, 2016 2:46 pm, edited 1 time in total.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: GRUB2 "Hacking"
I'm not a GRUB2 user, but AFAIK there is a command for that, "gfxmode" maybe. If you really want to extend GRUB's functionality you can a write a plugin.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
- Alan Kay
-
- Member
- Posts: 5571
- Joined: Mon Mar 25, 2013 7:01 pm
Re: GRUB2 "Hacking"
GRUB2 uses the firmware to change video modes. For the legacy BIOS case, you can mostly return the computer to the state it was in when the firmware loaded GRUB2 the first time. For the UEFI case, GRUB2 exits boot services when it loads your OS the first time, which means there's no firmware for it to use the second time around.
For the amount of effort that would take, you may as well reboot every time you want to change the video mode.
If you really want to change the video mode from within your OS, you should write a native driver. (Or, if you're truly masochistic, write a PCI option ROM interpreter and all of the necessary PCI-related driver infrastructure.)
For the amount of effort that would take, you may as well reboot every time you want to change the video mode.
If you really want to change the video mode from within your OS, you should write a native driver. (Or, if you're truly masochistic, write a PCI option ROM interpreter and all of the necessary PCI-related driver infrastructure.)
Re: GRUB2 "Hacking"
I don't use UEFI. I just want to know if I can force GRUB to switch from default text mode to high resolution mode after my kernel has loaded, when I want it.Octocontrabass wrote:GRUB2 uses the firmware to change video modes. For the legacy BIOS case, you can mostly return the computer to the state it was in when the firmware loaded GRUB2 the first time. For the UEFI case, GRUB2 exits boot services when it loads your OS the first time, which means there's no firmware for it to use the second time around.
For the amount of effort that would take, you may as well reboot every time you want to change the video mode.
If you really want to change the video mode from within your OS, you should write a native driver. (Or, if you're truly masochistic, write a PCI option ROM interpreter and all of the necessary PCI-related driver infrastructure.)
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
-
- Member
- Posts: 5571
- Joined: Mon Mar 25, 2013 7:01 pm
Re: GRUB2 "Hacking"
All new PCs have UEFI.
Once your kernel is loaded, GRUB is gone. If you want GRUB, you have to load it again, and GRUB will restart your kernel from the beginning.
Once your kernel is loaded, GRUB is gone. If you want GRUB, you have to load it again, and GRUB will restart your kernel from the beginning.
Re: GRUB2 "Hacking"
Okay, so I guess that writing native VBE driver is my best bet.Octocontrabass wrote:All new PCs have UEFI.
Once your kernel is loaded, GRUB is gone. If you want GRUB, you have to load it again, and GRUB will restart your kernel from the beginning.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: [Answered] GRUB2 "Hacking"
VBE is really only going to be available in 16-bit real mode, so a VBE driver is kind of a bad idea as well.octacone wrote:Okay, so I guess that writing native VBE driver is my best bet.
Your VBE driver would have to switch back to 16-bit mode, call the VBE interrupts, and then switch back to 32-bit mode. Alternately, you could write a virtual machine that runs 16-bit code in 32-bit mode, but this is probably overkill if you only want to be able to switch graphics modes.
Until you write your own native 32-bit video driver(s), your best bet is to just pick a graphics mode, and let GRUB do the switch for you at boot time.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott