Page 1 of 1
Bootloader design issues
Posted: Tue Sep 19, 2017 10:20 pm
by freelancerdev
Hello, my name is Javier and I live in Cuba. I'm 16 years old and I'm new here, so, forgive me if this is a nonsense topic, but I want to design a new multiboot compliant bootloader. I got the GNU GRUB bootloader source code (in its two "flavours"), so I got a small and humble basis in how that kind of things should work.
I copyied the stage 1 code from GRUB, and i found it was pretty straightforward, but I analize, and analize the code and I can't fix a bug where the bootloader shows me not one, but five notification strings and then halt. I analized the control flow of the program and everything seems normal to me!! I don't know why it behaves that way.
Sorry for any poor english you may found in this post. Greetings from Cuba
Javier
Re: Bootloader design issues
Posted: Wed Sep 20, 2017 6:16 am
by dseller
Can you show us the source code?
Re: Bootloader design issues
Posted: Wed Sep 20, 2017 11:45 am
by freelancerdev
Sure, here it is!! ( This is the code from GRUB in its 0.93 version )
I copyied the code just as it is there.
Perhaps the problem is not the source code at all, perhaps it was my mistake
when installing it to the iso image. I'm not sure.
In any case, thank you very much for your reply.
[The extension s has been deactivated and can no longer be displayed.]
Re: Bootloader design issues
Posted: Thu Sep 21, 2017 3:20 am
by Brendan
Hi,
freelancerdev wrote:Sure, here it is!! ( This is the code from GRUB in its 0.93 version )
I copyied the code just as it is there.
Perhaps the problem is not the source code at all, perhaps it was my mistake
when installing it to the iso image. I'm not sure.
If it worked in GRUB 0.93, you changed nothing, and it doesn't work for you; then it'd have to be a problem with how you're using it (and not a problem with the source code itself).
Note that I'd recommend writing your own code anyway. More specifically, you'd (eventually) want:
- A 1st stage boot loader for "floppy on BIOS"
- A 1st stage boot loader for "MBR partitioned hard disk on BIOS"
- A 1st stage boot loader for "GPT partitioned hard disk on BIOS"
- A 1st stage boot loader for "no emulation El Torito/CD on BIOS"
- A 1st stage boot loader for "PXE/network boot on BIOS"
- Maybe a boot loader for UEFI (depending on which version/s of multi-boot you're planning to support)
For all of these cases, there's enough differences to make it impractical/silly to attempt to cover 2 or more situations with the same code. For example, for the boot loader in an ISO/CD image (the "no emulation El Torito" one), the BIOS loads the entire boot loader (up to about 600 KiB and not just the first 512 bytes); and the boot loader needs to use 2 KiB sectors (not 512 byte sectors), needs to use "int 0x15 extensions" (and never CHS), needs to handle the ISO9660 file system (and not raw sectors or partitions), etc.
Cheers,
Brendan
Re: Bootloader design issues
Posted: Thu Sep 21, 2017 5:45 pm
by freelancerdev
Re: Bootloader design issues
Posted: Fri Sep 22, 2017 1:25 am
by Antti
Brendan wrote:
- A 1st stage boot loader for "GPT partitioned hard disk on BIOS"
What is your current idea of implementing this? To be specific, where should be the auxiliary code for doing the proper parsing of the GPT structures. I have not thought about this lately but I do remember that there were some problems / inelegancy no matter how much I tried.
Perhaps there is a solution that makes sense.