Page 1 of 3
How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 6:24 am
by zhiayang
Hi, again. So I've fixed all the problems in my kernel. So now I'm wondering, how on earth do you change the vbe mode or something?
I've googled so much, but nothing. I know there is a patch that makes grub actually use the vbe flag, but I can't find the 0.97 source anywhere. I know I should switch to real mode to change modes, but how would I do that?
Also, don't ask me to use GRUB 2; It is over-complicated. Unless of course, someone would be kind enough to provide me with a set of commands that actually make a bootable ISO file. (Qemu complains about no bootable media).
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 6:36 am
by gerryg400
I couldn't get Grub 0.97 to do VBE. I tried patching it and rebuilding it and even tried to debug it a little but in the end I gave up.
I wrote a small asm function that drops back to real mode and does an int10 then returns to protected mode and copies the data to a C buffer. I only use it in my loader before the OS is actually loaded to set a graphics mode.
There is a wiki article on how to switch to real mode but I didn't try that. It looks correct though
http://wiki.osdev.org/Real_mode#Switchi ... _Real_Mode
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 7:19 am
by turdus
requimrar wrote:I know I should switch to real mode to change modes, but how would I do that?
For example long->real (bios int)->long:
http://forum.osdev.org/viewtopic.php?f=1&t=23125
Learn to search. There are many examples for protmode too, also for creating iso files on the wiki.
Actualy I wonder how on earth could you write an OS, if creating an iso image is too complicated for you.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 7:35 am
by zhiayang
turdus wrote:
Actualy I wonder how on earth could you write an OS, if creating an iso image is too complicated for you.
I can make an iso image. I know how to read tutorials. BUT: All those grub2 isos I made refuse to boot anywhere.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 8:05 am
by Solar
requimrar wrote:I can make an iso image. [...] All those grub2 isos I made refuse to boot anywhere.
alias making="making successfully"
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 8:06 am
by zhiayang
Solar wrote:requimrar wrote:I can make an iso image. [...] All those grub2 isos I made refuse to boot anywhere.
alias making="making successfully"
... Okay then. Either way, I was just curious. Maybe when I get to that stage grub 2.0 will remove this lame crap.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 8:11 am
by Solar
I wouldn't hold my breath for the GRUB maintainers putting much of an effort into "fixing" VBE handling. GRUB is mainly a bootloader for mainstream operating systems, and those come with their own GFX driver architecture...
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 9:18 am
by rdos
You wouldn't want to use GRUB to change video-mode, simply because you want to be able run your OS without GRUB. GRUB is a bootloader, not a video-BIOS.
The easiest way to change video mode is while you are still in real-mode. Then you can just issue the appropriate calls and it would work unless the BIOS is broken. The best way is to be able to do it at any time, but that requires a pretty good V86 environment. That is not the first thing you want to do.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 1:11 pm
by neon
Not sure why GrUB doesn't support it... being able to tell the bootloader what video mode you want is defined by the multiboot standard. Does GrUB not implement proper support for it anymore?
In any case, I do agree with rdos - having the bootloader switch video modes creates a dependency between your OS and a specific boot loader and effectively makes it impossible to switch video modes later on. Options include real/v86 modes with VBE or Video BIOS, writing your own SVGA+ drivers, or writing a VGA-compliant driver.
Also, GUI != video driver or graphics API. You need both (of sorts) before being able to set up a GUI.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 3:24 pm
by VolTeK
requimrar wrote:I know I should switch to real mode to change modes, but how would I do that?
How in the hell did you get into protected mode then.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 24, 2012 5:47 pm
by quok
GhostXoPCorp wrote:requimrar wrote:I know I should switch to real mode to change modes, but how would I do that?
How in the hell did you get into protected mode then.
The OP didn't. Grub did it for him.
Re: How in the world do you set up a GUI??
Posted: Wed Jan 25, 2012 12:59 am
by rdos
quok wrote:GhostXoPCorp wrote:requimrar wrote:I know I should switch to real mode to change modes, but how would I do that?
How in the hell did you get into protected mode then.
The OP didn't. Grub did it for him.
Yeah, the downside of too powerful tools. You don't know how you ended up in protected mode, and you don't know how to exit protected mode, and may not even know what protected mode actually is since GRUB allows you to write your code in C.
Re: How in the world do you set up a GUI??
Posted: Wed Jan 25, 2012 1:15 am
by piranha
rdos wrote:
Yeah, the downside of too powerful tools. You don't know how you ended up in protected mode, and you don't know how to exit protected mode, and may not even know what protected mode actually is since GRUB allows you to write your code in C.
Read: I hate C. Everyone should code in assembly. *cough*theOPsignoranceastowhatprotectedmodeishasnothingtodowithhisusingC,butmoretodowithhislackofresearchandknowledge*cough*
Patching grub to switch modes for you isn't that difficult, I got it working pretty quickly. Other than that, if you're using bochs or Qemu you can write a really simple driver that allows you to switch modes...
All that said, if you don't know how to switch to and from protected mode you should focus on the basics before switching to graphics mode...
-JL
Re: How in the world do you set up a GUI??
Posted: Tue Jan 31, 2012 5:43 am
by Mano
Well, I was looking for an easy way to change the video mode.
On wiki there's a list of possible ways of doing it, and it's in order of dificulty. Because I'm using GRUB, interrupts won't do. So I decided to search how to patch Grub, and I've found a pre-built patched GRUB on
this topic.
I downloaded the stage2_eltorito, replaced it, and changed my menu.lst file. All I did was actually to add a line after the kernel command:
Where XXX is the hex value related to the mode you want. To find out which value to put, I just pressed C to enter grub's command line, and typed the command:
It worked for me at least. Anyway, I don't think this is really useful. I still think it's better to study and try to code my own vga driver.
Re: How in the world do you set up a GUI??
Posted: Tue Jan 31, 2012 9:40 am
by neon
Yeah, the downside of too powerful tools. You don't know how you ended up in protected mode, and you don't know how to exit protected mode, and may not even know what protected mode actually is since GRUB allows you to write your code in C.
That's not the fault of the software, its the programmer(s). Processor modes are very well documented in the specifications. By not understanding the architecture, the programmer is limited in understanding of the software.