Wow, I do not have grub.cfg file. That is really weird, my grub does not want to create an iso image for my OS.DeezRamChips wrote:And add that to your grub.cfg file:DeezRamChips wrote:Exaclty the same problem !thehardcoreOS wrote:Update:
I downloaded and included multiboot header file.
kernel_main(multiboot_info_t *mbit)
{
...
}
Now how do I set mbit.width and mbit.height mbi.mod_type mbi.depth?
I can not do that directly because compiler throws errors.
Is there any special assembly related code I need to do before that?
Update 2: I just discovered that you can set multiboot flags inside assembly and that they co-respond with those declared inside my C file.
Since I am using NASM I can not use stuff like .long and .set and I need to use equ and dd but I can not compiler that.
Update 3: I set all the flags for my graphics mode and trust me nothing happens:Code: Select all
section .text align 4 dd MAGIC dd FLAGS dd CHECKSUM dd 0 dd 0 dd 0 dd 0 dd 0 dd 0 dd 1360 dd 768 dd 32
i'm sure you use grub legacy do you ?
You need grub 2 or a patched version of grub legacyCode: Select all
insmod vbe insmod vga
[Closed] Setting VESA/VBE Mode
Re: Setting VESA/VBE Mode
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
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
So, here is how you do:
Step 1:
Create a Directory names "iso"
Step 2:
Put your compiled kernel in this directory
Step 3:
in this directory (iso) create a sub directory called "boot" and in that directory (boot) create a sub directory called "grub"
You should now have something like:
Step 4:
in the directory iso/boot/grub , create a file called grub.cfg and write this in it:
Step 5:
In the terminal type:
Here you go ^_^
Step 1:
Create a Directory names "iso"
Step 2:
Put your compiled kernel in this directory
Step 3:
in this directory (iso) create a sub directory called "boot" and in that directory (boot) create a sub directory called "grub"
You should now have something like:
Code: Select all
iso/boot
iso/boot/grub
iso/kernel.bin
in the directory iso/boot/grub , create a file called grub.cfg and write this in it:
Code: Select all
set default=0
set timeout=0
insmod vbe
insmod vga
menuentry "nameOfYourOs" {
multiboot /yourKernel.bin
boot
}
In the terminal type:
Code: Select all
sudo grub-mkrescue --output=boot.iso iso
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
And here is how you plot a pixel: (it's the vesa driver I just wrote )
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;
char* vram = (char*)0xB8000;
void init(long addr, int pitch, int width, int height, char bpp){
vram = (char*)addr;
fb_pitch = pitch;
fb_width = width;
fb_height = height;
fb_bpp = bpp;
}
void putPixel(int x, int y, int r, int g, int b){
unsigned where = x*pitch + y*fb_width;
vram[where + 0] = b; // BLUE
vram[where + 1] = g; // GREEN
vram[where + 2] = r; // RED
vram[where + 3] = 0xFF; // ALPHA
}
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
Wowowow there is and error in the vesa drive, let me correct it
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Re: Setting VESA/VBE Mode
Interesting, I've already had a setup like this. Now I added those two commands to grub.cfg and nothing, my .iso does not get created for some reason. What do you use for your emulator. I use qemu-system-i386 with -vga std flag and then I just get no bootable media can't boot from cd floppy hdd etc, but when I use -kernel it works but only kernel shell without any graphics mode.DeezRamChips wrote:So, here is how you do:
Step 1:
Create a Directory names "iso"
Step 2:
Put your compiled kernel in this directory
Step 3:
in this directory (iso) create a sub directory called "boot" and in that directory (boot) create a sub directory called "grub"
You should now have something like:Step 4:Code: Select all
iso/boot iso/boot/grub iso/kernel.bin
in the directory iso/boot/grub , create a file called grub.cfg and write this in it:Step 5:Code: Select all
set default=0 set timeout=0 insmod vbe insmod vga menuentry "nameOfYourOs" { multiboot /yourKernel.bin boot }
In the terminal type:Here you go ^_^Code: Select all
sudo grub-mkrescue --output=boot.iso iso
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
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
Yes, qemu does not work with grub for some reason, i'm using Oracle Virtual Box 4.1
EDIT: No, it works fine now lol, You CAN use qemu
EDIT: No, it works fine now lol, You CAN use qemu
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Re: Setting VESA/VBE Mode
What flags do you use (for qemu)?DeezRamChips wrote:Yes, qemu does not work with grub for some reason, i'm using Oracle Virtual Box 4.1
EDIT: No, it works fine now lol, You CAN use qemu
Can you show me a screenshot of your working GUI?
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
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
I dont have a working gui yet, but I plot pixels at the right place.
and, here is the qemu command:
and, here is the qemu command:
Code: Select all
qemu boot.iso -vga std
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
Could you try the the grub command with my iso directory, it's in an attachement
- Attachments
-
- iso.zip
- (2.5 KiB) Downloaded 83 times
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Re: Setting VESA/VBE Mode
I will try to boot that file, but first I need to make an iso from it using grbu.DeezRamChips wrote:Could you try the the grub command with my iso directory, it's in an attachement
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
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
well, it's in the iso.zip file (I gave you my "iso" directory).
have you installed grub 2 or grub legacy
try:
have you installed grub 2 or grub legacy
try:
Code: Select all
sudo apt-get install grub2
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Re: Setting VESA/VBE Mode
Looks like I was using grub legacy....DeezRamChips wrote:well, it's in the iso.zip file (I gave you my "iso" directory).
have you installed grub 2 or grub legacy
try:Code: Select all
sudo apt-get install grub2
I started connection the peaces together.
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: Setting VESA/VBE Mode
Okay:
1.Grub2 is installed
2.I have a folder inside my osdev one called iso insde it I have folder called boot inside boot I have grub.cfg and my os compiles into an image called kernel.bin that is located inside iso folder and that qemu uses to boot from
3.When I boot that kernel.bin with qemu without -kernel flag I get no boot media and stuff like that = can not boot anything
4.My grub still does not want to make .iso file
5.Looks like there is more into it then I thought
1.Grub2 is installed
2.I have a folder inside my osdev one called iso insde it I have folder called boot inside boot I have grub.cfg and my os compiles into an image called kernel.bin that is located inside iso folder and that qemu uses to boot from
3.When I boot that kernel.bin with qemu without -kernel flag I get no boot media and stuff like that = can not boot anything
4.My grub still does not want to make .iso file
5.Looks like there is more into it then I thought
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: Setting VESA/VBE Mode
Code: Select all
Here is my makefile:
COMPILER = gcc
LINKER = ld
ASSEMBLER = nasm
CFLAGS = -m32 -c -ffreestanding -O2 -Wall -Wextra -std=gnu99
ASFLAGS = -f elf32
LDFLAGS = -m elf_i386 -T src/link.ld
EMULATOR = qemu-system-i386
EMULATOR_FLAGS = -vga std
OBJS = not important
OUTPUT = iso/kernel.bin
run: all
$(EMULATOR) $(EMULATOR_FLAGS) $(OUTPUT)
all:$(OBJS)
mkdir iso/ -p
mkdir iso/boot/ -p
$(LINKER) $(LDFLAGS) -o $(OUTPUT) $(OBJS)
obj/etc.o:src/etc.asm
$(ASSEMBLER) $(ASFLAGS) -o obj/etc.o src/kernel.etc my way of compiling etc does not matter for this case cause it works
build:all
rm iso/boot/grub/ -r -f
mkdir iso/boot/grub/
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
grub-mkrescue -o BasicOS.iso iso/
clear:
rm -f obj/*.o
rm -r -f iso/
iso/boot/grub/grub.cfg
iso/kernel.bin //this is where my os gets compiled
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
- DeezRamChips
- Member
- Posts: 132
- Joined: Fri Apr 08, 2016 5:03 am
- Location: atapio.cpp - why won't you work :(
- Contact:
Re: Setting VESA/VBE Mode
do you want that I upload my os so you can try to compile it ?(the build.sh also creates the iso)
If my os compiles, I means you have an error of some sort :/
If my os compiles, I means you have an error of some sort :/
My github page: https://github.com/AlexandreRouma
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT
Meme-deving since 420 Bc !
YouTube: https://www.youtube.com/channel/UCyJnOD ... C8Y7pccc6A
Twitter: https://twitter.com/WhatsTheGeekYT