Hi,
I'm using GRUB to boot my os and it works perfect. The best thing is that I'm already in PMODE.
I've heard that GRUB is able to setup a video mode before booting an OS. So do you know how to do this? Would be very nice THX!
Grub Bootloader and video modes
Re: Grub Bootloader and video modes
Hi,
More specifically, you'd set bit 2 in the flags field of the Multiboot Header, then set "desired" values in the graphics fields of the Multiboot Header. Then, after GRUB (or any other "Multiboot compliant" boot loader) starts your OS you'd check the VBE fields in the Multiboot Information Structure to figure out details for the video mode that was set.
The problem is that your OS has no real control over what sort of video mode the boot loader will select, and because of this your OS would need to handle all possible video modes. This includes text modes, modes with messed up pixel formats (e.g. BGR instead of RGB), modes with 24 bits per pixel, etc.
If you don't want your OS to support every messed up video mode ever invented, then a better way may be to switch back to real mode, use the video ROM's functions yourself to select a "good" mode that your OS does support, and then switch back to protected mode....
It'd also be good idea to collect a list of video modes that could have been used, so that while the user is using your OS they could select a different video mode from the list (e.g. right click on the desktop and choose it from a "video properties" dialog box) , so that the video mode the user selected is set the next time the OS boots. This isn't as good as allowing the user to change video modes without rebooting (but allowing the user to change video modes without rebooting can be a huge problem, depending on your OS design and if you use long mode or not).
Cheers,
Brendan
Switching to protected mode takes about 30 bytes (which is mostly data) - it's not a huge bonus IMHO....sevobal wrote:I'm using GRUB to boot my os and it works perfect. The best thing is that I'm already in PMODE.
I've never tried it, and AFAIK you need a special version of GRUB that actually supports it, but the information on how to do it is in the Multiboot Specification.sevobal wrote:I've heard that GRUB is able to setup a video mode before booting an OS. So do you know how to do this? Would be very nice THX!
More specifically, you'd set bit 2 in the flags field of the Multiboot Header, then set "desired" values in the graphics fields of the Multiboot Header. Then, after GRUB (or any other "Multiboot compliant" boot loader) starts your OS you'd check the VBE fields in the Multiboot Information Structure to figure out details for the video mode that was set.
The problem is that your OS has no real control over what sort of video mode the boot loader will select, and because of this your OS would need to handle all possible video modes. This includes text modes, modes with messed up pixel formats (e.g. BGR instead of RGB), modes with 24 bits per pixel, etc.
If you don't want your OS to support every messed up video mode ever invented, then a better way may be to switch back to real mode, use the video ROM's functions yourself to select a "good" mode that your OS does support, and then switch back to protected mode....
It'd also be good idea to collect a list of video modes that could have been used, so that while the user is using your OS they could select a different video mode from the list (e.g. right click on the desktop and choose it from a "video properties" dialog box) , so that the video mode the user selected is set the next time the OS boots. This isn't as good as allowing the user to change video modes without rebooting (but allowing the user to change video modes without rebooting can be a huge problem, depending on your OS design and if you use long mode or not).
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.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Grub Bootloader and video modes
Using your own video switcher is more reliable, and the GRUB way has no method of remembering user settings (so you'll have an unchangeable desktop resolution - not a good idea).sevobal wrote:Hi,
I'm using GRUB to boot my os and it works perfect. The best thing is that I'm already in PMODE.
I've heard that GRUB is able to setup a video mode before booting an OS. So do you know how to do this? Would be very nice THX!