Getting Back into Osdev
Getting Back into Osdev
Finally decided to get back into Osdev after a two year hiatus now that I have a lot more time on my hands. This time though, I am using Linux (gcc, etc) instead of Windows (visual studio) as my development environment. This resulted in changing all of the inline assembly in my kernel to the GCC AT&T format, not difficult but time consuming. The kernel now compiles. Haven't been able to run it yet though, because of boot problems. Originally, I was linking to a binary because my custom-built boot loader expects a PE and I'm no longer using Windows as a development environment. So I just made a slight modification to the boot loader to load a flat binary. Problem was it didn't work, and I figured out that it was due to 16-bit addressing restrictions, the kernel was coming out as a 90kB file... So I have spent the last few days unsuccessfully trying to get grub to work, but it won't recognize my multiboot header for whatever reason. I don't know why, it occupies the first 12 bytes of the file (now an ELF file) and contains everything it should have for GRUB legacy as far as I can tell. Then I realized that the ELF file was only 5kB! All I have to do is get my working boot loader to parse ELF files and its all good . No need to figure out grub and I am back to 100% my own software. Shouldn't be too difficult to program, my kernel already has a working ELF loader, I did it once, I can certainly do it again.
Jacob
Jacob
Re: Getting Back into Osdev
Welcome back!
What are you going to do if your kernel gets too big to load with your bootloader (due to 16-bit addressing restrictions)? That's one of my worries at the moment.
What are you going to do if your kernel gets too big to load with your bootloader (due to 16-bit addressing restrictions)? That's one of my worries at the moment.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Getting Back into Osdev
I have 64kB to play with and with the ELF format, I am only at 5kB and am getting to the point where other modules could be loaded separately after the kernel, by the kernel, all in protected mode.
Jacob
Jacob
Re: Getting Back into Osdev
Nice to hear that!
I am new here.
Even this wiki.)
I am new here.
Great! (VS is a decent IDE, for all sorts of things, but most osdeving sites assume that you're on a UNIX-like environment.This time though, I am using Linux (gcc, etc) instead of Windows (visual studio) as my development environment
Even this wiki.)
90KB? Wow. (Huge amount of strings? data? functionality?)the kernel was coming out as a 90kB file
Great! Congrats! (I am still struggling with binaries. )my kernel already has a working ELF loader
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64
64 bit Kernel in early development
http://github.com/nerdguy12/core64
Re: Getting Back into Osdev
Actually, it turned out that it was linking to 5kB because it was only linking the entry file (assembly file containing multiboot info and start point).
So I kept at it with Grub Legacy and finally got it working. The file is coming out at 70kB which is probably due to my inefficiencies when I first started working on this, not to mention there are a lot of files all containing a lot of debugging strings.
Next step is to fix up my ISRs. When using the Windows compiler, I just used naked functions. The plan is to use a common ISR in an assembly file which will call the intended handler using an ISR table. Shouldn't be too difficult, though I always tell myself that and well... it's osdev.
Then I can get back to remaking (3rd complete rewrite) my fat driver, then clean some things up, then upgrade my memory manager, then multitasking, then porting stuff, then self-hosting.
Jacob
So I kept at it with Grub Legacy and finally got it working. The file is coming out at 70kB which is probably due to my inefficiencies when I first started working on this, not to mention there are a lot of files all containing a lot of debugging strings.
Next step is to fix up my ISRs. When using the Windows compiler, I just used naked functions. The plan is to use a common ISR in an assembly file which will call the intended handler using an ISR table. Shouldn't be too difficult, though I always tell myself that and well... it's osdev.
Then I can get back to remaking (3rd complete rewrite) my fat driver, then clean some things up, then upgrade my memory manager, then multitasking, then porting stuff, then self-hosting.
Jacob
Re: Getting Back into Osdev
With my bootloader, I can load up to 400KiB in real mode... why is your limit 64KiB?Hoozim wrote:So I kept at it with Grub Legacy and finally got it working. The file is coming out at 70kB which is probably due to my inefficiencies when I first started working on this, not to mention there are a lot of files all containing a lot of debugging strings.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Getting Back into Osdev
Wow. Sounds like one day I could make your bootloader load a dos 3d game. (Take Quake 1, implement all the required int 0x21 calls and some other dos things, and make your bootloader load the game? How's that? Assuming the bootloader doesn't boot through a Floppy Disk (since quake is pretty huge) Could be nice for a holiday project)With my bootloader, I can load up to 400KiB in real mode... why is your limit 64KiB?
@OP : Are you in Real Mode or Protected Mode or Long Mode or Virtual 8086 Mode or Unreal Mode?
Seeing that you're using GCC, it seems you're either in PMode or Long Mode.
Why that 64KB Limit?
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64
64 bit Kernel in early development
http://github.com/nerdguy12/core64
Re: Getting Back into Osdev
Sorry for the late reply, been very busy. The reason for the 64kB limit has to do with the way my boot loader handles 16-bit segmentation. I could probably change it fairly easily but I have GRUB working beautifully and with limited time for this, I would much rather spend it on my kernel and userland software. I am getting fairly close to being able to port software over to it .
Jacob
Jacob
Re: Getting Back into Osdev
If I get you right, you load the kernel in Real Mode in a segment and then copy it over to the 1MB Mark (Or whatever) using
a rep movsd. I used that method for my 32 bit Kernel.
a rep movsd. I used that method for my 32 bit Kernel.
I would want to see GCC one day running on it.port software over to it
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64
64 bit Kernel in early development
http://github.com/nerdguy12/core64
Re: Getting Back into Osdev
That's exactly what I do, I load it in real mode. Switch to protected mode and copy it all over the 1mB mark. I can't wait to get GCC running on it!
Jacob
Jacob