NunoLava1998 wrote:
@iansjack a 512 byte bootloader which should load sector 2, which contains the ASM file to load the C file and it's headers and link.ld. i have dd to place the code into sector 2 (it can extend beyond sector 2, it just starts at sector 2).
Is there a compelling reason why you want to write your own boot loader?
(NB: just saying "I want to learn how to write one" is enough to count, though I would caution against then using that boot loader as your OS loader unless you are willing to spend more time on the boot loader than on the rest of the OS and dealing with an excessive amount of frustration along the way.)
The boot loader is a very small part of the system, takes a disproportionate amount of development time for its significance, and is very difficult to get right to a production scale (even for a hobbyist level of 'production'), which is why we usually recommend going with an existing boot loader for your actual OS.
There
are reasons to write your own boot loader, but the are usually not very good ones. While I am intending to write one myself, it is because my own system is meant to use a very anomalous document system that doesn't play well with conventional file structures, and because I think I might be able to improve on GRUB (unlikely, but why not try?). In the end, though, I realize I am driven by egotism rather than rational goals, and have accepted that.
The point is that you need to think of both your motivations and your goals before committing to a substantial project that is, in the final analysis, likely to be a detour rather than a direct route. Will writing your own boot loader teach you anything significant? Possibly; it can serve as a decent warm-up for more complex problems. Does it further your goal of writing an operating system? Probably not, unless you are doing something very exotic with the file system or the boot sequence. I suggest you give that some thought before going further.
And set up a repo on somewhere like GitHub or Cloudforge. Seriously, you will come to regret it if you don't, and it would make showing us your code problems a loooot easier.