Best Way To Boot
Best Way To Boot
Hello everybody,
I'm making an OS and searched the internet for tuts etc. Many pages are about the bootloader and at each site they do it different. Now, my question is wich bootloader is the fastest?
Some sites I found:
http://www.osdever.net/
http://www.mohanraj.info/josh3.jsp
en.wikipedia.org/wiki/Booting
And maybe some people just know the best way to boot..
I'm making an OS and searched the internet for tuts etc. Many pages are about the bootloader and at each site they do it different. Now, my question is wich bootloader is the fastest?
Some sites I found:
http://www.osdever.net/
http://www.mohanraj.info/josh3.jsp
en.wikipedia.org/wiki/Booting
And maybe some people just know the best way to boot..
Re: Best Way To Boot
Do you really need a bootloader? couldn't that just be built into the kernel? just wondering. I am in about the same situation.
Re: Best Way To Boot
you need a bootloader.
Most people use GRUB as their bootloader (as it is quite advanced and widely used/tested), and other code their own.
If you have no specific needs that GRUB doesn't satisfy, then code your own, or if you just want the challenge and knowledge gained from coding the raw boot-up code, then make your own.
Most people use GRUB as their bootloader (as it is quite advanced and widely used/tested), and other code their own.
If you have no specific needs that GRUB doesn't satisfy, then code your own, or if you just want the challenge and knowledge gained from coding the raw boot-up code, then make your own.
Website: https://joscor.com
Re: Best Way To Boot
No, I've already try that, but it doesn't work. You have to write the bootloader (exactly 512 bytes) to the first section of a floppy (for example).Pasha wrote:Do you really need a bootloader? couldn't that just be built into the kernel? just wondering. I am in about the same situation.
When I boot boot from my floppy, the kernel will be load but I just wonder what the fastest way to boot is?
- JackScott
- Member
- Posts: 1035
- Joined: Thu Dec 21, 2006 3:03 am
- Location: Hobart, Australia
- Mastodon: https://aus.social/@jackscottau
- Matrix: @JackScottAU:matrix.org
- GitHub: https://github.com/JackScottAU
- Contact:
Re: Best Way To Boot
The fastest way, by far, is to not use a floppy at all. Loading off pretty much any other medium (inc. PXE network booting) will be faster.
<$0.02>
I'm of the opinion that the best thing to do would be to just use GRUB to load your kernel. You can set it to boot off pretty much any boot medium, and use any widely-supported filesystem. In addition, your kernel can be a simple ELF-formatted binary, which makes the compile step a bit simpler. GRUB does add a lot of overhead (almost 300kb of code you'll only be using for a few seconds), but in my opinion the flexibility it gives you is worth it. That is, unless you're writing an operating system simply as a learning exercise. Then sticking to writing your own and using a floppy would be the go.
</$0.02>
<$0.02>
I'm of the opinion that the best thing to do would be to just use GRUB to load your kernel. You can set it to boot off pretty much any boot medium, and use any widely-supported filesystem. In addition, your kernel can be a simple ELF-formatted binary, which makes the compile step a bit simpler. GRUB does add a lot of overhead (almost 300kb of code you'll only be using for a few seconds), but in my opinion the flexibility it gives you is worth it. That is, unless you're writing an operating system simply as a learning exercise. Then sticking to writing your own and using a floppy would be the go.
</$0.02>
- Steve the Pirate
- Member
- Posts: 152
- Joined: Fri Dec 15, 2006 7:01 am
- Location: Brisbane, Australia
- Contact:
Re: Best Way To Boot
I'd say that GRUB is the best option - For normal testing, I run my OS off a CD image running Grub (using the El Torito method, which is far better than floppy emulation, and dead easy with mkisofs), and then for real world testing, I just have an entry in my hard drive's GRUB menu so I can restart and run my OS.
Re: Best Way To Boot
I've in my kernel the shell included and my question about that: if I make an apart file (shell.bin) for the shell and (if needed) load it from my kernel, will the kernel load faster? And I've downloaded GRUB and search for some tutorials, but I don't really get it...
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Best Way To Boot
Not really, since the shell needs access to the kernel functions and will probably be a bit larger as a separate binary than it would if it were in the kernel. And you'd have to have both a floppy or HD and a filesystem driver.
Re: Best Way To Boot
Are you asking about speeding up the kernels own initialization/loading routines or the loading of the kernel itself? If the former, it would slow it down. If the latter, maybe as the kernel binary would be smaller (It depends on how the kernel boots).will the kernel load faster?
Also, you should not look for the "best" way to do things as there are not any. Every "best" solution has trade offs of their own that may be beneficial for some design goals. Thus, there is no such thing as the "best way to boot".
You *can* if the kernel binary is copied to sector 0 on disk and can properly load the rest of itself depending on how it is booted. This is quite hackish though imho and not recommended. (It would basically be a bootloader and kernel in one image).Dhaann wrote:No, I've already try that, but it doesn't work. You have to write the bootloader (exactly 512 bytes) to the first section of a floppy (for example).Pasha wrote:Do you really need a bootloader? couldn't that just be built into the kernel? just wondering. I am in about the same situation.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Best Way To Boot
But that always makes it fun!neon wrote:This is quite hackish though imho and not recommended.
Re: Best Way To Boot
True I guess if you are just developing your system for fun then it doesn't really matter.Troy Martin wrote:But that always makes it fun!
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: Best Way To Boot
Hi,
Some random notes...
If you use GRUB for your boot code, then your boot code will never be better (or worse) than any other OS that uses GRUB.
IMHO building the boot loader into the same binary as the kernel is a bad idea - the OS should be at least a little bit modular (so that the same kernel can be used with any boot loader, without recompiling the kernel).
The fastest way to boot is to boot from ROM (but it's extremely complex and motherboard specific). The second fastest way to boot is probably to boot from hard drive. Booting from PXE/network is probably the second slowest way to boot, because it typically takes a few extra seconds to for the ROM code to find DHCP settings, etc. Booting from floppy is the slowest way (but it's also the easiest way, with the most examples/tutorials).
For an OS developer, the time taken to install and then boot is much more important than the time taken for booting alone. For installing the OS and then booting, booting from PXE/network is the fastest way because you can "install" the OS for hundreds of computers just by changing some files in the server's TFTP directory. If you had to go around with a floppy or CD-ROM and install the OS on every computer's hard drive before you boot each computer from hard drive, then booting from hard drive would be slower than booting from CD-ROM or floppy...
Cheers,
Brendan
Some random notes...
If you use GRUB for your boot code, then your boot code will never be better (or worse) than any other OS that uses GRUB.
IMHO building the boot loader into the same binary as the kernel is a bad idea - the OS should be at least a little bit modular (so that the same kernel can be used with any boot loader, without recompiling the kernel).
The fastest way to boot is to boot from ROM (but it's extremely complex and motherboard specific). The second fastest way to boot is probably to boot from hard drive. Booting from PXE/network is probably the second slowest way to boot, because it typically takes a few extra seconds to for the ROM code to find DHCP settings, etc. Booting from floppy is the slowest way (but it's also the easiest way, with the most examples/tutorials).
For an OS developer, the time taken to install and then boot is much more important than the time taken for booting alone. For installing the OS and then booting, booting from PXE/network is the fastest way because you can "install" the OS for hundreds of computers just by changing some files in the server's TFTP directory. If you had to go around with a floppy or CD-ROM and install the OS on every computer's hard drive before you boot each computer from hard drive, then booting from hard drive would be slower than booting from CD-ROM or floppy...
If your boot loader loads "shell.bin" then the time it takes to load will be added to the time it takes to boot. If the kernel loads "shell.bin", then maybe the kernel can do other things while "shell.bin" is being loaded (e.g. initializing other devices, getting network/DHCP settings, mounting other file systems, etc) and maybe the time it takes to load "shell.bin" won't effect the time it takes to boot at all. This depends on your kernel/OS design though - some well known OSs aren't very good at doing anything in parallel during boot...Dhaann wrote:I've in my kernel the shell included and my question about that: if I make an apart file (shell.bin) for the shell and (if needed) load it from my kernel, will the kernel load faster? And I've downloaded GRUB and search for some tutorials, but I don't really get it...
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Best Way To Boot
I will use grub and look for some tutorials.
@Brendan: If the user starts the OS, he/she not always use the shell. So IF NEEDED the shell will be loaded and not every time you start up.
@Brendan: If the user starts the OS, he/she not always use the shell. So IF NEEDED the shell will be loaded and not every time you start up.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Best Way To Boot
Well it depends on the complexity of your OS. Just for kicks, check out AtomicOS.Pasha wrote:Do you really need a bootloader? couldn't that just be built into the kernel? just wondering. I am in about the same situation.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Best Way To Boot
Love4: Bad idea (TM). No good docs, the "file system" described is just loading sectors, hard to use, etc. AtomicOS sucks.