MikeLankamp / osldr

Operating System Bootloader
MIT License
1 stars 0 forks source link

Installing on disk #1

Closed circutrider21 closed 3 years ago

circutrider21 commented 3 years ago

I have took a look at this boot loader and I am quite interested. The only problem is that the reader doesn't really explain how to install the loader to disk. I have no idea on how to get a first stage boot loader, let alone telling it how to boot the loader. Could you please tell me how I would install a 1st stage loader and get it to load the second stage (osldr).

MikeLankamp commented 3 years ago

Hi @circutrider21, thanks for your interest!

Disclaimer: this is very much an unfinished/unpolished product and is something I wrote many years ago. I put it on GitHub to share rather than let it be deleted and forgotten.

To answer you question, the README has some information:

Take the osldr raw binary produced in the build and place it in the root directory of a FAT-formatted partition or disk, and load it with a stage-1 bootloader.

So basically, it's up to you and your stage-1 bootloader to determine how to load the binary. The binary produced by the build is a plain binary (no ELF or PE/COFF headers, etc) that expects to be loaded at address 0x8000, and has its entry point at 0x8000.

What you could do is copy the file onto a freshly formatted partition so the file is in consecutive sectors and so that your stage-1 bootloader know exactly what disk sector the file is located at.

Does this information help?

circutrider21 commented 3 years ago

Sorta makes more sense now, but I still have one more question. Do you know any first stage bootloaders that are capable of loading osldr? Would grub work, or do I have to write the 1st stage myself.

MikeLankamp commented 3 years ago

GRUB is a stage 1 + stage 2 bootloader. You might be able to reuse the stage-1 boot.img, but I think it makes certain assumptions about the filesystem that don't quite work for osldr. I suggest you look around or write your own. osdev.org has some good info.

circutrider21 commented 3 years ago

Thanks, I'll write my own stage1 and see how that goes for now!