Page 3 of 7
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:28 am
by Octacone
Good news:
Grub can finally make an iso of my OS
QEMU can boot that iso and even recognizes grub
Bad news:
Getting error you need to load the kernel first.
I really don't understand since my linker and kernel.c and kernel.asm are all compiled and connected
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:29 am
by DeezRamChips
Oh, I see !!!!!!
You forgot the boot instruction xDDDD
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:31 am
by DeezRamChips
try this:
Code: Select all
menuentry "BasicOS" {
multiboot /kernel.bin
boot
}
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:33 am
by Octacone
DeezRamChips wrote:try this:
Code: Select all
menuentry "BasicOS" {
multiboot /kernel.bin
boot
}
I already have that
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:36 am
by DeezRamChips
You said you had
Code: Select all
echo set default=0 >> iso/boot/grub/grub.cfg
echo set timeout=0 >> iso/boot/grub/grub.cfg
echo menuentry "BasicOS" { >> iso/boot/grub/grub.cfg
echo set root='(hd96)' >> iso/boot/grub/grub.cfg
echo multiboot /boot/kernel.bin >> iso/boot/grub/grub.cfg
echo } >> iso/boot/grub/grub.cfg
Where is the boot instruction ?
it should be:
Code: Select all
echo set default=0 >> iso/boot/grub/grub.cfg
echo set timeout=0 >> iso/boot/grub/grub.cfg
echo menuentry "BasicOS" { >> iso/boot/grub/grub.cfg
echo multiboot /boot/kernel.bin >> iso/boot/grub/grub.cfg
echo boot >> iso/boot/grub/grub.cfg
echo } >> iso/boot/grub/grub.cfg
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:36 am
by Octacone
When I make my iso file from make file and then try to run it, it does not work, qemu says no bootable media
When I use terminal to make my iso and to start qemu it boots, but with error you need to load the kernel first
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:38 am
by DeezRamChips
Could you give me a .zip file with all your os (your work directory)
I'll try to see what's wrong
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:47 am
by Octacone
Yes!
Fixed my makefile!
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:47 am
by DeezRamChips
It's working ?
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:48 am
by DeezRamChips
How did you get it to work ?
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:49 am
by Octacone
DeezRamChips wrote:How did you get it to work ?
I just made another variable that servers as boot.iso location for qemu.
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:51 am
by DeezRamChips
Weel greate !
Also, here is the working version of the VESA driver (fixed for all resolutions ^_^)
vesa.h
Code: Select all
#ifndef __VESA_H__
#define __VESA_H__
#include <types.h>
extern void init(long addr, int pitch, int width, int height, char bpp, int xres, int yres);
extern void putPixel(int x, int y, int r, int g, int b);
#endif
vesa.c
Code: Select all
#include <vesa.h>
#include <types.h>
#include <io.h>
long fb_addr;
int fb_pitch;
int fb_width;
int fb_height;
char fb_bpp;
int fb_xres;
int fb_yres;
char* vram = (char*)0xB8000;
void init(long addr, int pitch, int width, int height, char bpp, int xres, int yres){
vram = (char*)addr;
fb_pitch = pitch;
fb_width = width;
fb_height = height;
fb_bpp = bpp;
fb_xres = xres;
fb_yres = yres;
}
void putPixel(int x, int y, int r, int g, int b){
unsigned where = x*(fb_width/fb_xres) + y*fb_width;
vram[where + 0] = b; // BLUE
vram[where + 1] = g; // GREEN
vram[where + 2] = r; // RED
vram[where + 3] = 0xFF; // ALPHA
}
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 9:57 am
by Octacone
DeezRamChips wrote:Weel greate !
Also, here is the working version of the VESA driver (fixed for all resolutions ^_^)
vesa.h
Code: Select all
#ifndef __VESA_H__
#define __VESA_H__
#include <types.h>
extern void init(long addr, int pitch, int width, int height, char bpp, int xres, int yres);
extern void putPixel(int x, int y, int r, int g, int b);
#endif
vesa.c
Code: Select all
#include <vesa.h>
#include <types.h>
#include <io.h>
long fb_addr;
int fb_pitch;
int fb_width;
int fb_height;
char fb_bpp;
int fb_xres;
int fb_yres;
char* vram = (char*)0xB8000;
void init(long addr, int pitch, int width, int height, char bpp, int xres, int yres){
vram = (char*)addr;
fb_pitch = pitch;
fb_width = width;
fb_height = height;
fb_bpp = bpp;
fb_xres = xres;
fb_yres = yres;
}
void putPixel(int x, int y, int r, int g, int b){
unsigned where = x*(fb_width/fb_xres) + y*fb_width;
vram[where + 0] = b; // BLUE
vram[where + 1] = g; // GREEN
vram[where + 2] = r; // RED
vram[where + 3] = 0xFF; // ALPHA
}
I am fine with that, I already have my own way to drawing to the screen and making shapes etc.
One of the main problems is my makefile, let me tweak it a bit. I doesn't work again.

Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 10:01 am
by DeezRamChips
I hate makefile, I prefer using scipts
Re: Setting VESA/VBE Mode
Posted: Fri Jul 15, 2016 10:07 am
by Octacone
And finally I fixed my makefile, this time for real.
So this is my problem: