flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Bootloader

Goto page 1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
I need an FAT12 bootloader, but I am too lazy to make one. I want to get started on the kernel.

I need a bootloader that loads the kernel into memory, enters protected mode, and jumps to the kernel. It would be nice if the bootloader displayed loading and error messages too, but if this is not possible it's OK. I saw the example bootloader in the examples section of the main FASM website, but it is a real mode bootloader. I would like a bootloader which sets up a GDT and enables protection, not necessarily bothering with A20 or anything (although it would be nice). My kernel won't be larger than 1M. If anyone has a free open source bootloader I can use, preferably written in FASM, I would appreciate it.

My kernel will not be >1M, it will only expect to be in protected mode RING-0 (from where it can enable A20, and modify the GDT to what it needs). I don't need paging or anything yet. Just an FAT12 bootloader (for a floppy) that enters protected mode. Thanks!

_________________
FASM Rules!
OS Dev is fun!
Pepsi tastes nasty!
Some ants toot!
It's over!
Post 08 Aug 2005, 22:06
View user's profile Send private message AIM Address Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
THEWizardGenius wrote:
I need an FAT12 bootloader, but I am too lazy to make one. I want to get started on the kernel.


Well, that's nice, I need an OS. It has to have a nice GUI with all the pictures and icons and it has to support FAT12, FAT16, FAT32, NTFS, ext/2, ext/3, ReiserFS and anything else you know, too. MultiTasking and Paging are required, multiuserability would be nice. It has to be written in FASM.

Fact: You'll have to code on your own. There's no "but I am too lazy". OS-Dev isn't putting some parts together and make something nice out of it.
Post 09 Aug 2005, 09:59
View user's profile Send private message Visit poster's website Reply with quote
Night Rider



Joined: 28 Jul 2005
Posts: 72
Night Rider
Yeah, O/S developement is not for lazy people!
Post 09 Aug 2005, 10:51
View user's profile Send private message ICQ Number Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Night Rider wrote:
Yeah, O/S developement is not for lazy people!


I would imagine bogdan would argue this one...his tagline says something to the effect: "Ambition is just a lame excuse for the ones not brave enough to be lazy."

But alas, he does code it just takes him longer than others...Wink
Post 09 Aug 2005, 11:47
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
I am called lazy by my family, you go to work, come home and sit at your PC all night, so making a OS is for lazy people Wink.

PS: You can use "Dex4u" for a boot loader as it does all those things and much much more, if theres enough interest i may make a special version Cool.

May be something like this http://www.dex4u.com/cdpod.PNG
With boot options etc.
Post 09 Aug 2005, 12:36
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Well, isn't that special! Very Happy

Sorry, had to do it, seemed appropriate.

Seriously, you could certainly use Dex4u as a boot loader. It get's you into 32-bit protected mode. You'd have to compile in Dex4u format unless Dex intends on making a special version for strict flat file OS...
Post 09 Aug 2005, 14:03
View user's profile Send private message Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
What I mean is, since the bootloader isn't the most important part, and since many people have already written the exact thing I need, why should I reinvent the wheel? I am sure there are 10,000,000,000,000,000,000,000,000,000 FAT12 bootloaders on the net, probably half of which do protected mode, and an eighth of which print a loading message. So why should I write my own? I didn't mean I'm lazy (Lazy People Shouldn't Write Kernel's Cool ) I just said I don't want to write something so trifling that many people have already written it! Thanks to bubach at the Mega-Tokyo forum, I have what I want Smile

_________________
FASM Rules!
OS Dev is fun!
Pepsi tastes nasty!
Some ants toot!
It's over!
Post 09 Aug 2005, 17:22
View user's profile Send private message AIM Address Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
Well, writing an own bootloader is one step for the OS. I bet there are 10,000,000,000,000,000,000,000,000,000 kernels on the net. Why don't you take one? Wink The bootloader is one step. And you'll never find exactly what you want to. I bet in the end you rewrite it, too.
Post 09 Aug 2005, 21:12
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
Because bootloaders are complex and difficult to make. Reinventing the wheel is useless, and I'd probably end up with lousy code, if it even worked. Besides, read this: http://my.execpc.com/CE/AC/geezer/osd/boot/index.htm

Quote:

Some advice on writing your own bootloader
Don't do it. At least, don't make the bootloader the first thing you work on. Reasons:
-A bootloader is not an OS.
-A bootloader is a VERY SMALL part of an OS.
-Writing a GOOD bootloader is as much work as writing a small OS (e.g. GRUB).
-Writing a robust and flexible bootloader is difficult. (Writing a crappy and inflexible bootloader is distressingly easy.)
-Writing a bootloader requires a lot of arcane knowledge (e.g. unreal mode, A20 gate, BIOS bugs and subtleties) that is otherwise useless.
-Bootloaders are very difficult to test and debug.
-Because of the hybrid 16- and 32-bit nature of x86 CPUs, x86 boot code is ugly.
-If booting your kernel fails, you won't know if the error is in your kernel or in your bootloader.

He goes on to recommend GRUB, which I DON'T want to use because it seems too complex for me to understand or figure out how to use. I don't want to re-invent the wheel, and (having unsuccessfully tried writing a bootloader before I read this) I know how difficult writing something that complex is to write. Sure, the kernel will be difficult, but it will be worth it, and I won't be reinventing the wheel as it will be my own, and I won't have a limit of 510 bytes!

Anyways, I have exactly what I needed, without writing my own, so I don't have to reinvent the wheel. And I shouldn't have to! I may modify it slightly, but rewriting it completely would be stupid.
Post 09 Aug 2005, 22:29
View user's profile Send private message AIM Address Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
look at examples page for fat12 bootloader..
Post 10 Aug 2005, 00:31
View user's profile Send private message Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
I know about that one, but I want protected mode. Once again, I have one now so this thread can be locked or whatever...

If it's helpful, here it is (displays loading message and error message if an error occurs, loads KERNEL.SYS and enters protected mode) Bubach said it's public domain (you'll want to modify the loading and error messages, etc., but other than that it's pretty good).


Description:
Download
Filename: BOS_boot.asm
Filesize: 13.61 KB
Downloaded: 307 Time(s)


_________________
FASM Rules!
OS Dev is fun!
Pepsi tastes nasty!
Some ants toot!
It's over!
Post 10 Aug 2005, 02:14
View user's profile Send private message AIM Address Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
THEWizardGenius wrote:
Because bootloaders are complex and difficult to make.

do you think that writing a OS is simple and easy?
i have been programing a OS for many years, and some boot loaders
for this OS, i just need a day of work to make a new boot loader.
But none of my boot loaders enters PMODE.
Quote:

-Writing a GOOD bootloader is as much work as writing a small OS (e.g. GRUB).

completely false.
Quote:

-Writing a bootloader requires a lot of arcane knowledge

The guy who whants to write a OS must have all this arcane knowledge.
Quote:

-Because of the hybrid 16- and 32-bit nature of x86 CPUs, x86 boot code is ugly.

Perhaps is true for C programmers ,but not a problem at all for assembly
programmers.

Dex4u wrote:

I am called lazy by my family, you go to work, come home and sit at your PC all night

That is not lazy ,it is insane, is very important to sleep some hours Smile
I´m a temporally worker, i work some months, and program the rest of the year.
Post 10 Aug 2005, 07:44
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
hi!
i just tried to simply compile attached BOS_boot.asm with fasm 1.64 and got error here:

Code:
;----------------------------------------;
; start of 32-bit area.                  ;
;     flush segments and jump to kernel  ;
;----------------------------------------;
use32
flush:
          mov     eax, 0x10
          [b]mov     ds, eax[/b]
          mov     es, eax
          mov     fs, eax    


Code:
flat assembler  version 1.64
C:\projects\BOS_boot\BOS_boot.asm [341]:
          mov     ds, eax
error: invalid size of operand.
    
Post 10 Aug 2005, 09:08
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Change the eax's to ax's and you should be happy as a lark.
Post 10 Aug 2005, 11:33
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
yes, now ok (i just thought it is a tested code Very Happy ) but happy not so much: qemu is crashing on it Smile
Post 10 Aug 2005, 12:34
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
Quote:

Change the eax's to ax's and you should be happy as a lark.

Sorry, I forgot to mention that. I had the same problem Wink

It works fine in Bochs, I don't know about QEmu, and it also works on a physical PC (you may have to reboot a couple times on an older PC)
Post 10 Aug 2005, 17:22
View user's profile Send private message AIM Address Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
do not worry about me - you possible put this sector to disk with fat and kernel, but i,ve just padded it with zeroes to valid 1.44 size. i'll tell you a secret: i made a converter of sources to projects, and now to test it i'm converting everything i see, even do not look inside well Very Happy

regards!
Post 10 Aug 2005, 17:50
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
Can I have your converter? It might be useful...
Post 10 Aug 2005, 17:52
View user's profile Send private message AIM Address Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
it will be usefull if you will use winasm studio. this converter to winasm projects: i compile and run QEMU (you can BOSH etc) with just couple key pressing Smile i will not advertise it here more: look there http://www.winasm.net/forum/, look there for wafasm and inp2 Wink

regards!
Post 10 Aug 2005, 18:25
View user's profile Send private message Visit poster's website Reply with quote
Night Rider



Joined: 28 Jul 2005
Posts: 72
Night Rider
"What I mean is, since the bootloader isn't the most important part"
What??? Sorry, but that is not truth! You can not make anything without it!. When you have done bootloader, it becames not-important, but when you don't have it, don't say it. Don't say about you haven't done yet.
Post 10 Aug 2005, 19:30
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.